-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Vitest 3 - Freeze/out of memory error with useFakeTimers
after upgrade
#7288
Comments
This is likely due to the breaking change of fake timer https://vitest.dev/guide/migration.html#fake-timers-defaults
(OOM is obviously bad in any case, but I'm not sure if there's anything Vitest can do.) |
I understand that, but still I think something is fundamentally wrong here - the test has nothing to do with timers. I don't think responses not working should be the intended behaviour, if so there should be a big bold disclaimer in docs about this. Even then, it should tell me, not crash with OOM error that was very hard to pinpoint to this. |
For reference, "mock everything available by default" was also a general direction of the underlying library |
For anyone experiencing anything similar, I just tested and indeed adding the config for the fake timers fixes this: fakeTimers: {
toFake: ["Date", "setTimeout", "clearTimeout"],
}, |
useFakeTimers
after upgrade
undici (the node fetch implementation) is affected by this because it uses queueMicrotask, leading to OOM / never completing tests that use fake timers. See vitest-dev/vitest#7288 for more complete information.
undici (the node fetch implementation) is affected by this because it uses queueMicrotask, leading to OOM / never completing tests that use fake timers. See vitest-dev/vitest#7288 for more complete information.
Describe the bug
I'm facing an out-of-memory error of some of my tests right after upgrading to Vitest 3.
Reproduction
This is a simple test that causes it:
Stackblitz - instead of OOM, it will run forever/freeze instead. Locally it will run for 20-60s and crash with OOM, I guess depending on your PC/RAM/whatever
Stacktrace/output
System info - probably not relevant
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: