Open voicis opened 2 years ago
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. https://github.com/mswjs/msw/issues/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)
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. https://github.com/TheBrainFamily/wait-for-expect/blob/6be6e2ed8e47fd5bc62ab2fc4bd39289c58f2f66/src/helpers.ts#L22