UNPKG

793 BMarkdownView Raw
1# babel-jest
2
3[Babel](https://github.com/babel/babel) [jest](https://github.com/facebook/jest) plugin
4
5## Usage
6
7If you are already using `jest-cli`, just add `babel-jest` and it will automatically compile JavaScript code using Babel.
8
9```bash
10yarn add --dev babel-jest @babel/core
11```
12
13If you would like to write your own preprocessor, uninstall and delete babel-jest and set the [config.transform](https://jestjs.io/docs/configuration#transform-object-string-string) option to your preprocessor.
14
15## Setup
16
17_Note: this step is only required if you are using `babel-jest` with additional code preprocessors._
18
19To explicitly define `babel-jest` as a transformer for your JavaScript code, map _.js_ files to the `babel-jest` module.
20
21```json
22"transform": {
23 "^.+\\.jsx?$": "babel-jest"
24},
25```