Jest is hanging constantly on last test suite runs. Every time the last test suite is different. I have tried with runInBand options but no luck.


I got some luck after running node_modules/.bin/jest --clearCache then node_modules/.bin/jest
now works mostly. But still, it's not stable enough.
"scripts": {
"test": "jest --clearCache && jest --silent"
}
I have installed watchman via homebrew also as pointed out on other issues but no luck. Could please help us to fix the issue. Please let me know if any information is needed.
Environment Information:
System:
OS: macOS Sierra 10.12.6
CPU: x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Binaries:
Node: 6.11.1 - ~/.nvm/versions/node/v6.11.1/bin/node
npm: 5.3.0 - ~/.nvm/versions/node/v6.11.1/bin/npm
npmPackages:
jest: ^23.4.1 => 23.4.1
Thanks!
Without a reproduction this is not actionable for us. Happy to reopen if one is provided.
Facing the same issue. @RajaJaganathan Were you able to resolve it?
@laumair There is no issue with jest, I have fixed this issue by modifing my tests code. I faced this issue when I migrated from mocha to jest. One notable issue is that we need to call 'done' callback properly if test is asynchronous.
For example, Test might completed before our asynchronous function call gets completed. Those asynchronous call might be the problem.
I have a completely trivial test like the following:
test('something', async () => {
let value = await something();
expect(value).toBe(true)
})
Even if I explicitly finish the test with done, it just spins forever:
test('something', async (done) => {
let value = await something();
expect(value).toBe(true)
done()
})
Most likely because something() never resolves - but the test never times out, so my only option is CTRL+C, which doesn't tell me where it was or what it was doing.
Why doesn't it respect the timeout?
How do you diagnose something like this?
Most helpful comment
I have a completely trivial test like the following:
Even if I explicitly finish the test with
done, it just spins forever:Most likely because
something()never resolves - but the test never times out, so my only option is CTRL+C, which doesn't tell me where it was or what it was doing.Why doesn't it respect the timeout?
How do you diagnose something like this?