0.2.1 • Published 9 years ago
react-native-babel-jest v0.2.1
react-native-babel-jest
Simple testing configuration for React Native with Jest
Installation
npm i --save-dev react-native-babel-jest jest-cliUsage
Add configuration to package.json file
{
"scripts": {
"test": "jest"
},
...
"jest": {
"scriptPreprocessor": "<rootDir>/node_modules/react-native-babel-jest",
"setupFiles": [
"<rootDir>/node_modules/react-native-babel-jest/env.js"
],
"automock": true,
"unmockedModulePathPatterns": [
"react",
"enzyme",
"promise",
"source-map"
]
}
}Write your test in __tests__ folder, run test command
npm testRecommendation
We recommend you using enzyme to render components, and enzyme-to-json to make snapshot testing. See more in the example below.