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

docs: add note for Babel config #4197

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ There is a good chance that the error message shows which module is affected:

In this case **some-module** is the problem and needs to be transformed.
By adding the following line to the configuration file it will tell Jest which modules
shouldnt be ignored during the transformation step:
shouldn't be ignored during the transformation step:

```javascript
module.exports = {
Expand All @@ -72,4 +72,6 @@ module.exports = {

**some-module** and **another-module** will be transformed.

Note that if you are using Babel with a `.babelrc` config file, you will need to rename it to `babel.config.json` in order to compile any part of `node_modules`, as described in the [Babel docs](https://babeljs.io/docs/configuration#whats-your-use-case).

For more information see [here](https://stackoverflow.com/questions/63389757/jest-unit-test-syntaxerror-cannot-use-import-statement-outside-a-module) and [here](https://stackoverflow.com/questions/52035066/how-to-write-jest-transformignorepatterns).