-
Notifications
You must be signed in to change notification settings - Fork 468
Closed
Labels
🚀 Feature Requestnew suggested featurenew suggested feature
Description
Version
29.0.5
Steps to reproduce
- Create an npm project that has
"type": "module"
in itspackage.json
- Install
jest
,typescript
, andts-jest
- Run
config:init
script to generatejest.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.
Environment
System:
OS: Linux 4.4 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (12) x64 AMD Ryzen 5 5600H with Radeon Graphics
Binaries:
Node: 19.2.0 - ~/.nvm/versions/node/v19.2.0/bin/node
Yarn: 3.4.1 - ~/.nvm/versions/node/v19.2.0/bin/yarn
npm: 8.19.3 - ~/.nvm/versions/node/v19.2.0/bin/npm
npmPackages:
jest: ^29.4.1 => 29.4.1
Metadata
Metadata
Assignees
Labels
🚀 Feature Requestnew suggested featurenew suggested feature