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:
![]()
Steps to reproduce the behavior:
process.exit(1)process#exit--runInBand)![]()
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.
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.
https://github.com/theneva/jest-process-exit is the smallest I could manage.
npx envinfo --preset jestPaste 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
Found the same issue yesterday! https://github.com/cirias/hanging-jest
@mjesun thoughts on this one?
@theneva Would you mind patching #6815 locally (on your node_modules) and checking? This should be good enough, as process.exit (the real one) won't be exposed anymore :)
@mjesun with #6815 applied the tests pass consistently! Nice! :tada:
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 sure