Jest: Error: Cannot find module '@jest/test-sequencer'

Created on 3 Apr 2019  路  5Comments  路  Source: facebook/jest

馃悰 Bug Report

Getting this fatal error when running Jest with pnpm:

Error: Cannot find module '@jest/test-sequencer'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at /Users/spencerelliott/Dev/path/to/node_modules/.registry.npmjs.org/@jest/core/24.7.0/node_modules/@jest/core/build/runJest.js:290:9
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/spencerelliott/Dev/path/to/node_modules/.registry.npmjs.org/@jest/core/24.7.0/node_modules/@jest/core/build/runJest.js:148:24)
    at _next (/Users/spencerelliott/Dev/path/to/node_modules/.registry.npmjs.org/@jest/core/24.7.0/node_modules/@jest/core/build/runJest.js:168:9)
    at /Users/spencerelliott/Dev/path/to/node_modules/.registry.npmjs.org/@jest/core/24.7.0/node_modules/@jest/core/build/runJest.js:173:7
    at new Promise (<anonymous>)

To Reproduce

Steps to reproduce the behavior:

npm install --global [email protected]
pnpm install jest
./node_modules/.bin/jest

Expected behavior

No fatal error.

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS 10.14.3
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Binaries:
    Node: 10.15.0 - /var/folders/ms/t3l222rn1v3dkvvnytj4vfkw0000gn/T/fnm-shell-1068309/bin/node
    Yarn: 1.13.0 - /usr/local/bin/yarn
    npm: 6.8.0 - /var/folders/ms/t3l222rn1v3dkvvnytj4vfkw0000gn/T/fnm-shell-1068309/bin/npm
  npmPackages:
    jest: ^24.7.0 => 24.7.0
Bug Bug Report

Most helpful comment

^ released

All 5 comments

I guess this will be fixed by #8267

I am running into a similar problem with Jest 24.7.0 (I'm not using pnpm however). The root cause seems to be @jest/test-sequencer being listed in devDependencies of jest-core, and therefore not being installed by tools that only install from 'dependencies'.

Since packages/jest-core/src/runJest.ts will attempt to "require" @jest/test-sequencer (if a custom test-sequencer isn't set), it seems like @jest/test-sequencer needs to be listed as a dependency so it's always installed with jest-core, right?

It's a dep of jest-config, so #8267 will fix it as we'll pass a full, resolved path the @jest/core 馃檪

Releasing fix shortly as 24.7.1

^ released

Was this page helpful?
0 / 5 - 0 ratings