Skip to content

Commit f743fbf

Browse files
committed
Update docs with tested process exit fix
1 parent a2bccda commit f743fbf

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

PLAYWRIGHT_WORKER_FIXES.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
### 3. ✅ Process Hanging After Tests Complete (FIXED)
1919
**Problem**: Process doesn't exit after all tests pass, hangs indefinitely
2020
- **Root Cause**: Playwright's internal event loops keep the process alive even after cleanup
21-
- **File**: `lib/helper/Playwright.js` `_cleanup()` method
22-
- **Fix**: Add delayed auto-exit (2 seconds) after cleanup completes
21+
- **File**: `lib/helper/Playwright.js` `_afterSuite()` and `_cleanup()` methods
22+
- **Fix**: Add forced auto-exit (2 seconds) after cleanup completes
2323
- **Details**:
24-
- Uses `setTimeout().unref()` to allow natural exit if possible
25-
- Only exits if no other exit handlers are registered
26-
- Respects existing `process.exitCode`
24+
- Uses `setTimeout().unref()` with forced `process.exit()`
25+
- Unconditionally exits after delay (removed listenerCount check)
26+
- Respects existing `process.exitCode` (0 for success, non-zero for failures)
2727
- Can be disabled with `CODECEPT_DISABLE_AUTO_EXIT=1` environment variable
28-
- **Impact**: Tests now exit cleanly within 2 seconds after completion
28+
- **Testing**: Verified locally - process exits in ~9s (6s test + 2s delay + overhead) instead of hanging indefinitely
29+
- **Impact**: Tests now exit cleanly within 2 seconds after completion in all modes
2930

3031
### 4. ⚠️ Per-Test Config with Session Mode + Workers (LIMITATION DOCUMENTED)
3132
**Problem**: Per-test `.config()` doesn't work in BROWSER_RESTART=session mode with workers

0 commit comments

Comments
 (0)