-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jest did not exit one second after the test run has completed #2993
Comments
We'll need to investigate this further. |
FWIW I'm experiencing these same symptoms using react native
React Native info:
|
Experiencing the same with Realm-js v6.0.0 |
Same here with Realm-js v6.1.7 |
I solved it with mocks
|
I am experiencing this issue. This warning shows up on any single test (even for files that don't import Realm) or after all tests are run. If I remove the reference to Realm in files, the issue persists. It's only when I completely remove Realm from package.json does this warning go away. When I run I do use I have seen this warning with issues using Mongoose, when the connection is not being closed correctly. Realm doesn't seem to have an explicit way of closing connections. Would someone be able to explain this? I'm using Realm in an unmanaged Expo app:
Here's an abridged example of how Realm is being used: const wallet = await KeychainStorage.getItemAsync('wallet');
const realm = await Realm.open({ schema: [WalletAddressSchema] });
const walletAddresses = await realm.objects('WalletAddress');
const index = walletAddresses.length;
const address = await Generator.generateAddress(
wallet.seed,
index,
network,
scheme
);
realm.write(() => {
realm.create('WalletAddress', {
address,
index,
});
}); But like I said, I could comment out this code and any import and reference to Realm, and the issue persists. It isn't until Realm is no longer in package.json does this warning go away. Update 1 I did find examples of using |
I am experiencing the same issue with Jest and React native.
Using --detectOpenHandles just hides the warning but the test still waits to be finished This is the code of a test using a Realm in memory database:
Jest warning after run the test: Jest did not exit one second after the test run has completed. |
@simophin we have found the issue and the fix should arrive in the next release. |
The fix has been released in version 10.8.0. |
Goals
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
Code Sample
https://github.com/simophin/realm-close-issue
$ npm install && npm run test
This is the result I got:
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
The text was updated successfully, but these errors were encountered: