Test run of code running `process.exit(1)` with workers hangs indefinitely
See original GitHub issue🐛 Bug Report
Test run of several test files with workers (i.e., not in band) sometimes hangs indefinitely if the code under test calls process#exit
.
Demo note: y
is an alias for yarn
, and the code is found at https://github.com/theneva/jest-process-exit.
Here’s the output with the diff from #6714 applied:
To Reproduce
Steps to reproduce the behavior:
- Have a test subject that calls
process.exit(1)
- Have one file with a test running that code, and (at least) one other test file which does not run any code calling
process#exit
- Run the test files using workers (that is, without
--runInBand
) - Hope for the best: the test run will sometimes simply terminate (possibly due to invocation order). Example:
A run of only the test file with the failing test always terminates immediately after process#exit
is called, and the same applies when running multiple test files in band.
Expected behavior
The test run should exit with an error message instead of continuing indefinitely.
Additionally, it would be great with feedback on why the test failed via something like @SimenB’s PR https://github.com/facebook/jest/pull/6714.
Link to repl or repo (highly encouraged)
https://github.com/theneva/jest-process-exit is the smallest I could manage.
Run npx envinfo --preset jest
Paste the results here:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
Binaries:
Node: 8.11.2 - ~/.nvm/versions/node/v8.11.2/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.1.0 - ~/.nvm/versions/node/v8.11.2/bin/npm
npmPackages:
jest: ^23.4.1 => 23.4.1
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6 (2 by maintainers)
Top GitHub Comments
Covered by #6714 IMO. Easy enough for people to stub out
process.exit
if they don’t want to exit. Maybe we want to update the message? Not sureFound the same issue yesterday! https://github.com/cirias/hanging-jest