kulshekhar / ts-jest

A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript.
https://kulshekhar.github.io/ts-jest
MIT License
6.95k stars 451 forks source link

[Bug]: ts-jest[cli] (FATAL) Configuration file jest.config.cjs must be a JavaScript or JSON file. with config.migrate in vite react project #4485

Open Amy-B-Tradition opened 3 months ago

Amy-B-Tradition commented 3 months ago

Version

^29.1.1

Steps to reproduce

I'm in the middle of a Parcel 1 > Vite upgrade. After getting my tests running again, I got the following message: ts-jest[backports] (WARN) Your Jest configuration is outdated. Use the CLI to help migrating it: ts-jest config:migrate <config-file>.

So I entered ts-jest config:migrate jest.config.cjs (File extension change was needed because type: "module" was added to package.json for vite).

Expected behavior

Some sort of upgrade wizard or something?

Actual behavior

ts-jest[cli] (FATAL) Configuration file jest.config.cjs must be a JavaScript or JSON file.

Debug log

None

Additional context

No response

Environment

Need to install the following packages:
envinfo@7.13.0
Ok to proceed? (y)
ahnpnl commented 3 months ago

The CLI migrate command does migration automatically. What kind of wizard would you suggest?

Amy-B-Tradition commented 2 months ago

I would suggest that the migration should happen when the jest.config file has a cjs extension, since you need that with vite and it's a valid extension for a jest.config file.