Skip to content

Commit 5eab620

Browse files
committed
Move auto-exit to global after() hook in unit tests
- Removed auto-exit from _cleanup() to prevent it running after every test suite - Added global after() hook at end of Playwright_test.js with 1s delayed exit - This ensures process exits cleanly only once, after ALL tests complete - Fixes 30-minute timeout issue in GitHub Actions workflows
1 parent 7043f22 commit 5eab620

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lib/helper/Playwright.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -982,14 +982,6 @@ class Playwright extends Helper {
982982
}
983983
}
984984
}
985-
986-
// Schedule a delayed exit to prevent process hanging due to Playwright event loops
987-
// Wait 1 second to allow test runner to print summary statistics before exiting
988-
if (!process.env.CODECEPT_DISABLE_AUTO_EXIT) {
989-
setTimeout(() => {
990-
process.exit(process.exitCode || 0)
991-
}, 1000).unref()
992-
}
993985
}
994986

995987
_session() {

test/helper/Playwright_test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,3 +2229,13 @@ describe('Playwright - storageState file path', function () {
22292229
} catch (_) {}
22302230
})
22312231
})
2232+
2233+
// Global after hook to ensure process exits after all tests complete
2234+
// This prevents the process from hanging due to Playwright event loops
2235+
after(function () {
2236+
if (!process.env.CODECEPT_DISABLE_AUTO_EXIT) {
2237+
setTimeout(() => {
2238+
process.exit(process.exitCode || 0)
2239+
}, 1000).unref()
2240+
}
2241+
})

0 commit comments

Comments
 (0)