question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't use jest --forceExit

See original GitHub issue

This 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:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
nickmccurdycommented, Sep 19, 2017

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 use app.callback(). See https://github.com/koajs/koala/pull/55/commits/31b6f42609f6c0ec20713a84a6f2ea626e9a49ae.

0reactions
nickmccurdycommented, Sep 26, 2017

Thanks! Looks like we forgot to remove the flag, see #1071.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found