Skip to content

Conversation

phryneas
Copy link
Contributor

Summary

This would fix #15682 where ESM in a .ts config file in a type: "commonjs" would error.

This has some alternatives:

  • what this PR does
  • going further than this PR and retrying to run loadTSConfigFile after any error, without rethrowing (this would change error messages for some of the other tests with invalid syntax)
  • not solving this and instead encourage people to rename their jest.config.ts to jest.config.mts, which should even work in a CommonJS project without any code changes on jest's side

Please make a call here - I don't have a strong opinion either way :)

Test plan

I added a test.

Copy link

netlify bot commented Jun 23, 2025

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 55f554e
🔍 Latest deploy log https://app.netlify.com/projects/jestjs/deploys/685b4d908340a50008671597
😎 Deploy Preview https://deploy-preview-15694--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

pkg-pr-new bot commented Jun 23, 2025

Open in StackBlitz

babel-jest

npm i https://pkg.pr.new/babel-jest@15694

babel-plugin-jest-hoist

npm i https://pkg.pr.new/babel-plugin-jest-hoist@15694

babel-preset-jest

npm i https://pkg.pr.new/babel-preset-jest@15694

create-jest

npm i https://pkg.pr.new/create-jest@15694

@jest/diff-sequences

npm i https://pkg.pr.new/@jest/diff-sequences@15694

expect

npm i https://pkg.pr.new/expect@15694

@jest/expect-utils

npm i https://pkg.pr.new/@jest/expect-utils@15694

jest

npm i https://pkg.pr.new/jest@15694

jest-changed-files

npm i https://pkg.pr.new/jest-changed-files@15694

jest-circus

npm i https://pkg.pr.new/jest-circus@15694

jest-cli

npm i https://pkg.pr.new/jest-cli@15694

jest-config

npm i https://pkg.pr.new/jest-config@15694

@jest/console

npm i https://pkg.pr.new/@jest/console@15694

@jest/core

npm i https://pkg.pr.new/@jest/core@15694

@jest/create-cache-key-function

npm i https://pkg.pr.new/@jest/create-cache-key-function@15694

jest-diff

npm i https://pkg.pr.new/jest-diff@15694

jest-docblock

npm i https://pkg.pr.new/jest-docblock@15694

jest-each

npm i https://pkg.pr.new/jest-each@15694

@jest/environment

npm i https://pkg.pr.new/@jest/environment@15694

jest-environment-jsdom

npm i https://pkg.pr.new/jest-environment-jsdom@15694

@jest/environment-jsdom-abstract

npm i https://pkg.pr.new/@jest/environment-jsdom-abstract@15694

jest-environment-node

npm i https://pkg.pr.new/jest-environment-node@15694

@jest/expect

npm i https://pkg.pr.new/@jest/expect@15694

@jest/fake-timers

npm i https://pkg.pr.new/@jest/fake-timers@15694

@jest/get-type

npm i https://pkg.pr.new/@jest/get-type@15694

@jest/globals

npm i https://pkg.pr.new/@jest/globals@15694

jest-haste-map

npm i https://pkg.pr.new/jest-haste-map@15694

jest-jasmine2

npm i https://pkg.pr.new/jest-jasmine2@15694

jest-leak-detector

npm i https://pkg.pr.new/jest-leak-detector@15694

jest-matcher-utils

npm i https://pkg.pr.new/jest-matcher-utils@15694

jest-message-util

npm i https://pkg.pr.new/jest-message-util@15694

jest-mock

npm i https://pkg.pr.new/jest-mock@15694

@jest/pattern

npm i https://pkg.pr.new/@jest/pattern@15694

jest-phabricator

npm i https://pkg.pr.new/jest-phabricator@15694

jest-regex-util

npm i https://pkg.pr.new/jest-regex-util@15694

@jest/reporters

npm i https://pkg.pr.new/@jest/reporters@15694

jest-resolve

npm i https://pkg.pr.new/jest-resolve@15694

jest-resolve-dependencies

npm i https://pkg.pr.new/jest-resolve-dependencies@15694

jest-runner

npm i https://pkg.pr.new/jest-runner@15694

jest-runtime

npm i https://pkg.pr.new/jest-runtime@15694

@jest/schemas

npm i https://pkg.pr.new/@jest/schemas@15694

jest-snapshot

npm i https://pkg.pr.new/jest-snapshot@15694

@jest/snapshot-utils

npm i https://pkg.pr.new/@jest/snapshot-utils@15694

@jest/source-map

npm i https://pkg.pr.new/@jest/source-map@15694

@jest/test-result

npm i https://pkg.pr.new/@jest/test-result@15694

@jest/test-sequencer

npm i https://pkg.pr.new/@jest/test-sequencer@15694

@jest/transform

npm i https://pkg.pr.new/@jest/transform@15694

@jest/types

npm i https://pkg.pr.new/@jest/types@15694

jest-util

npm i https://pkg.pr.new/jest-util@15694

jest-validate

npm i https://pkg.pr.new/jest-validate@15694

jest-watcher

npm i https://pkg.pr.new/jest-watcher@15694

jest-worker

npm i https://pkg.pr.new/jest-worker@15694

pretty-format

npm i https://pkg.pr.new/pretty-format@15694

commit: 55f554e

Copy link
Member

@cpojer cpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good aber Sätze beginnt man immer noch mit Großbuchstaben.

@cpojer cpojer merged commit d3efda6 into jestjs:main Jun 25, 2025
39 of 53 checks passed
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: jest.config.ts parsing broken on node 24 + CJS
2 participants