I 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"
}
}
This needs a repro, please provide such.
But I'd bet on case-sensitiveness – make sure your Theme folder is actually seen like this by git, not theme.
I wonder if we should add a .toLowerCase() call in the case of MODULE_NOT_FOUND in jest-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).
@thymikee Checked and it is "Themes" in CircleCI server. Locally it runs on a Mac, and it works properly in both local checkouts. Will try to reproduce in a public repo
@thymikee You are the man! Renaming-comitting-renaming-back fixed the issue!
Thanks a lot!
ps: if you don't mind, send me an email (or give me yours) :)
Most helpful comment
But I'd bet on case-sensitiveness – make sure your
Themefolder is actually seen like this by git, nottheme.