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

jest-haste-map: Haste module naming collision #8114

Closed
domoritz opened this issue Mar 12, 2019 · 16 comments
Closed

jest-haste-map: Haste module naming collision #8114

domoritz opened this issue Mar 12, 2019 · 16 comments
Labels

Comments

@domoritz
Copy link

🐛 Bug Report

In https://github.com/vega/vega-embed, I get this warning

warning "jest > jest-cli > jest-config > [email protected]" has unmet peer dependency "jest-haste-map@^24.0.0".
warning "jest > jest-cli > @jest/core > [email protected]" has unmet peer dependency "jest-resolve@^24.1.0".

When I install these dependencies, I get

jest-haste-map: Haste module naming collision: vega-embed
  The following files share their name; please adjust your hasteImpl:
    * <rootDir>/package.json
    * <rootDir>/build/package.json

I don't expect to see these warnings.

Run npx envinfo --preset jest

  System:
    OS: macOS 10.14.3
    CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
  Binaries:
    Node: 11.11.0 - /usr/local/bin/node
    Yarn: 1.13.0 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
  npmPackages:
    jest: ^24.4.0 => 24.4.0
@joshbroton
Copy link

Related issue with same error message:

I have three different packages that all require a specific version of same dependency, but those versions are all different. This situation means I have three different versions installed in node-modules.

Is there a way to exclude two of the versions from Jest? If not, is there a solution to this issue?

@SimenB
Copy link
Member

SimenB commented Mar 20, 2019

Peer dependency warning is annoying, but doesn't hurt. Tracked in #8107


Jest doesn't come with a haste implementation, so this is not the correct repo for that.


Duplicated deps should be handles by your package manager (npm or yarn)

@SimenB SimenB closed this as completed Mar 20, 2019
@domoritz
Copy link
Author

Thank you. What is haste anyway?

@jeysal
Copy link
Contributor

jeysal commented Mar 20, 2019

Haste is Facebook's custom module system, but we still use jest-haste-map for normal projects without Haste. You shouldn't need to worry about it.

@domoritz
Copy link
Author

So you're saying I should completely ignore the warnings (which is what #8107 is about, I guess)?

@jeysal
Copy link
Contributor

jeysal commented Mar 20, 2019

Sorry, I was just answering to the question in general without having looked at your issue. Not sure what the root cause of these warnings is, but the quick way to get rid of them is probably modulePathIgnorePatterns: ['<rootDir>/build']

@newhopestar

This comment has been minimized.

@guitorioadar
Copy link

jeysal
where can i add this : modulePathIgnorePatterns: ['<rootDir>/build']

@bishwajeet-billme

This comment has been minimized.

@bishwajeet-billme

This comment has been minimized.

@SimenB
Copy link
Member

SimenB commented Nov 4, 2019

In config: https://jestjs.io/docs/en/configuration#modulepathignorepatterns-array-string

@imnickvaughn
Copy link

in jest.config.js or jest.base.config.js

@aheidelberg
Copy link

For me jest even looks outside of the rootDir. I have the same project checked out twice in folders next to each other, that's why the names are colliding.

jest-haste-map: Haste module naming collision: myapp
  The following files share their name; please adjust your hasteImpl:
    * <rootDir>/package.json
    * <rootDir>/../sf-3/package.json

jest-haste-map: Haste module naming collision: Select2
  The following files share their name; please adjust your hasteImpl:
    * <rootDir>/public/resources/js/select2/package.json
    * <rootDir>/../sf-3/web/resources/js/select2/package.json

Adding this line modulePathIgnorePatterns: ['<rootDir>/..'] suppresses the warnings but this shouldn't happen, should it?

@jasonkarns
Copy link

jasonkarns commented Mar 21, 2020

a delightful JavaScript Testing Framework with a focus on simplicity

Yep, quite simple. 😄

A tarball is downloaded (as part of a test) to a tmp/ dir in my project that happens to have a package.json with a duplicate name. Then I get the same above error about jest-haste-map telling me to adjust my hasteImpl. I don't have a 'hasteImlp'!!! and I shouldn't need to know what "haste" is just to get jest to run quietly.

jasonkarns added a commit to nodenv/actions that referenced this issue Mar 21, 2020
If the nodenv tarball (as downloaded by the tool-cache) lives in tmp/
along with the "cached" version, then jest's haste-map nonsense will
find duplicate package names and throw a warning. (Despite these
packages never being required!?!?)

Option: configure "modulePathIgnorePatterns": ["/tmp"] in package.json

Or: move the temp download cache out of the project

jestjs/jest#8114
jasonkarns added a commit to nodenv/actions-setup-nodenv that referenced this issue Mar 21, 2020
If the nodenv tarball (as downloaded by the tool-cache) lives in tmp/
along with the "cached" version, then jest's haste-map nonsense will
find duplicate package names and throw a warning. (Despite these
packages never being required!?!?)

Option: configure "modulePathIgnorePatterns": ["/tmp"] in package.json

Or: move the temp download cache out of the project

jestjs/jest#8114
jasonkarns added a commit to nodenv/actions that referenced this issue Mar 22, 2020
If the nodenv tarball (as downloaded by the tool-cache) lives in tmp/
along with the "cached" version, then jest's haste-map nonsense will
find duplicate package names and throw a warning. (Despite these
packages never being required!?!?)

Option: configure "modulePathIgnorePatterns": ["/tmp"] in package.json

Or: move the temp download cache out of the project

jestjs/jest#8114
jasonkarns added a commit to nodenv/actions-setup-nodenv that referenced this issue Mar 22, 2020
If the nodenv tarball (as downloaded by the tool-cache) lives in tmp/
along with the "cached" version, then jest's haste-map nonsense will
find duplicate package names and throw a warning. (Despite these
packages never being required!?!?)

Option: configure "modulePathIgnorePatterns": ["/tmp"] in package.json

Or: move the temp download cache out of the project

jestjs/jest#8114
@Doaa-Ismael
Copy link

jeysal
where can i add this : modulePathIgnorePatterns: ['<rootDir>/build']

in jest configuration (jesst.config or in package.json)

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests