From 0300ba6bbe5dd8974edeec56f77a77aed6623063 Mon Sep 17 00:00:00 2001 From: aesyondu <57334943+aesyondu@users.noreply.github.com> Date: Mon, 9 Nov 2020 09:14:24 +0800 Subject: [PATCH] docs(jest): clarify babel configuration I copy pasted the original snippet to my `babel.config.json`. ```json { "babel": { "presets": ["@babel/preset-env"] } } ``` I was wondering why I was getting a weird error: `Unknown option: .babel. Check out https://babeljs.io/docs/en/babel-core/#options for more information abou t options.` I spent 10 minutes googling `.babel`, until I realized that I'm an idiot and the snippet was only applicable to `package.json`. As someone not yet intimately familiar with babel, I'm hoping this change would help clarify the distinction between `package.json` and `babel.config.json`. --- docs/installation/using-with-jest.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/installation/using-with-jest.md b/docs/installation/using-with-jest.md index 66cf58025..a70de50bf 100644 --- a/docs/installation/using-with-jest.md +++ b/docs/installation/using-with-jest.md @@ -54,6 +54,14 @@ 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`: +`babel.config.json or .bablrc.json` +```json +{ + "presets": ["@babel/preset-env"] +} +``` + +`package.json` ```json { "babel": {