-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
Version
30.0.5
Steps to reproduce
This is a follow up to #15682, since that one is closed.
As far as I understand, an attempt to fix the problem was made in #15694.
Under Node.js 22.18, loading a jest.config.ts
with ESM syntax under CommonJS results in the following error:

And this Node.js warning:
Warning: Failed to load the ES module: C:\Users\edoardo.luppi\IdeaProjects\client-vscode\client-shared\ts\jest.config.ts. Make sure to set "type": "module" in the nearest package.json file or use the .mjs extension
This is the code flow for the code path that was changed in #15694 and #15720.
jest-debug.mp4
Expected behavior
It should load the TS file without erroring out.
Actual behavior
It throws an error.
Can be workarounded by using --no-experimental-strip-types
.
Additional context
No response
Environment
System:
OS: Windows 10 10.0.19045
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Binaries:
Node: 22.18.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
npm: 10.9.3 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.5.0 - ~\AppData\Roaming\npm\pnpm.CMD
npmPackages:
jest: 29.7.0 => 29.7.0
Note that the Jest code I'm debugging is from 30.0.5, even tho I currently have 29.7.0 mentioned in my package.json file.