diff --git a/CHANGELOG.md b/CHANGELOG.md index e3376f7ee7dd..252bdf4262c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Fixes - `[jest-config]` Treat `setupFilesAfterEnv` like `setupFiles` when normalizing configs against presets ([#9495](https://github.com/facebook/jest/pull/9495)) +- `[jest-config]` Support `.mjs` config files on Windows as well ([#9558](https://github.com/facebook/jest/pull/9558)) - `[jest-matcher-utils]` Fix diff highlight of symbol-keyed object. ([#9499](https://github.com/facebook/jest/pull/9499)) - `[jest-resolve]` Fix module identity preservation with symlinks and browser field resolution ([#9511](https://github.com/facebook/jest/pull/9511)) - `[jest-resolve]` Do not confuse directories with files ([#8912](https://github.com/facebook/jest/pull/8912)) diff --git a/packages/jest-config/src/importMjs.ts b/packages/jest-config/src/importMjs.ts index 693bac33185b..85d82fa10dd2 100644 --- a/packages/jest-config/src/importMjs.ts +++ b/packages/jest-config/src/importMjs.ts @@ -5,7 +5,10 @@ * LICENSE file in the root directory of this source tree. */ +import {pathToFileURL} from 'url'; + // this is in a separate file so that node 8 don't explode with a syntax error. // Remove this file when we drop support for Node 8 export default (specifier: string): Promise<{default: unknown}> => - import(specifier); + // node `import()` supports URL, but TypeScript doesn't know that + import(pathToFileURL(specifier).href);