Using something from testing library causes warning: Jest did not exit one second after the test run has completed.
See original GitHub issueDescribe the bug
When I import and using something from @testing-library/react-native
the following warning appears:
Jest did not exit one second after the test run has completed.
Expected behavior
This warning does not appear
Steps to Reproduce
Just import render
and use it in a test:
import React from 'react';
import { Text } from 'react-native';
import { render } from '@testing-library/react-native';
it('testing library working', () => {
const { getByText } = render(<Text>123</Text>);
const text = getByText(/123/);
expect(text).toBeTruthy();
});
Screenshots
Versions
npmPackages:
@testing-library/react-native: ^9.1.0 => 9.1.0
react: ^17.0.2 => 17.0.2
react-native: ^0.67.3 => 0.67.4
react-test-renderer: ^17.0.2 => 17.0.2
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:7 (1 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 >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 >Don t run the environment loader twice - Grande Pelle
Jest did not exit one second after the test run has completed when using GitHub Actions and Firebase; Why does my useEffect react...
Read more >React Testing Library and the “not wrapped in act” Errors
…, unit test has no idea that advancing timers will cause component updates, and you will get the “not wrapped in act” error....
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
I was about to say - downgrading Jest to
27.5.1
seems to have fixed it for me.I still feel like this issue should be reopened though, feels like there’s something in the way @testing-library/react-native methods operate that cause this to be an issue in jest v28+.
Can confirm that downgrading to the version that expo supports fixed the issue for me. Command I used fyr