-
-
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
setTimeout problems / questions #69
Comments
Same issue for me updating from 3.1.3 to 3.1.4 as I told in #67. My setup:
|
We just ran into issues here as well trying to get a simple test working on a standard factory Node v12.14.1 |
Thanks for looking into this. I'm really not sure what the best solution is here, but let me try to summarize the problem as I understand it:
#68 by @ph-fritsche would make it configurable whether to use setTimeout or setImmediate. But that would still not help for people facing both of the problems above - they could only fix one of those problems, not both. There must be a better solution. Off the top of my head, I'm not sure what that is. But if someone could figure out how to either:
then that would allow me to fix this issue for all cases. |
Fixed in v3.1.6, thank you @joshkel and everyone else who helped debug this! |
I'm having some problems since the upgrade to 3.1.4; Jest tests that previously worked fine are now timing out. I did some digging, and if I understand correctly:
setTimeout
instead ofsetImmediate
.I experimented with using Jest's fake timers to speed up my tests, but they don't appear to be a great solution: because IndexedDB operations result in fake-indexeddb timers which resolve promises which may then trigger additional IndexedDB operations (etc.), there's an awkward dance of trying to figure out which timers and promises are outstanding after each operation so that they can all be properly resolved. (See the linked test case for an example of what this looks like - this gets even harder when using third-party code that may do multiple IndexedDB operations in a row. Maybe there's an easier way to do this in Jest? If so please let me know.)
We ran into this using the idb-keyval package, which, in order to keep a simple API, relies on lots of small operations.
Test case: https://github.com/joshkel/fake-indexeddb-settimeout-test-case
Timings for the "create and read a bunch of values" from that project in fake-indexeddb 3.1.4:
In fake-indexeddb 3.1.3:
The text was updated successfully, but these errors were encountered: