Problems resolving modules ( Cannot find module '../../Themes' from 'RoundButton.js' )
See original GitHub issueI wrote the tests and it works almost 100%. But, when I run the very same tests in Circle CI environment, it gives the error mentioned.
Follows some output info:
#!/bin/bash -eo pipefail
yarn test
yarn run v1.3.2
$ jest --coverage
FAIL __tests__/Components/Shared/RoundButton.js
● Test suite failed to run
Cannot find module '../../Themes' from 'RoundButton.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:191:17)
at Object.<anonymous> (src/Components/Shared/RoundButton.js:12:13)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 2.514s
Ran all test suites.
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | Unknown | Unknown | Unknown | Unknown | |
----------|----------|----------|----------|----------|-------------------|
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 1
.babelrc
{
"presets": ["react-native"],
"plugins": ["transform-decorators-legacy"]
}
.eslintrc
{
"env": {
"jest/globals": true
},
"parser": "babel-eslint",
"plugins": ["jest"],
"extends": [
"standard",
"standard-react",
"plugin:jest/recommended"
],
"rules": {
"react/prop-types": 1
}
}
Package.json
{
"version": "0.0.8",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "yarn lint || jest",
"storybooking": "start -p 7007",
"lint": "./node_modules/eslint/bin/eslint.js ./src/**/*.js -f node_modules/eslint-formatter-summary"
},
"dependencies": {
"invariant": "^2.2.2",
"mobx": "^3.4.1",
"mobx-persist": "^0.4.1",
"mobx-react": "^4.3.5",
"mobx-remotedev": "^0.2.8",
"moment": "^2.20.1",
"qs": "^6.5.1",
"react": "16.0.0",
"react-native": "0.51.0",
"react-native-collapse-view": "^1.0.0",
"react-native-config": "^0.11.2",
"react-native-fbsdk": "^0.7.0",
"react-native-firebase": "3.2.5",
"react-native-gesture-handler": "^1.0.0-alpha.41",
"react-native-linear-gradient": "^2.4.0",
"react-native-modal-datetime-picker": "^4.13.0",
"react-native-picker-dropdown": "^0.1.1",
"react-native-tab-view": "^0.0.74",
"react-navigation": "1.0.0-beta.21",
"react-timeout": "^1.0.1",
"sort-by": "^1.2.0"
},
"devDependencies": {
"@storybook/addon-actions": "^3.3.3",
"@storybook/addon-links": "^3.3.3",
"@storybook/react-native": "^3.3.3",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-jest": "^22.4.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"eslint": "^4.18.1",
"eslint-config-standard": "^11.0.0",
"eslint-config-standard-react": "^6.0.0",
"eslint-formatter-summary": "^1.0.2",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jest": "^21.12.2",
"eslint-plugin-node": "^6.0.0",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-standard": "^3.0.1",
"firebase-mock": "^2.0.25",
"jest": "^22.4.2",
"prop-types": "^15.6.0",
"react-dom": "16.0.0",
"react-test-renderer": "16.0.0"
},
"jest": {
"preset": "react-native",
"collectCoverage": true,
"collectCoverageFrom": [
"src/**/*.js"
]
},
"rnpm": {
"assets": [
"./src/Assets/Fonts/"
]
},
"standard": {
"plugins": [
"flowtype"
],
"parser": "babel-eslint"
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
Build Environment - CircleCI Discuss
Cannot find module '../../Themes' from 'RoundButton.js' - Working OK locally ... resolveModule (node_modules/jest-resolve/build/index.js:191:17) at Object.
Read more >ReactJS test files issue 'cannot find module' because of ...
Tes passed everything is looks fine. But we still have the path problem in test files. Lets try to import another component in...
Read more >jest mock cannot find module - You.com | The AI Search ...
How do I resolve Jest Mock error "Cannot find module" ... Test suite failed to run Cannot find module '../../Themes' from 'RoundButton.js' at...
Read more >module-not-found - Next.js
The module you're trying to import uses Node.js specific modules, for example dns , outside of getStaticProps / getStaticPaths / getServerSideProps. Possible ...
Read more >Npm install not working. Cannot find module npm-cli.js
I'm getting the following error Error: Cannot find module 'C:\Program ... Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
But I’d bet on case-sensitiveness – make sure your
Theme
folder is actually seen like this by git, nottheme
.I wonder if we should add a
.toLowerCase()
call in the case ofMODULE_NOT_FOUND
injest-resolve
so we can throw an explicit “you messed up the casing”. Extra points for warning also on mac/windows with case insensitive FS-es when the import is cased wronlgy, but that might be going into linting territory (eslint-plugin-import).