Last active
April 14, 2019 02:29
-
-
Save rakannimer/f31c0178243e4f1d402546d41e7d7dcd to your computer and use it in GitHub Desktop.
Adding jest tests to nwb project
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 -D jest babel-jest babel-preset-es2015 babel-preset-react react-test-renderer | |
#Edit package.json adding the jest command : | |
"scripts": { | |
"build": "nwb build-react-component", | |
"clean": "nwb clean-module && npm clean-demo", | |
"start": "nwb serve-react-demo", | |
"test": "nwb test", | |
"test:coverage": "nwb test --coverage", | |
"test:watch": "nwb test --server", | |
"test:jest": "jest" | |
}, | |
# For most setups this should be enough, for tweaking check below | |
# And add jest config ( OPTIONAL ) | |
"jest": { | |
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest", | |
"testFileExtensions": [ | |
"js" | |
], | |
"moduleFileExtensions": [ | |
"js", | |
"json", | |
"jsx" | |
] | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment