From eb6f73b6a3bc6191b4587af996029a1a1c5143d2 Mon Sep 17 00:00:00 2001 From: Sanjoth Rai <36308078+sj-rai@users.noreply.github.com> Date: Mon, 31 May 2021 17:17:48 +0530 Subject: [PATCH] chore(docs): Update Jest instructions for v27 (#31649) Co-authored-by: Lennart --- docs/docs/how-to/testing/unit-testing.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/docs/how-to/testing/unit-testing.md b/docs/docs/how-to/testing/unit-testing.md index 07e37104d43f4..52cc8400388c7 100644 --- a/docs/docs/how-to/testing/unit-testing.md +++ b/docs/docs/how-to/testing/unit-testing.md @@ -65,9 +65,12 @@ const babelOptions = { presets: ["babel-preset-gatsby"], } -module.exports = require("babel-jest").createTransformer(babelOptions) +module.exports = require("babel-jest").default.createTransformer(babelOptions) ``` +> **Note:** If you're using Jest 26.6.3 or below, the last line has to be changed to +> `module.exports = require("babel-jest").createTransformer(babelOptions)` + - The next option is `moduleNameMapper`. This section works a bit like webpack rules and tells Jest how to handle imports. You are mainly concerned here with mocking static file imports, which Jest can't