Skip to content

Commit 8e495d9

Browse files
DavertMikDavertMikclaude
authored
fix: process hangs when _beforeSuite helper hook throws an error (#5515)
Add recorder.catch() for suite.before and suite.after events in helpers listener. Unlike all other hook events (test.before, test.after, etc.), these suite-level events had no catch handler, so rejected promises from helper hooks like Playwright._beforeSuite() were unhandled — mocha's done callback was never called, causing the process to hang indefinitely. Also disable store.dryRun during check command's helper setup/teardown verification so it actually launches the browser and can detect issues like missing Playwright browser installations. Co-authored-by: DavertMik <davert@testomat.io> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f059702 commit 8e495d9

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/command/check.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export default async function (options) {
135135
printCheck('plugins', checks['plugins'], Object.keys(Container.plugins()).join(', '))
136136

137137
if (Object.keys(helpers).length) {
138+
store.dryRun = false
138139
const suite = Container.mocha().suite
139140
const test = createTest('test', () => {})
140141
checks.setup = true
@@ -166,6 +167,7 @@ export default async function (options) {
166167
}
167168

168169
printCheck('Helpers After', checks['teardown'], standardActingHelpers.some(h => Object.keys(helpers).includes(h)) ? 'Closing browser' : '')
170+
store.dryRun = true
169171
}
170172

171173
try {

lib/listener/helpers.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ export default function () {
3030
event.dispatcher.on(event.suite.before, suite => {
3131
// if (suite.parent) return; // only for root suite
3232
runAsyncHelpersHook('_beforeSuite', suite, true)
33+
recorder.catch()
3334
})
3435

3536
event.dispatcher.on(event.suite.after, suite => {
3637
// if (suite.parent) return; // only for root suite
3738
runAsyncHelpersHook('_afterSuite', suite, true)
39+
recorder.catch()
3840
})
3941

4042
event.dispatcher.on(event.test.started, test => {

0 commit comments

Comments
 (0)