jest-haste-map: TypeError: dupMap.get is not a function
See original GitHub issueš Bug Report
Running a jest test results in a test build failure:
TypeError: dupMap.get is not a function
at ModuleMap._getModuleMetadata (node_modules/jest-haste-map/build/ModuleMap.js:231:14)
When console logging dupMap
at the source location, dupMap
is undefined. I donāt see a control flow where this is possible because when dupMap is declared, it is set to EMPTY_MAP if itās value would be undefined.
The error is also bound to a material-ui style object, which doesnāt make much sense.
To Reproduce
Steps to reproduce the behavior:
Iām afraid I donāt have a reproduction. Iām using lerna
and material-ui
in jest. The library Iām experiencing the issue with is dependent on another library in my mono repo.
Expected behavior
The test runs without problems
Link to repl or repo (highly encouraged)
Unavailable, sorry
envinfo
System:
OS: Linux 5.0 Ubuntu 18.04.2 LTS (Bionic Beaver)
CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
Binaries:
Node: 10.16.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
npmPackages:
jest: ^24.9.0 => 24.9.0
My jest config:
"jest": {
"collectCoverageFrom": [
"packages/**/*.{js,jsx,mjs}",
"!packages/**/common/icons/components/*",
"!packages/**/*.stories.{js,jsx,ts,tsx}",
"!packages/**/**/story/**/*.{js,jsx,ts,tsx}"
],
"moduleDirectories": [
"node_modules"
],
"setupFilesAfterEnv": [
"<rootDir>/config/jest/setup.js"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/packages/**/?(*.)(spec|test).{js,jsx,mjs}"
],
"testEnvironment": "jsdom",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
],
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx",
"node",
"mjs",
"ts",
"tsx"
]
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:34
Top Results From Across the Web
How to resolve the jest-haste-map error in react-native?
Try to uninstall react-native from node_module folder using command npm uninstall react-native. and then re-install that module using command
Read more >TypeError: map.get is not a function in JavaScript | bobbyhadz
The "Map.get is not a function" error occurs when we call the `get()` method on a value that is not a `Map` object....
Read more >Top 5 jest-haste-map Code Examples - Snyk
To help you get started, we've selected a few jest-haste-map examples, based on popular ways it is used in public projects. Secure your...
Read more >jest typeerror: url.createobjecturl is not a function - You.com
TypeError : dupMap.get is not a function at ModuleMap._getModuleMetadata (node_modules/jest-haste-map/build/ModuleMap.js:231:14). When console logging dupMapĀ ...
Read more >jest-haste-map - npm
This package does not have a README. Add a README to your package so that users know how to get started.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was able to get rid of this error by calling jest --clearCache, probably because I had fixed one of the other causes listed above, but the cache retained the error?
For the umpteenth time, if you want it fixed somebody needs to put together a repository, or some other reproduction, where we can see the error.
https://www.snoyman.com/blog/2017/10/effective-ways-help-from-maintainers