are there side effects of running jest with --detectOpenHandles --forceExit?
From the documentation, the detectOpenHandles
option is for:
Attempt to collect and print open handles preventing Jest from exiting cleanly. Use this in cases where you need to use --forceExit in order for Jest to exit to potentially track down the reason. This implies --runInBand, making tests run serially. Implemented using async_hooks, so it only works in Node 8 and newer. This option has a significant performance penalty and should only be used for debugging.
The forceExit
option should never be used as a best practice, the only time you have to use is because:
- An async function did not finish
- A promise function did not finish
- A Websocket connection is still open
- A Database connection is still open
- Everything having a connect/disconnect methods did not disconnect before the end of the test