If you are already using jest-cli
, just add babel-jest
and it will automatically compile JavaScript code using babel.
npm install --save babel-jest
If you would like to write your own preprocessor, uninstall and delete babel-jest and set the config.scriptPreprocessor option to your preprocessor.