Last active
June 15, 2018 08:49
-
-
Save devhero/7eebbb6e228bd53d78c4238d07d13b29 to your computer and use it in GitHub Desktop.
jest webpack babel
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
// https://redux.js.org/recipes/writing-tests | |
// https://facebook.github.io/jest/docs/en/webpack.html | |
npm i -D jest babel-jest transform-es2015-modules-commonjs | |
// package.json | |
{ | |
... | |
"jest": { | |
"verbose": true, | |
"transform": { | |
"^.+\\.jsx?$": "babel-jest" | |
}, | |
"modulePaths": ["<rootDir>/src/"] | |
}, | |
"scripts": { | |
... | |
"test": "jest", | |
"test:watch": "npm test -- --watch" | |
}, | |
} | |
// .babelrc | |
{ | |
... | |
"presets": [["env", {"modules": false}]], | |
"env": { | |
"test": { | |
"plugins": [ | |
"transform-es2015-modules-commonjs" | |
]} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment