-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Switching from jest to vitest causes thousands of act(...)
related warnings.
#1242
Comments
What is your react version? |
@sheremet-va These might also be relevant:
|
I have a minimal reproduction of the issue here: https://github.com/airjp73/vitest-act-reproduction |
I will look into this today. |
@MarkLyck can you try Vitest 0.12.0? |
@sheremet-va :) After upgrading to 0.12.0 my thousands of The ~15 warnings left (that do not happen with jest) are probably fixable, and the CI/CD while it still takes longer than jest for some reason? It no longer times out :) Thank you! We can finally move forward with switching to vitest now I think. |
This issue seems to be fixed in 0.12.0 🎉 Thanks @sheremet-va |
Describe the bug
I'm trying to switch my project with ~400 unit tests from using
jest
to usingvitest
.It did not take much effort to get all my tests passing. But after fixing the tests that broke in the transition I'm now getting thousands of warnings like this:
even a simple test like this:
Generates 128
act
related warnings.The first thing I tried was to put in some:
Just to see if adding waiting time in-between statements would solve these? In some cases this will fix "some" of the
act
warnings. But not all of them.E.g. I had 1 test that produced 32 act warnings and adding an
act
wait between every single line reduced it to 10 warnings. But there's no where else i could put one.Next I tried
vi.useFakeTimers()
andvi.runAllTimers()
as well asvi.runAllTicks()
I even tried adding them between every line like this:
But the act warnings just won't go away :(
I'm running out of ideas on what to try to fix this. I was really hoping vitest would be "mostly" a drop-in replacement for
jest
. But there is clearly something here that jest handles gracefully that vitest doesn't have? and adding manual timers don't seem to fix it.Reproduction
I spent hours trying to make a reproduction on StackBlitz, but so far I have had no luck :(.
I would be happy to share access to the private repo I am working on where this happens to any contributor of vitest to help resolve this, and I would be free to hop on a call and do what I can to help debug.
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: