Babel Integration
If you'd like to use Babel, it can easily be enabled: npm install --save-dev babel-jest babel-polyfill
.
Don't forget to add a .babelrc
file in your project's root folder. For example, if you are using ES6 and React.js with the babel-preset-es2015
and babel-preset-react
presets:
{ "presets": ["es2015", "react"] }
You are now set up to use all ES6 features and React specific syntax.
Note: If you are using a more complicated Babel configuration, using Babel's env
option,
keep in mind that Jest will automatically define NODE_ENV
as test
.
It will not use development
section like Babel does by default when no NODE_ENV
is set.