feat(jest-config): supports Jest config file with `.mts` extension
Summary
Resolves #15780
This PR will allow .mts config file to be passed to Jest, enabling folks to work with native type stripping in CommonJS projects. However, full .mts support is only for Node 23.6 and above due to type stripping enabled by default. On Node version ^20.19.0 || ^22.12.0, untyped jest.config.mts would still be accepted by Jest but adding type would emit error.
Test plan
Deploy Preview for jestjs ready!
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 15c06e3e1db9361df27d698812070ecb45b4ebf5 |
| Latest deploy log | https://app.netlify.com/projects/jestjs/deploys/68fe46ae6c0082000929e78c |
| Deploy Preview | https://deploy-preview-15796--jestjs.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
babel-jest
npm i https://pkg.pr.new/babel-jest@15796
babel-plugin-jest-hoist
npm i https://pkg.pr.new/babel-plugin-jest-hoist@15796
babel-preset-jest
npm i https://pkg.pr.new/babel-preset-jest@15796
create-jest
npm i https://pkg.pr.new/create-jest@15796
@jest/diff-sequences
npm i https://pkg.pr.new/@jest/diff-sequences@15796
expect
npm i https://pkg.pr.new/expect@15796
@jest/expect-utils
npm i https://pkg.pr.new/@jest/expect-utils@15796
jest
npm i https://pkg.pr.new/jest@15796
jest-changed-files
npm i https://pkg.pr.new/jest-changed-files@15796
jest-circus
npm i https://pkg.pr.new/jest-circus@15796
jest-cli
npm i https://pkg.pr.new/jest-cli@15796
jest-config
npm i https://pkg.pr.new/jest-config@15796
@jest/console
npm i https://pkg.pr.new/@jest/console@15796
@jest/core
npm i https://pkg.pr.new/@jest/core@15796
@jest/create-cache-key-function
npm i https://pkg.pr.new/@jest/create-cache-key-function@15796
jest-diff
npm i https://pkg.pr.new/jest-diff@15796
jest-docblock
npm i https://pkg.pr.new/jest-docblock@15796
jest-each
npm i https://pkg.pr.new/jest-each@15796
@jest/environment
npm i https://pkg.pr.new/@jest/environment@15796
jest-environment-jsdom
npm i https://pkg.pr.new/jest-environment-jsdom@15796
@jest/environment-jsdom-abstract
npm i https://pkg.pr.new/@jest/environment-jsdom-abstract@15796
jest-environment-node
npm i https://pkg.pr.new/jest-environment-node@15796
@jest/expect
npm i https://pkg.pr.new/@jest/expect@15796
@jest/fake-timers
npm i https://pkg.pr.new/@jest/fake-timers@15796
@jest/get-type
npm i https://pkg.pr.new/@jest/get-type@15796
@jest/globals
npm i https://pkg.pr.new/@jest/globals@15796
jest-haste-map
npm i https://pkg.pr.new/jest-haste-map@15796
jest-jasmine2
npm i https://pkg.pr.new/jest-jasmine2@15796
jest-leak-detector
npm i https://pkg.pr.new/jest-leak-detector@15796
jest-matcher-utils
npm i https://pkg.pr.new/jest-matcher-utils@15796
jest-message-util
npm i https://pkg.pr.new/jest-message-util@15796
jest-mock
npm i https://pkg.pr.new/jest-mock@15796
@jest/pattern
npm i https://pkg.pr.new/@jest/pattern@15796
jest-phabricator
npm i https://pkg.pr.new/jest-phabricator@15796
jest-regex-util
npm i https://pkg.pr.new/jest-regex-util@15796
@jest/reporters
npm i https://pkg.pr.new/@jest/reporters@15796
jest-resolve
npm i https://pkg.pr.new/jest-resolve@15796
jest-resolve-dependencies
npm i https://pkg.pr.new/jest-resolve-dependencies@15796
jest-runner
npm i https://pkg.pr.new/jest-runner@15796
jest-runtime
npm i https://pkg.pr.new/jest-runtime@15796
@jest/schemas
npm i https://pkg.pr.new/@jest/schemas@15796
jest-snapshot
npm i https://pkg.pr.new/jest-snapshot@15796
@jest/snapshot-utils
npm i https://pkg.pr.new/@jest/snapshot-utils@15796
@jest/source-map
npm i https://pkg.pr.new/@jest/source-map@15796
@jest/test-result
npm i https://pkg.pr.new/@jest/test-result@15796
@jest/test-sequencer
npm i https://pkg.pr.new/@jest/test-sequencer@15796
@jest/transform
npm i https://pkg.pr.new/@jest/transform@15796
@jest/types
npm i https://pkg.pr.new/@jest/types@15796
jest-util
npm i https://pkg.pr.new/jest-util@15796
jest-validate
npm i https://pkg.pr.new/jest-validate@15796
jest-watcher
npm i https://pkg.pr.new/jest-watcher@15796
jest-worker
npm i https://pkg.pr.new/jest-worker@15796
pretty-format
npm i https://pkg.pr.new/pretty-format@15796
commit: 15c06e3
@hainenber type stripping is also enabled by default in node 22 since version 22.18.0 (see https://nodejs.org/en/blog/release/v22.18.0)
Hi can we get this to merge? Is it changing to .mts would help us to get through Node 22.18 strip type enabling?
Seems like the CI is still failing on these. Might need to disable them on older Node versions.
CI is failing on multiple node versions, so I don't think the version itself is the issue. Looks like a regression?
(would love to land this 😀)
PR adjusted to be JS runtime agnostic, thanks to @ashleybartlett's suggestion.
Jest should understand require(esm) and type stripping based on the JS runtime's feature flag values of process.feature.require_module and process.feature.typescript; folks can use NODE_OPTIONS to toggle on or off on demand.
Hopefully CI gods let me through.
any ETA for this to be merged?