Opt-out of Jest FakeTimers
See original GitHub issueDescribe the feature you’d like:
I had to pin the DTL version to 7.29.4 in ATL because some tests that were using waitFor
and waitForElementToBeRemoved
were failing (I think this was also the root cause for https://github.com/testing-library/dom-testing-library/issues/901).
This issue still persists to this date (I just tried to upgrade the DTL to its latest version).
After some time debugging, I think that the problem is that DTL falsely assumes that the Angular tests are using jest’s fake timers. This is because Angular patches the timers API.
Suggested implementation:
I would like to add an option to the config to opt-out of this behavior since I don’t see a better way to check if fake timers are used.
Describe alternatives you’ve considered:
Could we patch the useFakeTimers
method, and use that to know if fake timers are used? This would replace the existing check.
Teachability, Documentation, Adoption, Migration Strategy:
/
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (11 by maintainers)
I agree that decoupling DTL from jest is a good idea, I’d prefer configuring the the test environment in the
configure
and not wrappinguseFakeTimers
anduseRealTimers
so users won’t need to adapt every test suite they have at the moment…OK thanks, I’ve opened https://github.com/testing-library/dom-testing-library/issues/987.