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

"warning " > @testing-library/user-event@12.6.2" has unmet peer dependency "@testing-library/dom@>=7.21.4". #551

Closed
tonydehnke opened this issue Jan 31, 2021 · 7 comments
Labels
question Further information is requested

Comments

@tonydehnke
Copy link

Hi, newbie here, so I will try to put as much info as I can. This is not a problem using the package, just a warning on install.

  • @testing-library/user-event version: 12.6.2
  • node: 14.x

What you did:
When running yarn install with the latest user-event version, while linking dependencies I get the following warning:
warning " > @testing-library/user-event@12.6.2" has unmet peer dependency "@testing-library/dom@>=7.21.4".

From what I have read, this means that in the user-event package, it is missing the package as a dependency, and this should be corrected in the user-event package. Is that correct?

@nickmccurdy
Copy link
Member

nickmccurdy commented Jan 31, 2021

@testing-library/user-event depends on @testing-library/dom. If user-event listed dom as a dependency, there may be multiple versions of dom installed (via framework packages like @testing-library/react) which could break tests or types. To avoid this, user-event lists dom as a peer dependency.

Further explanation: #438 (comment)

The solution is to install @testing-library/dom manually in projects that use @testing-library/user-event, or use a package manager that automatically installs peer dependencies (like npm 7).

@nickmccurdy nickmccurdy added the question Further information is requested label Jan 31, 2021
@tonydehnke
Copy link
Author

Thanks for the info and link Nick, I'll read up on it some more.

@nickmccurdy
Copy link
Member

If that doesn't fix the error feel free to reply here or ask on Discord: https://discord.gg/testing-library

@dietergeerts
Copy link

Hi, we have this error in our rush mono-repo, but it's hard to figure out how these work in the combination of testing-library packages. We have the following listed currently (we are moving to a mono-repo, these where the dependencies we currently have, and do work):

    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.5",
    "@testing-library/react-hooks": "^5.1.2",
    "@testing-library/user-event": "^12.8.3",

So the @testing-library/react lib here has an actual dependency on @testing-library/dom, which makes it unavailable to any other package due to our usage of pnpm/rush combo. @testing-library/user-event is stating it as a peer-dependency, but if we would add that, it will conflict with the one stated in @testing-library/react.

A solution that I see is that the @testing-library/react package should state @testing-library/dom as a peerDependency too. I don't know if this is possible, or if there is some other better logic that I'm not seeing here?

@NixBiks
Copy link

NixBiks commented May 24, 2022

Is it expected to get missing peer @testing-library/dom@>=7.21.4 when I have @testing-library/react installed?

The issue is that pnpm returns error code on missing peer dependencies by default. Of course I could disable that but I think it makes sense to have that return an error. The issue here is that I'm getting told that I'm missing a dependency which I'm not actually missing.

@nickmccurdy I did take a look at #438 (comment) but I'm still not sure here.

@carlbleick
Copy link

@mr-bjerre Did you resolve the issue with pnpm?

@NixBiks
Copy link

NixBiks commented Jul 19, 2022

@mr-bjerre Did you resolve the issue with pnpm?

No. However you can have pnpm return success even though there are unmet peer dependencies. Not exactly a solution but a workaround I guess

programmiri added a commit to Aiven-Open/klaw that referenced this issue Oct 27, 2022
@testing-library/user-event has a peerDep for @testing-library/dom
but it's a different version than the one that @testing-library/react
uses and brings in as a devDep. Solution based on research on GitHub
shows we can either ignore the warning in pnpm or install the
@testing-library/dom as devDep in the version that @testing-library/react
uses it. I did the latter hoping that in one of the next versions of
@testing-library/user-event this will be resolved.

see
testing-library/user-event#438 (comment)
testing-library/user-event#551 (comment)
programmiri added a commit to Aiven-Open/klaw that referenced this issue Oct 27, 2022
@testing-library/user-event has a peerDep for @testing-library/dom
but it's a different version than the one that @testing-library/react
uses and brings in as a devDep. Solution based on research on GitHub
shows we can either ignore the warning in pnpm or install the
@testing-library/dom as devDep in the version that @testing-library/react
uses it. I did the latter hoping that in one of the next versions of
@testing-library/user-event this will be resolved.

see
testing-library/user-event#438 (comment)
testing-library/user-event#551 (comment)
programmiri added a commit to Aiven-Open/klaw that referenced this issue Oct 28, 2022
@testing-library/user-event has a peerDep for @testing-library/dom
but it's a different version than the one that @testing-library/react
uses and brings in as a devDep. Solution based on research on GitHub
shows we can either ignore the warning in pnpm or install the
@testing-library/dom as devDep in the version that @testing-library/react
uses it. I did the latter hoping that in one of the next versions of
@testing-library/user-event this will be resolved.

see
testing-library/user-event#438 (comment)
testing-library/user-event#551 (comment)
programmiri added a commit to Aiven-Open/klaw that referenced this issue Oct 31, 2022
@testing-library/user-event has a peerDep for @testing-library/dom
but it's a different version than the one that @testing-library/react
uses and brings in as a devDep. Solution based on research on GitHub
shows we can either ignore the warning in pnpm or install the
@testing-library/dom as devDep in the version that @testing-library/react
uses it. I did the latter hoping that in one of the next versions of
@testing-library/user-event this will be resolved.

see
testing-library/user-event#438 (comment)
testing-library/user-event#551 (comment)
SmuliS pushed a commit to Aiven-Open/klaw that referenced this issue Nov 1, 2022
* feat: Add app directory and restructure related files.

* feat: Change unused vars to error for linting.

* feat: Add Form component based on aiven-core implementation.

* feat: Add userEvent package.

@testing-library/user-event has a peerDep for @testing-library/dom
but it's a different version than the one that @testing-library/react
uses and brings in as a devDep. Solution based on research on GitHub
shows we can either ignore the warning in pnpm or install the
@testing-library/dom as devDep in the version that @testing-library/react
uses it. I did the latter hoping that in one of the next versions of
@testing-library/user-event this will be resolved.

see
testing-library/user-event#438 (comment)
testing-library/user-event#551 (comment)

* feat: Add tests for Form based on aiven-core.

* feat: Introduce explicit typing for Form.

- remove use of 'any' type
- add stricter rule for use of any for linting

* feat: Update lodash usage to match dependencies.

* Remove comment about aiven-core mirroring

* Remove unused library.

* Rename and restructure pages files.

- `index.tsx` should be reserved for resource root
- files for pages can live on first level in `pages`
- rename files to match  naming conventions for react
- update documentation to be more explicit and correct

* Add login page to routing.

* Reorder lint rules after rebase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants