[email protected]
[email protected]
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.
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
No errors.
REPL: https://repl.it/repls/HumongousSpottedMp3
yarn jest
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
+1 Getting exactly the same issue.
I ran npm install jest-circus --save-dev
, it's not installed by default.
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
Did anyone solve it without installing jest-circus
?
Try to remove node_modules
and package-lock.json
then run npm install
or yarn
<< This solution worked for me
Most helpful comment
+1 Getting exactly the same issue.