Skip to content
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

user-event has unmet peer dependency dom #439

Closed
samit4me opened this issue Aug 26, 2020 · 3 comments
Closed

user-event has unmet peer dependency dom #439

samit4me opened this issue Aug 26, 2020 · 3 comments

Comments

@samit4me
Copy link

Using @testing-library/[email protected] and @testing-library/react"@10.4.9 in a project and when running yarn install I get the following warning:

warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=7.21.4".

I see that @testing-library/dom is listed in devDependencies so not sure why this is happening 🤷‍♂️

"@testing-library/dom": "^7.21.4",

Looks like this was raised and resolved previously #335 and also mentioned in CRA facebook/create-react-app#8446

Thoughts?

@Gpx
Copy link
Member

Gpx commented Aug 27, 2020

Hi @samit4me 👋 thanks for bringing this up 🙂
You can find an explanation of why this is here #438 (comment)
Long story short, the problem will be fixed in the future but for now, having a warning is the least evil.
I'm closing this issue but feel free to comment further if you have any followup.

@Gpx Gpx closed this as completed Aug 27, 2020
@sureshjoshi
Copy link

For what it's worth, I just tried using the user-event library for the first time and ran into the same issue, but it's a test/compilation failure for me (yarn2, jest).

Test suite failed to run

    @testing-library/user-event tried to access @testing-library/dom (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound.

    Required package: @testing-library/dom (via "@testing-library/dom")
    Required by: @testing-library/user-event@virtual:c72221a37f247765bf95117c07460d0dd314f91d55e5ef517953f22f13abe08a4eb4ca8da63ad8106639299813447710808040a06701c40efe08bad531b61747#npm:12.1.3 (via /Users/sj/Developer/myrepo/.yarn/$$virtual/@testing-library-user-event-virtual-114389dc81/0/cache/@testing-library-user-event-npm-12.1.3-4ed5fba7b9-af9844d63d.zip/node_modules/@testing-library/user-event/dist/)
    Ancestor breaking the chain: sample@workspace:.

    Require stack:
      .yarn/$$virtual/@testing-library-user-event-virtual-114389dc81/0/cache/@testing-library-user-event-npm-12.1.3-4ed5fba7b9-af9844d63d.zip/node_modules/@testing-library/user-event/dist/click.js
      .yarn/$$virtual/@testing-library-user-event-virtual-114389dc81/0/cache/@testing-library-user-event-npm-12.1.3-4ed5fba7b9-af9844d63d.zip/node_modules/@testing-library/user-event/dist/index.js
      src/app/sign-in.test.tsx

package.json:

 "devDependencies": {
    ...
    "@testing-library/cypress": "^6.0.1",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.0.0",
    "@testing-library/user-event": "^12.1.3",

Installing @testing-library/dom fixes the error.

@nicoandresr
Copy link

In my case I'm using bit.dev to build the isolated components three dependencies, for fix this issue, I must use screen from @testing-library/dom instead of @testing-library/react I changed:

import { render } from '@testing-library/dom'

instead of

import { render } from '@testing-library/react'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants