-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find module 'setupDevtools' from 'setup.js' - Platform Windows #3822
Comments
@tobiasMeinhardt Hey, we encountered the same issue with you. Our solution is |
I think that was some dependency that I published either for Jest or Metro that was messed up, now it should be resolved. |
I'm having the same issue:
Did clean node_modules and yarn.lock. |
Still having this issue as well |
Unfortunately i still have this issue. I removed
The test command in my
@cpojer - you said maybe a dependency for jest was messed up. Do i have to install/update a package? The latest version of |
@tobiasMeinhardt can you create a fresh RN project and try to run jest on it. I know it's weird but let try it, if it works then maybe you need to clean your project. |
Thanks for all the help! My project is a library with an To solve my problem i added package.json of my library project:
After that i ran |
i am also having this issue, on mac, tried to clean node_modules, but still see it. |
Was seeing a similar issue on our CI runs:
root issue for us was that |
Running |
Having the same issue!
package.js:
|
@phillbaker Hey I am having the same issue. Can you elaborate the root issue on your case and the solution? Thanks so much |
@peterdev6 we were seeing this issue only on our CI, where we "cache" our Hope it helps. |
I had a newer version of react-native-svg that expected a later version of react native than i'm using, so i re-installed the older version of react-native-svg for the time-being. |
@tobiasMeinhardt You have your test file in |
This issue keeps appearing every now and then |
@SupriyaKalghatgi i have this issue if i add extra options in package.json...
|
@sarovin Thats an expo app of mine
|
In our case, it was related to a custom watchman config. You can check if it's the case for you with |
I've tried all of the above suggestions and I still can't get rid of this error. // test - src/utils/__tests__/foo.test.js
describe('Foo', () => {
it('exists', () => {
expect(true).toBeTruthy()
})
}) // package.json - Jest config
"jest": {
"preset": "react-native",
"roots": ["src"]
} If I remove one of those config options, the test suite runs fine. But if they are both present, I get: ● Test suite failed to run
Cannot find module 'setupDevtools' from 'setup.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:179:17)
at Object.<anonymous> (node_modules/react-native/jest/setup.js:30:1) |
I ran into the same problem today. Was able to solve it with the following jest config within
|
I've had the same issue on macOS. Tried clearing all npm/yarn caches & node_modules, but I would still get the same error. Tried a The only thing that would fix it was a |
Also have the same issue:
Here's my const configure = require('enzyme').configure
const Adapter = require('enzyme-adapter-react-16')
configure({ adapter: new Adapter() }) And here's my "jest": {
"resolver": "jest-webpack-resolver",
"transform": {
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json"
],
"moduleDirectories": [
"node_modules",
"app"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/test/unit/__mocks__/fileMock.js",
"\\.(css)$": "identity-obj-proxy"
},
"snapshotSerializers": [
"enzyme-to-json/serializer"
],
"setupFiles": [
"<rootDir>/test/enzyme_setup"
],
"verbose": true
},
"jestWebpackResolver": {
"webpackConfig": "<rootDir>/webpack/webpack.common.js"
} I also tried with different presets and without presets, none showed any change. |
Strangely I've resolved by doing:
Don't know why but it works now. |
Try running jest with the flag In my case, I started experiencing the |
I had this issue as well on my OSX / Mac platform and found a solution this morning. As it turns out, Babel has documentation which specifically explains how to setup Jest when used together. In summary, here's what I did: Install NPM Modules
or with one command:
Create .babelrc Config File
Modify package.json
Here is some further reading on why the env preset configuration is needed. Happy coding! |
Appears this is still an issue I am facing right now, apparently was happening a while back but a few moments later started with this error... checked several issue/overflow questions tried many suggestion but no attempt succeeded. |
I've had this issue after an update from React Native from 0.55 to 0.56. We're using https://github.com/infinitered/jest-preset-ignite and this PR solved the issue for us: https://github.com/infinitered/jest-preset-ignite/pull/3/files. The diff should also work for non-ignite projects, or at least help you figure out what's needed for the 0.56 migration. |
For anyone going absolutely insane...might be worthwhile to just give this a shot, this is all it took for me.
|
By digging into the
This error will be gone. But another one So it looks like something wrong with loading the modules inside |
I just encountered this error on macOS. I just had to update from react-native 0.55.3 to 0.56 in this commit novasamatech/parity-signer@961dbba |
Several bugfixes were needed, and I managed to get the tests running:
|
I had accidentally added module.exports = {
testEnvironment: "node", // <---- removing this
preset: "react-native"
}; |
RN preset uses node environment so what you did is invalidating Jest cache. You can do so with a command |
My situation: react-native: 0.59.10
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
When i run the tests on a linux maschine everything is fine. When i run the tests with the same configuration on my windows computer the following error is thrown:
Cannot find module 'setupDevtools' from 'setup.js'
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
OS - Windows
package.json
setup-jasmine-env.js
.babelrc
Many thanks for helping!
The text was updated successfully, but these errors were encountered: