Skip to content

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

Closed
@elado

Description

@elado

πŸ› Bug Report

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 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions