Jest did not exit one second after the test run has completed
See original GitHub issueGoals
Trying to close Realm instance after each unit test.
Expected Results
Everything shutdown nicely.
Actual Results
Test succeeds but Jest complains there are asynchronous operations that weren't stopped, then the Jest process will hang.
Steps to Reproduce
- Minimal realm set up
- Open the database during one test
- Close the database once done.
Code Sample
https://github.com/simophin/realm-close-issue
$ npm install && npm run test
This is the result I got:
npm run test
> testrealm@1.0.0 test /Users/***/Temp/testrealm
> jest ./src
PASS src/__tests__/realm-tests.ts
realmTest
✓ should exist (17 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 1.339 s, estimated 2 s
Ran all test suites matching /.\/src/i.
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
Also, if I add --detectOpenHandles to jest, the test will succeed, without the complain, but still hang.
If I added --detectOpenHandles --forceExit to jest, the test will succeed, without the complain, and terminate successfully.
This does not happen in realm-js 5.0.x, only after we upgraded to 6.0.
Version of Realm and Tooling
- Realm JS SDK Version: 6.0.2
- Node or React Native: Node 10.21.0
- Client OS & Version: Mac OS
- Which debugger for React Native: None
Issue Analytics
- State:
- Created 3 years ago
- Reactions:14
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Jest did not exit one second after the test run has completed ...
Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped...
Read more >Jest did not exit one second after the test run has completed.
Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped...
Read more >How To Fix: Jest Did Not Exit - DONN FELKER
Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped...
Read more >Testing Asynchronous Code · Jest
When you have code that runs asynchronously, Jest needs to know when the code it is testing has completed, before it can move...
Read more >Jest did not exit one second after the test run has ... - 인프런
Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped...
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 Free
Top 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
The fix has been released in version 10.8.0.
@simophin we have found the issue and the fix should arrive in the next release.