|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
825 bytes
|
| Line | |
|---|
| 1 | # babel-jest
|
|---|
| 2 |
|
|---|
| 3 | [Babel](https://github.com/babel/babel) [jest](https://github.com/facebook/jest) plugin
|
|---|
| 4 |
|
|---|
| 5 | ## Usage
|
|---|
| 6 |
|
|---|
| 7 | If you are already using `jest-cli`, add `babel-jest` and it will automatically compile JavaScript code using Babel.
|
|---|
| 8 |
|
|---|
| 9 | ```bash
|
|---|
| 10 | yarn add --dev babel-jest @babel/core
|
|---|
| 11 | ```
|
|---|
| 12 |
|
|---|
| 13 | If 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 |
|
|---|
| 19 | To explicitly define `babel-jest` as a transformer for your JavaScript code, map _.js_ files to the `babel-jest` module. Typescript files are also supported.
|
|---|
| 20 |
|
|---|
| 21 | ```json
|
|---|
| 22 | "transform": {
|
|---|
| 23 | "\\.[jt]sx?$": "babel-jest"
|
|---|
| 24 | },
|
|---|
| 25 | ```
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.