jestjs / jest

Delightful JavaScript Testing.
https://jestjs.io
MIT License
44.22k stars 6.46k forks source link

[Feature]: Support loading jest.config.ts as ESM #13118

Open luxaritas opened 2 years ago

luxaritas commented 2 years ago

🚀 Feature Proposal

Motivation

Example

No response

Pitch

luxaritas commented 2 years ago

Related: #11453

SimenB commented 2 years ago

PR welcome! Logic for config file resolution and reading is in https://github.com/facebook/jest/blob/1919ef13df544a968bd2d32e5d7b8a2a1c4b35d1/packages/jest-config/src/readConfigFileAndSetRootDir.ts

SimenB commented 2 years ago

That said, I don't think anything has changed since https://github.com/facebook/jest/issues/11453#issuecomment-1040424443 (i.e. you need a loader). But we should at least find cts as that is supposed to be converted to cjs

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

karlhorky commented 1 year ago

@SimenB as a first step, maybe let's get support for jest.config.cts, to avoid the extra ts-node.moduleTypes config for ts-node

Took a quick shot at a PR - does it need anything else? (other than fixing the tests)

Edit: @DerTimonius opened a new PR based on mine, which also fixes the tests:

SimenB commented 8 months ago

https://github.com/jestjs/jest/releases/tag/v30.0.0-alpha.3 for .cts support