Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): Update Jest instructions for v27 #31649

Merged
merged 2 commits into from
May 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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