Node JS tests with Jest hang after successful test (locally works fine)

I have 4 suites, 15 tests that pass locally, 4 suites, 15 tests that pass on TravisCI.
Locally it exits cleanly, on Travis it hangs till timeout.

My repository at

Test execution #17 at

Any idea on how to investigate it? I saw other people with the same problem but no solution, yet.

It looks like whatever command you’re running doesn’t exit for some reason after the tests are done. Probably some background activity doesn’t terminate correctly.

E.g. did you pay attention to the big yellow warning about this in the last build?

See also e.g.

The comment about the big yellow warning was useless, as the warning itself doesn’t help me in understanding why it hangs. Adding the package why-is-node-running, and configuring tests for running through it, did solve the problem without letting me know why it hangs otherwise. Then, thank you for that piece of information.

1 Like