--detectOpenHandles prints nothing, just hangs
See original GitHub issueđ Bug Report
When I run my test suite I get one of these 2 messages:
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --runInBand --detectOpenHandles to find leaks.
or
Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that werenât stopped in your tests. Consider running Jest with
--detectOpenHandlesto troubleshoot this issue.
For one, I think the mention of --runInBand in the first message is probably not necessary. But in any case, when I start running jest with --detectOpenHandles, I get no output, jest just hangs after finishing the tests.
Expected behavior
I would expect detectOpenHandles to give me actionable output.
envinfo
$ npx envinfo --preset jest
npx: installed 1 in 1.775s
System:
OS: macOS 10.15.2
CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
Binaries:
Node: 10.18.0 - ~/.nvm/versions/node/v10.18.0/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.6 - ~/.nvm/versions/node/v10.18.0/bin/npm
npmPackages:
jest: ^25.1.0 => 25.1.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:147
- Comments:54 (1 by maintainers)
Top Related StackOverflow Question
Iâm seeing the same issue. Iâm not asking for help debugging my code, Iâm pointing out a âconcrete problem in jestâ. In some code bases, when running jest with
--runInBand --detectOpenHandles, as recommended by the CLI, the tests complete with no reported issues and jest hangs.I have not been able to isolate a minimal reproduction, but this does not mean the issue isnât real. Unless this is expected behavior, please reopen in acknowledgement that this is clearly affecting users.
this solves it âtestâ: âjest --watch --runInBand --detectOpenHandlesâ