Do you want to request a _feature_ or report a _bug_?
Bug
What is the current behavior?
Test suite failed to run
Invariant Violation: Module name prefixes should've been stripped by the native side but wasn't for RCTStatusBarManager
at invariant (node_modules/fbjs/lib/invariant.js:38:15)
at genModule (node_modules/react-native/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js:35:1)
at node_modules/react-native/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js:125:10
at Array.forEach (native)
at Object.<anonymous> (node_modules/react-native/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js:122:39)
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can npm install
and npm test
.
npm install jest babel-jest jest-react-native
jest --no-cache --coverage
"jest": {
"preset": "jest-react-native"
},
What is the expected behavior?
it should actually test
Run Jest again with --debug
and provide the full configuration it prints. Please mention your node and npm version and operating system.
> jest --no-cache --coverage --debug
jest version = 16.0.1
test framework = jasmine2
config = {
"haste": {
"defaultPlatform": "ios",
"platforms": [
"android",
"ios"
],
"providesModuleNodeModules": [
"react",
"react-native"
]
},
"moduleNameMapper": [
[
"^image![a-zA-Z0-9$_-]+$",
"GlobalImageStub"
],
[
"^[./a-zA-Z0-9$_-]+\\.(bmp|gif|jpg|jpeg|png|psd|svg|webp)$",
"RelativeImageStub"
]
],
"modulePathIgnorePatterns": [
"/Users/chirag/Desktop/qsi/comlink/node_modules/react-native/Libraries/react-native/",
"/Users/chirag/Desktop/qsi/comlink/node_modules/react-native/packager/"
],
"preprocessorIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element)"
],
"setupFiles": [
"/Users/chirag/Desktop/qsi/comlink/node_modules/babel-polyfill/lib/index.js",
"/Users/chirag/Desktop/qsi/comlink/node_modules/jest-react-native/build/setup.js"
],
"testEnvironment": "/Users/chirag/Desktop/qsi/comlink/node_modules/jest-environment-node/build/index.js",
"preset": "jest-react-native",
"rootDir": "/Users/chirag/Desktop/qsi/comlink",
"name": "-Users-chirag-Desktop-qsi-comlink",
"testRunner": "/Users/chirag/Desktop/qsi/comlink/node_modules/jest-jasmine2/build/index.js",
"scriptPreprocessor": "/Users/chirag/Desktop/qsi/comlink/node_modules/babel-jest/build/index.js",
"usesBabelJest": true,
"automock": false,
"bail": false,
"browser": false,
"cacheDirectory": "/var/folders/6j/rqjprs4n687cstlp6rxgnlk40000gn/T/jest",
"clearMocks": false,
"coveragePathIgnorePatterns": [
"/node_modules/"
],
"coverageReporters": [
"json",
"text",
"lcov",
"clover"
],
"globals": {},
"mocksPattern": "__mocks__",
"moduleDirectories": [
"node_modules"
],
"moduleFileExtensions": [
"js",
"json",
"jsx",
"node"
],
"noStackTrace": false,
"notify": false,
"resetModules": false,
"testPathDirs": [
"/Users/chirag/Desktop/qsi/comlink"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.jsx?$",
"testURL": "about:blank",
"timers": "real",
"useStderr": false,
"verbose": null,
"watch": false,
"collectCoverage": true,
"cache": false,
"watchman": true,
"testcheckOptions": {
"times": 100,
"maxSize": 200
}
}
node v6.4.0
npm v3.10.3
using RN master branch as of today. cc @cpojer
The error is caused due to this change in RN. It now expects the mock to not have the RCT
prefix anymore
This bug happens also with current version 16.0.2 on a newly created test application.
react-native init testApp
cd testApp
jest
$ cat package.json
{
"name": "********",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "15.3.2",
"react-native": "0.36.0"
},
"jest": {
"preset": "jest-react-native"
},
"devDependencies": {
"babel-jest": "16.0.0",
"babel-preset-react-native": "1.9.0",
"jest": "16.0.2",
"jest-react-native": "16.0.0",
"react-test-renderer": "15.3.2"
}
}
try jest-react-native@test
and jest@test
. We'll publish a new tagged release soon.
I'm still having this issue after updating versions.
"react": "15.3.2",
"react-native": "^0.36.1",
jest": "^16.0.2",
"jest-react-native": "^16.0.0",
Last release was 13 days ago, is there a workaround other than using an earlier version of react?
@cpojer
We'll publish a new tagged release soon.
Yes update to jest-react-native@test
and jest@test
@edvinerikson cheers lack of understanding on my side sorry re cpojer's comment
@edvinerikson ,how to "update to jest-react-native@test and jest@test", my package.json is
"devDependencies": {
"babel-jest": "16.0.0",
"babel-preset-react-native": "1.9.0",
"jest": "16.0.2",
"jest-react-native": "16.1.0",
"react-test-renderer": "15.3.2"
}
@tigerohuang just change the version to test
like so:
"jest-react-native": "test",
The latest version of jest-react-native should work just fine. Simply install the 16.1.0 version of it.
I still meet "ExceptionsManager.js:62Module name prefixes should've been stripped by the native side but wasn't for RCTStatusBarManager" when I use newest version or test
"jest": "test",
"jest-react-native": "test",
need I "react-native init " a new project?
@tigerohuang I did an npm uninstall on both (npm uninstall --save jest-react-native & npm uninstall --save jest) then npm install --save again without the @test
I'm still having problems (with jest util) but am raising a new issue to this regard
@Scott-Allen ,I removed whole directory node_modules and npm install, it is same as uninstall and install --save
Looks like the issue still persist.. Can you please help ?
jest
FAIL tests\index.android.js
● Test suite failed to run
Invariant Violation: Module name prefixes should've been stripped by the native side but wasn't for RCTStatusBarManager
at invariant (node_modules\fbjs\lib\invariant.js:38:15)
at genModule (node_modules\react-native\Libraries\BatchedBridge\BatchedBridgedModules\NativeModules.js:35:1)
at node_modules\react-native\Libraries\BatchedBridge\BatchedBridgedModules\NativeModules.js:125:10
at Array.forEach (native)
at Object.<anonymous> (node_modules\react-native\Libraries\BatchedBridge\BatchedBridgedModules\NativeModules.js:122:39)
===============package.json============
{
"name": "MySampleConfig",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "15.3.2",
"react-native": "0.36.1",
"react-native-config": "^0.1.0"
},
"jest": {
"preset": "jest-react-native"
},
"devDependencies": {
"babel-jest": "^16.0.0",
"babel-preset-react-native": "^1.9.0",
"jest": "test",
"jest-react-native": "test",
"react-test-renderer": "^15.3.2"
}
}
@pugaldp : ISSUE RESOLVED:
I did an npm uninstall on both (npm uninstall --save jest-react-native & npm uninstall --save jest) then,
npm install --save-dev jest babel-jest jest-react-native babel-preset-react-native react-test-renderer
Trying to upgrade project with following package.json
. With "jest-react-native": "16.0.0"
I get Invariant Violation: Module name prefixes should've been stripped by the native side but wasn't for RCTStatusBarManager
.
If I upgrade to "jest-react-native": "16.1.0
per @cpojer above, (specifically rm -rf node_modules
& npm install
& npm test
I then get
~/projects/snowflakework/snowflake-pr184 (siemiatj-master)$ npm test
> [email protected] test /Users/barton/projects/snowflakework/snowflake-pr184
> npm run lint-validate && jest -u
> [email protected] lint-validate /Users/barton/projects/snowflakework/snowflake-pr184
> eslint . --ignore-path .gitignore --quiet
/Users/barton/projects/snowflakework/snowflake-pr184/coverage/lcov-report/prettify.js
1:34 error Infix operators must be spaced space-infix-ops
1:39 error Missing whitespace after semicolon semi-spacing
1:49 error Missing space before function parentheses space-before-function-paren
.....
155:6 error Extra semicolon semi
156:5 error Extra semicolon semi
158:44 error Extra semicolon semi
✖ 2556 problems (2556 errors, 0 warnings)
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "lint-validate"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] lint-validate: `eslint . --ignore-path .gitignore --quiet`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] lint-validate script 'eslint . --ignore-path .gitignore --quiet'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the snowflake package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! eslint . --ignore-path .gitignore --quiet
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs snowflake
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls snowflake
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/barton/projects/snowflakework/snowflake-pr184/npm-debug.log
npm ERR! Test failed. See above for more details.
~/projects/snowflakework/snowflake-pr184 (siemiatj-master)$ node --version
v6.9.1
~/projects/snowflakework/snowflake-pr184 (siemiatj-master)$ npm --version
3.10.8
~/projects/snowflakework/snowflake-pr184 (siemiatj-master)$
The package.json
follows:
{
"name": "snowflake",
"version": "0.2.0",
"private": true,
"jest": {
"preset": "jest-react-native",
"moduleNameMapper": {
"\\./datepicker$": "<rootDir>/node_modules/tcomb-form-native/lib/templates/bootstrap/datepicker.ios.js",
"\\./select$": "<rootDir>/node_modules/tcomb-form-native/lib/templates/bootstrap/select.ios.js"
},
"preprocessorIgnorePatterns": [
"node_modules/(?!react-native|tcomb-form-native|apsl-react-native-button)"
],
"collectCoverage": false,
"verbose": true
},
"scripts": {
"lint": "eslint . --fix --ignore-path .gitignore --format=node_modules/eslint-formatter-pretty",
"lint-validate": "eslint . --ignore-path .gitignore --quiet",
"test": "npm run lint-validate && jest -u",
"start": "react-native start",
"test:watch": "npm run test -- --watch",
"test-chrome": "node-debug --preload false --nodejs --harmony jest --runInBand",
"docs": "./node_modules/docker/docker -w -i src/ -o ../snowflake-pages "
},
"dependencies": {
"apsl-react-native-button": "3.0.2",
"immutable": "3.8.1",
"key-mirror": "1.0.1",
"parse": "1.8.5",
"react": "15.4.2",
"react-mixin": "3.0.5",
"react-native": "0.41.2",
"react-native-i18n": "1.0.0",
"react-native-navbar": "1.6.0",
"react-native-router-flux": "3.37.0",
"react-native-simple-store": "1.1.0",
"react-native-simpledialog-android": "1.0.8",
"react-native-vector-icons": "4.0.0",
"react-redux": "5.0.2",
"react-timer-mixin": "0.13.3",
"redux": "3.6.0",
"redux-thunk": "2.2.0",
"regenerator": "0.8.46",
"tcomb-form-native": "0.6.5",
"undefined": "0.1.0",
"underscore": "1.8.3",
"validate.js": "0.10.0"
},
"devDependencies": {
"babel-core": "6.17.0",
"babel-eslint": "7.0.0",
"babel-jest": "16.0.0",
"babel-preset-react-native": "1.9.0",
"docker": "1.0.0",
"eslint": "3.8.1",
"eslint-config-standard": "6.2.0",
"eslint-formatter-pretty": "1.1.0",
"eslint-plugin-flowtype-errors": "1.4.1",
"eslint-plugin-promise": "3.3.0",
"eslint-plugin-react": "6.9.0",
"eslint-plugin-standard": "2.0.1",
"istanbul": "0.4.5",
"jest": "16.0.1",
"jest-react-native": "16.1.0",
"react-addons-test-utils": "15.4.2",
"redux-mock-store": "1.2.1"
}
}
jest-react-native is outdated. Simply use react-native
as a preset.
Thanks @cpojer - that worked
I am not using jest still got this error; can anyone help me to resolve the above problem ?
Most helpful comment
try
jest-react-native@test
andjest@test
. We'll publish a new tagged release soon.