You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create an npm project that has "type": "module" in its package.json
Install jest, typescript, and ts-jest
Run config:init script to generate jest.config.js
Run jest
yarn create vite --template vanilla-ts esm-config-ts-jest
cd esm-config-ts-jest
yarn add jest @types/jest ts-jest
yarn ts-jest config:init
yarn jest
Expected behavior
Jest reads the config file and runs normally if tests found.
Actual behavior
Jest can't read the config file because: ReferenceError: module is not defined in ES module scope
Debug log
n/a
Additional context
It's not the biggest bug, and can easily be fixed manually, by changing the generated jest.config.js to ESM. But it would be nice if it just worked out of the box.
It should be a simple fix in the cli/config/init.ts script, I can make a PR if it's okay.
Version
29.0.5
Steps to reproduce
"type": "module"
in itspackage.json
jest
,typescript
, andts-jest
config:init
script to generatejest.config.js
jest
Expected behavior
Jest reads the config file and runs normally if tests found.
Actual behavior
Jest can't read the config file because:
ReferenceError: module is not defined in ES module scope
Debug log
n/a
Additional context
It's not the biggest bug, and can easily be fixed manually, by changing the generated
jest.config.js
to ESM. But it would be nice if it just worked out of the box.It should be a simple fix in the
cli/config/init.ts
script, I can make a PR if it's okay.Environment
The text was updated successfully, but these errors were encountered: