I am trying to set up a React-Native
project with lerna
. When I try to run jest
I face the following error.
The name `setupDevtools` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or packages, that provide a module for that particular name and platform. The platform is generic (no extension). You must delete or blacklist files until there remains only one of these:
* `/Users/kevin.amiranoff/project/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
* `/Users/kevin.amiranoff/project/packages/App/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
* `/Users/kevin.amiranoff/project/packages/App-exceptions/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
* `/Users/kevin.amiranoff/project/packages/App-signin/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
* `/Users/kevin.amiranoff/project/packages/App-ui/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
* `/Users/kevin.amiranoff/project/packages/App-utils/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
Here is my jest
config in my root package.json
"jest": {
"preset": "react-native",
"globals": {
"__DEV__": true
},
"testRegex": "packages/(.*)/src/(.*)/__tests__/(.*).js?$",
"transformIgnorePatterns": [
"packages/(.*)/node_modules/?!(react|react-native)"
],
"testEnvironment": "node"
}
Can anyone explain to me what do I have to ignore and how?
You should use the modulePathIgnorePatterns
to ignore certain directories.
Make sure that only the one you really want to use is not in this ignore list.
Link to documentation: https://facebook.github.io/jest/docs/en/configuration.html#modulepathignorepatterns-array-string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With