Skip to content

Commit

Permalink
chore(docs): Update Jest instructions for v27 (#31649)
Browse files Browse the repository at this point in the history
Co-authored-by: Lennart <lekoarts@gmail.com>
  • Loading branch information
sj-rai and LekoArts authored May 31, 2021
1 parent a4589d0 commit eb6f73b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/docs/how-to/testing/unit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eb6f73b

Please sign in to comment.