Skip to content

Instantly share code, notes, and snippets.

@devhero
Last active June 15, 2018 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devhero/7eebbb6e228bd53d78c4238d07d13b29 to your computer and use it in GitHub Desktop.
Save devhero/7eebbb6e228bd53d78c4238d07d13b29 to your computer and use it in GitHub Desktop.
jest webpack babel
// 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