-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Issues with latest version of jest with the jsdom environment #64
Comments
Switching from |
I tried using I also tried using But anyway this doesn't solve the problem with jest's fake timers, because they also mock For now I'm not blocked anymore in our project, as I removed the fake timers from the tests that were using this library. |
Hopefully this is fixed in v3.1.4. Please reopen if not. |
Hey,
Recently, the jest folks removed setImmediate and clearImmediate from the jsdom environment (they had it before incorrectly). This is a good thing.
fakeIndexedDB uses the setimmediate polyfill in case
setImmediate
isn't present. This is all good.But... there's a problem when we start using the fake timers. Indeed, the polyfill seems to rely on setTimeout (although I'm not 100% sure why, from their code it should be
process.nextTick
... which isn't a macrotask either in recent node versions actually), andsetTimeout
is using the fake timeouts from jest so never ends.The testing-library folks try to detect if we're in jest with fake timers, and in that case they run some code using the real timers:
https://github.com/testing-library/dom-testing-library/blob/c273ed518cf783591692be8c0c5e5a34feafd4bb/src/helpers.js#L7-L12
Could that be a solution for fakeIndexedDB? Should you move to
process.nextTick
anyway?Thanks for this wonderful tool!
The text was updated successfully, but these errors were encountered: