Don't use jest --forceExit
See original GitHub issueThis is an antipattern since it can make running the test watcher less performant and the flag is meant to be a temporary solution. The best way to fix this is by passing app.callback()
to supertest instead of app.listen()
. The former has a server automatically created and closed by supertest, while the latter creates an unclosed server.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Jest CLI Options
The jest command line runner has a number of useful options. You can run jest --help to view all available options. Many of...
Read more >are there side effects of running jest with --detectOpenHandles
The forceExit option should never be used as a best practice, the only time you have to use is because: An async function...
Read more >Jest CLI Options - GitHub Pages
--forceExit #. Force Jest to exit after all tests have completed running. This is useful when resources set up by test code cannot...
Read more >Jest / npm / yarn test hang at the end of the test (e.g. at Ran all ...
The tests are performed (e.g. npm test or yarn test) but the step hangs / does not finish. E.g. Test Suites: 32 passed,...
Read more >Jest CLI Options - w3resource
If you are running Jest via npm test, you also use the command line ... You should use this in cases where you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is no difference in how the server is requested, but the server is automatically created and closed when you use
app.callback()
.app.listen()
does not automatically close the server, it stays open. We could set up after each statements in every test suite to manually close the servers, but I find it easier to just useapp.callback()
. See https://github.com/koajs/koala/pull/55/commits/31b6f42609f6c0ec20713a84a6f2ea626e9a49ae.Thanks! Looks like we forgot to remove the flag, see #1071.