-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the bug
Note: This seems to be already fixed with the just released v3.0.2 and can immediately be closed if you also consider this to be intentionally fixed with v3.0.2.
However I still thought reporting this as a reference might be worth as others might also face this issue after updating to v3 and search for a solution. Besides that, I think it might be worth mentioning that this appeared after the v3 update as I am not sure by the changelog for v3.0.2 what exactly fixed it. I guess #7281 fixed it.
Bug description:
Since updating to vite v3 (tested v3.0.1), a lot of the following react warning appeared in quite some existing tests that would not emit that warning with vitest <= 3.0.0-beta.1.
I traced it down that these warnings started to be emitted with vitest 3.0.0-beta.2.
Again, after updating to v3.0.2, the issue was gone in my existing tests.
Reproduction
This is kind of a reproduction that creates such a warning.
It is based on the reproduction in #7196 and causes an update to the Button react component after 400ms.
https://stackblitz.com/edit/vitest-fake-timers-act-warnings-trw1va8q?file=src%2FButton.test.tsx
Such a promise at the end of a test is not used in my regular tests, however, that was how I could trigger this warning in the repro.
However, I am unsure whether this is really a good repro of the issue as it kind of intentionally makes the react component to update after the test completed. Still, I thought testing-library/react would call cleanup in a global afterEach after each test which should prevent this.
System Info
System:
OS: Windows 11 10.0.22631
Binaries:
Node: 22.13.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Chromium (131.0.2903.146)
npmPackages:
@vitejs/plugin-react: ^4.3.4 => 4.3.4
@vitejs/plugin-react-swc: ^3.7.2 => 3.7.2
@vitest/coverage-v8: ^3.0.2 => 3.0.2
@vitest/ui: ^3.0.2 => 3.0.2
vite: ^5.4.11 => 5.4.11
vitest: ^3.0.1 => 3.0.1Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.