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.

"Module * in the testRunner option was not found" when using "resolver": "browser-resolve"

See original GitHub issue

🐛 Bug Report

jest@26.1.0
browser-resolve@1.11.3

When setting "resolver": "browser-resolve", option, jest shows the following error:

● Validation Error:

  Module <PATH>/node_modules/jest-jasmine2/build/index.js in the testRunner option was not found.
         <rootDir> is: <PATH>

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html

<PATH>/node_modules/jest-jasmine2/build/index.js does exist.

To Reproduce

package.json:

{
  "dependencies": {
    "browser-resolve": "^1.11.3",
    "jest": "^26.1.0"
  },
  "jest": {
    "resolver": "browser-resolve"
  }
}

test.test.js:

test("x", () => {});
yarn jest

Tried also installing jest-circus and adding:

"testRunner": "jest-circus/runner"

and I’m getting

Module jest-circus/runner in the testRunner option was not found.

I guess it’s related to recent deprecation of browser: https://github.com/facebook/jest/pull/9943/files

When I use the deprecated browser field, I’m getting a deprecation warning, but tests pass:

● Deprecation Warning:

  Option "browser" has been deprecated. Please install "browser-resolve" and use the "resolver" option in Jest configuration as follows:
  {
    "resolver": "browser-resolve"
  }
  

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html

Expected behavior

No errors.

Link to repl or repo (highly encouraged)

REPL: https://repl.it/repls/HumongousSpottedMp3

yarn jest

envinfo

npx: installed 1 in 1.274s

  System:
    OS: macOS 10.15.5
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Binaries:
    Node: 10.19.0 - /var/folders/97/d27nhr893s91_1shcp7x_qsh0000gp/T/fnm-shell-882191/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.6 - /var/folders/97/d27nhr893s91_1shcp7x_qsh0000gp/T/fnm-shell-882191/bin/npm
  npmPackages:
    jest: ^26.1.0 => 26.1.0 

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12

github_iconTop GitHub Comments

34reactions
timgivoiscommented, Nov 12, 2020

I found that somehow, the testRunner path on my package.json was hardcoded with an absolut path (/Users/timgivois.....). I had to change it to

"testRunner": "<rootDir>/node_modules/jest-circus/runner.js",

And I had to install jest-circus, just like Sean said:

yarn add --dev jest-circus
27reactions
andsalvescommented, Aug 4, 2020

+1 Getting exactly the same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module jest-circus/runner in the testRunner option was not ...
Module jest-circus/runner in the testRunner option was not found. do this: npm i -dev jest-circus.
Read more >
Configuring Jest
This option tells Jest that all imported modules in your tests should ... If the file specified by path is not found, an...
Read more >
jest-jasmine2 | Yarn - Package Manager
Refactored TestRunner into SearchSource and improved the "no tests found" message. Added jest.isMockFunction(jest.fn()) to test for mock functions. Improved ...
Read more >
Jest configuration setupFilesAfterEnv option was not found
config.js ○ Validation Error: Module <rootDir>/jest/setup.js in the setupFilesAfterEnv option was not found. <rootDir> is: /Users ...
Read more >
Jest: website/blog/2020-05-05-jest-26.md | Fossies
We are now beginning to address this shortcoming and are working on ... Migration: Install browser-resolve module and use the following configuration:.
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