question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

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:open
  • Created 4 years ago
  • Reactions:7
  • Comments:34

github_iconTop GitHub Comments

14reactions
yaacovCRcommented, Apr 29, 2020

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?

10reactions
SimenBcommented, Jan 26, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found