Skip to content

Support jest.config.mts#16005

Open
manthansubhash01 wants to merge 4 commits intojestjs:mainfrom
manthansubhash01:feat/support-jest-config-mts-15997
Open

Support jest.config.mts#16005
manthansubhash01 wants to merge 4 commits intojestjs:mainfrom
manthansubhash01:feat/support-jest-config-mts-15997

Conversation

@manthansubhash01
Copy link
Copy Markdown

@manthansubhash01 manthansubhash01 commented Mar 24, 2026

Summary

This PR adds support for jest.config.mts as a valid Jest configuration file.

Jest currently supports jest.config.ts, jest.config.js, jest.config.mjs, jest.config.cjs, jest.config.cts, and jest.config.json, but does not support the TypeScript ESM extension .mts. This creates friction in ESM-first TypeScript projects where .mts is used to explicitly define ESM behavior independent of the package.json type field.

This change resolves the issue by:

  • Adding .mts to config extension constants and implicit config resolution order.
  • Updating config loading to treat .mts as TypeScript and load it via ESM.
  • Updating the module loading helper to use dynamic import for .mts.
  • Adding and updating unit tests and e2e tests for config discovery and loading.
  • Adding fixtures for .mts config scenarios.
  • Updating CLI extension validation test expectations.
  • Updating documentation (current and versioned) to include .mts as a supported config file.

Test plan

  • Attempted to run targeted tests for all modified areas.

Result:

  • Test execution could not be completed in this environment due to missing dependencies.
  • Error observed: Couldn't find the node_modules state file - running an install might help.

Additional validation:

  • No editor or type errors were reported for the modified files.

CI:

  • Full test validation is expected to run in CI for this branch.

Note:

  • A CHANGELOG.md entry will be added before merge, as per contribution guidelines.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 24, 2026

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit c7e584f
🔍 Latest deploy log https://app.netlify.com/projects/jestjs/deploys/69c2ddf85e328d0008899273
😎 Deploy Preview https://deploy-preview-16005--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.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 24, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 24, 2026

Open in StackBlitz

babel-jest

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

babel-plugin-jest-hoist

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

babel-preset-jest

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

create-jest

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

@jest/diff-sequences

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

expect

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

@jest/expect-utils

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

jest

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

jest-changed-files

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

jest-circus

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

jest-cli

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

jest-config

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

@jest/console

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

@jest/core

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

@jest/create-cache-key-function

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

jest-diff

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

jest-docblock

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

jest-each

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

@jest/environment

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

jest-environment-jsdom

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

@jest/environment-jsdom-abstract

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

jest-environment-node

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

@jest/expect

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

@jest/fake-timers

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

@jest/get-type

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

@jest/globals

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

jest-haste-map

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

jest-jasmine2

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

jest-leak-detector

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

jest-matcher-utils

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

jest-message-util

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

jest-mock

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

@jest/pattern

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

jest-phabricator

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

jest-regex-util

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

@jest/reporters

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

jest-resolve

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

jest-resolve-dependencies

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

jest-runner

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

jest-runtime

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

@jest/schemas

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

jest-snapshot

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

@jest/snapshot-utils

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

@jest/source-map

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

@jest/test-result

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

@jest/test-sequencer

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

@jest/transform

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

@jest/types

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

jest-util

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

jest-validate

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

jest-watcher

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

jest-worker

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

pretty-format

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

commit: c7e584f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant