jestjs/jest

jest-haste-map: TypeError: dupMap.get is not a function

Open

#9,021 建立於 2019年10月8日

在 GitHub 查看
 (42 留言) (13 反應) (0 負責人)TypeScript (45,361 star) (6,653 fork)batch import
:boom: RegressionHelp Wanted

描述

🐛 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"
    ]

貢獻者指南

jest-haste-map: TypeError: dupMap.get is not a function · jestjs/jest#9021 | Good First Issue