-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Spurious not wrapped in act
warnings from user-event, react, dom mismatch
#1296
Comments
We can report the same issue with our tests. Upgrading to all the latest versions of |
Fixed by #1295 |
@joshkel I didn't have the problem before, but trying to upgrade to v15 actually causes it for me.
Does I currently only have these:
Edit: Doing this fixes it, ridiculous 🤪
|
@Slessi We're working on moving DTL to peer in RTL so this won't happen :) |
The versions of `@testing-library/dom` in use by `@testing-library/react` and `@testing-library/user-event` got out of sync. They're going to move it to `peerDependencies` in the future to avoid this, but for now, I had to explicitly upgrade the version used by the latter to align it with the one in use by the former. See testing-library/react-testing-library#1296 (comment)
@testing-library/react
version: 14.3.0Relevant code or config:
What you did:
Upgrade to
@testing-library/dom
10.0.0 and@testing-library/react
14.3.0.@testing-library/react
14.3.0 still depends on@testing-library/dom
9.x. As a result of this mismatch, any tests using@testing-library/user-event
now start generating warnings similar to the following:even though Testing Library intends to take care of calling
act
itself.What happened:
Spurious
act
warnings.Reproduction:
https://github.com/joshkel/testing-library-act
This uses an NPM override to force everything to
@testing-library/dom
10.0.0, so the error does not occur. If you delete the override frompackage.json
and rerunnpm i; npm test
, you'll see thatfireEvent.change
does not generate warnings butuserEvent.type
does.Problem description:
See above - ideally, projects within an ecosystem use matching versions, upgrades don't add warnings, etc.
Suggested solution:
Update
@testing-library/react
to use the latest@testing-library/dom
.(I believe that this situation occurred because
@testing-library/user-event
wants@testing-library/dom
via peerDependencies, while@testing-library/react
wants@testing-library/dom
via dependencies - if@testing-library/react
used peerDependencies instead of dependencies, or if@testing-library/user-event
avoided an explicitpeerDependencies
, this would be avoided - although other issues would likely arise.)The text was updated successfully, but these errors were encountered: