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