Closed
Description
@testing-library/react
version: 10.4.4- Testing Framework and version: Jest 24.9.0 (Create React App)
- DOM Environment: jsdom 14.1.0 (Create React App)
Relevant code or config:
// In a component
useEffect(() => {
// any effect
}, [])
// In the tests
beforeEach(jest.useFakeTimers)
afterEach(jest.useRealTimers)
What you did:
I have a component that has a useEffect
in it and its tests use jest.useFakeTimers
. My tests for the component passed until I updated to @testing-library/react
10.4.4.
What happened:
The test now fails with this message:
Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.
at mapper (node_modules/jest-jasmine2/build/queueRunner.js:25:45)
Reproduction:
See https://github.com/awesomeunleashed/rtl-10-4-4-repro
Problem description:
I believe these tests should still be passing.
Suggested solution:
I imagine this has something to do with the scheduler changes in testing-library/react-testing-library#732, as useEffect
and jest.useFakeTimers
sound like scheduling-related things, but I don't see anything obviously related without knowing the code.
Metadata
Metadata
Assignees
Labels
No labels