Skip to content

Commit ba578e4

Browse files
committed
Add delayed exit after CodeceptJS teardown to prevent process hanging
- Added 1-second delayed process.exit() in lib/command/run.js after teardown - This ensures CodeceptJS acceptance tests exit cleanly after printing stats - Fixes process hanging issue where 'OK | X passed, Y skipped' was printed but process wouldn't exit - Can be disabled with CODECEPT_DISABLE_AUTO_EXIT=1 environment variable
1 parent 5eab620 commit ba578e4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/command/run.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,13 @@ export default async function (test, options) {
4242
process.exitCode = 1
4343
} finally {
4444
await codecept.teardown()
45+
46+
// Schedule a delayed exit to prevent process hanging due to helper event loops (e.g., Playwright)
47+
// Wait 1 second to allow final cleanup and output to complete
48+
if (!process.env.CODECEPT_DISABLE_AUTO_EXIT) {
49+
setTimeout(() => {
50+
process.exit(process.exitCode || 0)
51+
}, 1000).unref()
52+
}
4553
}
4654
}

0 commit comments

Comments
 (0)