You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's impossible to use wait-for-expect and legacy fake timers with Jest v27.
If you set legacy timers in jest config https://jestjs.io/docs/configuration#timers-string, which enables legacy timers for all tests, however after you call waitForExpect it changes to modern timers and they will be used for the rest of the test.
I suspect that this is because the following code which now sets modern timers by default.
My solution is somewhat specific but my problem appears to be a combination of this issue and one related to my usage of the msw library. mswjs/msw#1163
I solved it by replacing waitForExpect with waitFor from @testing-library/vue (which needs to be the next version, the stable version doesn't support Vue 3 yet)
selankon
added a commit
to selankon/lime-app
that referenced
this issue
Nov 9, 2022
It's impossible to use wait-for-expect and legacy fake timers with Jest v27.
So is needed to set legacy timers when using wait for expect and change to fake timers when need to `advanceTimersByTime`.
TheBrainFamily/wait-for-expect#34TheBrainFamily/wait-for-expect#30
selankon
added a commit
to selankon/lime-app
that referenced
this issue
Jan 20, 2023
It's impossible to use wait-for-expect and legacy fake timers with Jest v27.
So is needed to set legacy timers when using wait for expect and change to fake timers when need to `advanceTimersByTime`.
TheBrainFamily/wait-for-expect#34TheBrainFamily/wait-for-expect#30
It's impossible to use
wait-for-expect
andlegacy
fake timers with Jest v27.If you set
legacy
timers in jest config https://jestjs.io/docs/configuration#timers-string, which enableslegacy
timers for all tests, however after you callwaitForExpect
it changes tomodern
timers and they will be used for the rest of the test.I suspect that this is because the following code which now sets
modern
timers by default.wait-for-expect/src/helpers.ts
Line 22 in 6be6e2e
The text was updated successfully, but these errors were encountered: