Skip to content

Commit

Permalink
Add babel config file snippet (#1764)
Browse files Browse the repository at this point in the history
  • Loading branch information
afontcu committed Jan 7, 2021
1 parent db4ab8b commit 08304bc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions docs/installation/using-with-jest.md
Expand Up @@ -52,7 +52,15 @@ Then, you need to tell Jest to transform `.js` files using `babel-jest`. You can
}
```

Then you need to create babel config using [babel.config.json](https://babeljs.io/docs/en/configuration#babelconfigjson), [.babelrc.json](https://babeljs.io/docs/en/configuration#babelrcjson) or `package.json`:
Then you need to create babel config using [babel.config.json](https://babeljs.io/docs/en/configuration#babelconfigjson) or [.babelrc.json](https://babeljs.io/docs/en/configuration#babelrcjson) config files:

```json
{
"presets": ["@babel/preset-env"]
}
```

You can also add these options to `package.json`:

```json
{
Expand All @@ -62,7 +70,7 @@ Then you need to create babel config using [babel.config.json](https://babeljs.i
}
```

### Handling webpack Aliases
### Handling webpack aliases

If you use a resolve alias in the webpack config, e.g. aliasing `@` to `/src`, you need to add a matching config for Jest as well, using the `moduleNameMapper` option:

Expand Down

0 comments on commit 08304bc

Please sign in to comment.