Last active
September 10, 2017 13:24
-
-
Save danialkalbasi/3719bb7b02db35cc50b91f239e74de5a to your computer and use it in GitHub Desktop.
React Native Unit Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn add jest-expo --dev or npm i jest-expo --save-dev | |
npm install sinon --save-dev | |
npm install lodash --save-dev | |
npm install react-dom --save-dev | |
npm install react-test-renderer --save-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install babel-jest --save-dev | |
npm install babel-preset-es2015 --save-dev | |
npm install babel-preset-react-native-stage-0 --save-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
... | |
"jest": { | |
"preset": "jest-expo", | |
"collectCoverageFrom": [ | |
"(/__tests__/.*|(\\.|/)(test|spec))\\.js?$", | |
"!**/node_modules/**" | |
], | |
"transform": { | |
"^.+\\.js$": "<rootDir>/setup.js" | |
}, | |
"testPathIgnorePatterns": [ | |
"/node_modules/" | |
] | |
}, | |
.... | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = require('babel-jest').createTransformer({ | |
presets: [ | |
"es2015", | |
"react-native-stage-0" | |
] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment