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
V15 causes tests to throw act
warnings
#1310
Comments
This is usually happening due to multiple instances of @testing-library/dom which is a peer dependency of user-event and a dependency for RTL. Try resolving to one version using npm overrides or yarn resolutions. We're currently working on moving DTL to a peer dependency in RTL too. |
@MatanBobi I am also getting this issue too, can you explain how to resolve this. Maybe a code snippet would be great. Thanks |
Having the same issue with tests with react 18.3.0. Tried to put
|
@belozerov The warning you see here is related to a bug in React's release where they didn't export @brandanking-decently - To verify that it's indeed that problem, you'll need to see if you have multiple version of @testing-library/dom installed. If you do, you'll need to use yarn resolutions of npm overrides to set it to the same version (10), this is defined in your |
In our app we use Mantine which has a LOT of transitions.
We suppress all transitions by setting their duration to 0 in tests, so that we don't have to
await findBy
in every single test.I tried upgrading Vite and Vitest in our project to 5.2 and 1.5 respectively, and at the same time, upgrade
testing-library/react
from 14 to 15, as well as some other supporting libraries.This immediately caused nearly every single test (out of 1500) to start throwing
act
warnings. Sometimes multiple per test. I then started doing a 50/50 to figure out which library upgrade caused this; i.e. upgrading some without the others. Turns out it was@testing-library/react
moving to 15 that caused this issue.Downgrading to 14, while keeping Vite 5.2 and Vitest 1.5 solved the issue, and now all the tests pass without throwing an
act
warning.My question is what could have possibly been changed in V15? I looked at the release notes and there was no mention of anything in particular.
Here's my
package.json
:The text was updated successfully, but these errors were encountered: