diff --git a/CHANGELOG.md b/CHANGELOG.md index 968092a36f5f..bfc4ba2f0516 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - `[jest-config]` Throw correct error for missing preset modules ([#10737](https://github.com/facebook/jest/pull/10737)) - `[jest-resolve-dependencies]` Resolve mocks as dependencies ([#10713](https://github.com/facebook/jest/pull/10713)) - `[jest-runtime]` Handle file URLs in dynamic imports ([#10744](https://github.com/facebook/jest/pull/10744)) +- `[jest-transform]` Link to ESM docs on syntax errors ([#10748](https://github.com/facebook/jest/pull/10748)) ### Chore & Maintenance diff --git a/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts b/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts index 327d27cc405f..1473265b72e2 100644 --- a/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts +++ b/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts @@ -42,6 +42,9 @@ This usually means that you are trying to import a file which Jest cannot parse, By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules". Here's what you can do: +${DOT}If you are trying to use ECMAScript Modules, see ${chalk.underline( + 'https://jestjs.io/docs/en/ecmascript-modules', + )} for how to enable it. ${DOT}To have some of your "node_modules" files transformed, you can specify a custom ${chalk.bold( '"transformIgnorePatterns"', )} in your config.