yes
yes
react-native-cli: 2.0.1
react-native: 0.48.1
node: v8.4.0
yarn: 0.27.5
Initially created tests should pass.
yarn test
yarn test v0.27.5
$ jest
FAIL __tests__/index.android.js
â—Ź Test suite failed to run
TypeError: Cannot read property 'BLOB_URI_SCHEME' of undefined
at Object.<anonymous> (node_modules/react-native/Libraries/Blob/URL.js:21:21)
at node_modules/react-native/Libraries/Core/InitializeCore.js:174:40
at getValue (node_modules/react-native/Libraries/Utilities/defineLazyObjectProperty.js:44:10)
at ContextifyScript.Script.runInContext (vm.js:53:29)
FAIL __tests__/index.ios.js
â—Ź Test suite failed to run
TypeError: Cannot read property 'BLOB_URI_SCHEME' of undefined
at Object.<anonymous> (node_modules/react-native/Libraries/Blob/URL.js:21:21)
at node_modules/react-native/Libraries/Core/InitializeCore.js:174:40
at getValue (node_modules/react-native/Libraries/Utilities/defineLazyObjectProperty.js:44:10)
at ContextifyScript.Script.runInContext (vm.js:53:29)
Test Suites: 2 failed, 2 total
Tests: 0 total
Snapshots: 0 total
Time: 0.95s
Ran all test suites.
error Command failed with exit code 1.
I dropped back to version 0.47.x and this no longer happens - have you tried that?
@shaundon I just have migrated to the latest version. Tests passed on 0.47.1
Also this issue reproducible on node 8.4.0, but all works fine with node 7.4.0. You can use it how temporary workaround
I have the same tool versions in my stack.
I can confirm the issue :/
I created PR in #15843 to fix this issue.
Thanks to @timwangdev's PR, here are some temp workarounds that don't involve downgrading Node, until a release is cut with @timwangdev's fix.
WORKAROUND 1:
Overwrite ./node_modules/react-native/jest/setup.js with this: https://raw.githubusercontent.com/facebook/react-native/master/jest/setup.js
WORKAROUND 2:
WARNING: Risky! I didn't actually test this.
Install RN #master git branch:
"react-native": "git://github.com/facebook/react-native#master"
Another workaround does not involve change current RN files (I'm using) is:
Add https://github.com/facebook/react-native/blob/master/jest/setup.js#L112-L307 to your own project's jest-setup.js. This one will actually rewrite the mock for whole NativeModules.
You could remove those lines after the fix releases.
For anybody still experiencing this issue, note that it is fixed in 0.48.4. It can be closed now.
@facebook-github-bot close
[email protected] test /home/MyDemo
jest
FAIL __tests__/App.js
â—Ź Test suite failed to run
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
at assertPath (path.js:28:11)
at Object.relative (path.js:1249:5)
FAIL __tests__/App-test.js
â—Ź Test suite failed to run
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
at assertPath (path.js:28:11)
at Object.relative (path.js:1249:5)
Test Suites: 2 failed, 2 total
Tests: 0 total
Snapshots: 0 total
Time: 0.47s
Ran all test suites.
npm ERR! Test failed. See above for more details
tried by various ways but could not found exact solution, even dont know the exact problem.
Most helpful comment
I created PR in #15843 to fix this issue.