The testing section of the docs for React Native suggest that Jest is the official way to do unit tests. However, they don\'t explain how to get it setup. Running Jest witho
I got Jest to work for my React Native application, and it is running tests without any problem on files with ES6 and ES7 transforms.
To get Jest to work, I followed these steps:
Copied the jestSupport folder from the React Native master repo to my react-native
folder in node_modules
.
Edited the "jest" line in my packages.json
to points to the files in the jestSupport
folder
The "jest" line in my packages.json
now looks lke this:
"jest": {
"scriptPreprocessor": "/node_modules/react-native/jestSupport/scriptPreprocess.js",
"setupEnvScriptFile": "/node_modules/react-native/jestSupport/env.js",
"testFileExtensions": [
"js"
],
"unmockedModulePathPatterns": [
"source-map"
]
},