jest-haste-map: Haste module naming collision

Created on 12 Mar 2019  路  15Comments  路  Source: facebook/jest

馃悰 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

Bug

Most helpful comment

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']

All 15 comments

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?

Peer dependency warning is annoying, but doesn't hurt. Tracked in https://github.com/facebook/jest/issues/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)

Thank you. What is haste anyway?

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.

So you're saying I should completely ignore the warnings (which is what https://github.com/facebook/jest/issues/8107 is about, I guess)?

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']

??

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

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

same question please answer.
'

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']

where can I add this line.
@jeysal

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

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?

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.

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

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

Was this page helpful?
0 / 5 - 0 ratings