@jest/transform
30.5.2 · 18 Sep 2026MIT80.4M / weekRepositoryHomepagenpmAtom feed
100 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 30.x · latest line
30.5.2
18 Sep 2026@jest/transform: Strip TypeScript types with Node when no transformer claims a
.ts,.mtsor.ctsfilejest-core, jest-haste-map, jest-transform: Keep
require('../package.json')external when bundling, sojest --versionand the transform and haste-map cache keys report the released version instead of the previous onejest-each: Escape a table row's keys before building the
$variableinterpolationRegExp, so a column name such ascount(*)no longer fails the whole table withInvalid regular expression, and a.or|in a column name is matched literally
Features
@jest/transform: Strip TypeScript types with Node when no transformer claims a
.ts,.mtsor.ctsfile
Fixes
jest-core, jest-haste-map, jest-transform: Keep
require('../package.json')external when bundling, sojest --versionand the transform and haste-map cache keys report the released version instead of the previous onejest-each: Escape a table row's keys before building the
$variableinterpolationRegExp, so a column name such ascount(*)no longer fails the whole table withInvalid regular expression, and a.or|in a column name is matched literally@jest/source-map: Resolve absolute Windows paths in a source map's
sourcesandsourceRootagain, instead of appending them to the transformed file's directory
30.5.1
1 Sep 2026jest-config: Don't warn about global-only options in the config that supplies the global config - the root config a project resolves to, or the first entry of
--projectswhen no root config is passedjest-config, jest-types: Stop accepting
reporters,coverageReporters,workerIdleMemoryLimit,cwdandrunnerOptionsin a project config - they were silently ignored, and now warn like the other global-only optionsjest-config, jest-validate: Warn about
maxWorkersandcoverageThresholdin a project config instead of dropping them without a word
Fixes
jest-config: Don't warn about global-only options in the config that supplies the global config - the root config a project resolves to, or the first entry of
--projectswhen no root config is passedjest-config, jest-types: Stop accepting
reporters,coverageReporters,workerIdleMemoryLimit,cwdandrunnerOptionsin a project config - they were silently ignored, and now warn like the other global-only optionsjest-config, jest-validate: Warn about
maxWorkersandcoverageThresholdin a project config instead of dropping them without a wordjest-resolve: Match
moduleNameMapperpatterns against the specifier as written again (reverting #16390)jest-runtime: Resolve package
importsspecifiers like#depunder ESM again
30.5.0
28 Aug 2026- breaking
jest-haste-map: Match watched files on a full extension, so
moduleFileExtensions: ['js']no longer acceptsfoo.mjs - deprecated
@jest/source-map: Deprecate
getCallsitein favour ofSourceMapSupport#getCallsite babel-plugin-istanbulis updated to v8
On a personal note: King Harald V of Norway passed away this morning. He ascended the throne 35 years ago, two months before I was born. This release is dedicated to his memory. Hvil i fred 🇳🇴
This is a big release. It touches
jest-runtime,jest-resolveandjest-haste-mapin many places, and with this many changes there might be regressions 😬. If your suite behaves differently after upgrading, please open an issue.Highlights
whenCalledWithMock functions can now configure return values per argument list, contributed by @timkindberg (#16053):
const fn = jest.fn(); fn.whenCalledWith('apple').mockReturnValue('red'); fn.whenCalledWith('banana').mockReturnValue('yellow'); fn.whenCalledWith(expect.any(Number)).mockReturnValue('numeric'); fn('apple'); // 'red' fn('banana'); // 'yellow' fn(42); // 'numeric' fn('grape'); // undefinedThe returned object is a real
Mock, somockReturnValueOnce,mockResolvedValue,mockImplementationetc. all chain here too. Argument slots accept literals or any asymmetric matcher, with the same equality semantics astoHaveBeenCalledWith(). Calls that match nothing fall through to the base mock. See the Mock Functions docs for matching and precedence details.Describe-level retries
jest.retryTimes()can now retry a wholedescribeblock instead of a single test, contributed by @soltonigiri (#16322). Each attempt reruns the block'sbeforeAll/afterAllhooks, child tests and nested describes, which helps when tests in a block depend on shared state:describe('workflow', () => { jest.retryTimes(3, {entireDescribe: true}); test('first step', () => {}); test('second step', () => {}); // a failure retries the entire block });New file watcher
The non-watchman path of
jest-haste-mapis rewritten.@parcel/watcherreplaces the homegrownNodeWatcherandFSEventsWatcher(#16188), andfdirreplaces the hand-rolled directory recursion in the crawler (#16187). A batch of fixes also makes watching and indexing survive locked files on Windows, watchman failures, and duplicate manual mocks (#16295, #16358, #16355, #16360).If you can, please run your suite with
--no-watchman(in and out of watch mode) to exercise the new crawler and watchers, and report anything odd 👍Long-requested dependency updates
babel-plugin-istanbulis updated to v8globis updated to v13source-map-supportis replaced with an implementation in@jest/source-map(#16327). This fixes a memory leak wheresource-map-support's process-global caches pinned every finished test file's sandbox. Source maps also survive environment teardown,--testLocationInResultslooks up the right column, and scheme-prefixed sources likewebpack:///are kept as-is.
Performance
Warm module resolution costs about a third of what it did, and repeated work is gone from the resolution hot path (#16373, #16371).
Per-
requireoverhead injest-runtimeis cut: module ID resolution is skipped when no mock can apply, and core modules answer before the manual-mock probe (#16376).jest-snapshotloads babel, semver and synckit lazily, so every test process loads ~200 fewer modules (#16387).jest-haste-mapcaches the watchman socket path, so warm runs spawn no watchman processes (#16386), and reuses cached metadata for duplicated haste names instead of re-parsing them on every startup (#16351).
More new APIs
Snapshot failures expose the
.snapfile path asmatcherResult.snapshotPathinfailureDetails(#16374).--collectTestsexpandstest.each/describe.eachcases and reports per-status counts plus a summary line that matches a real run (#16259).AggregateErrorinner errors and nestedcausechains render with code frames and per-level indentation, and are included in--jsonoutput,retryReasonsand reporter annotations (#16316).
ESM
A long list of fixes brings
jest-runtime's module system closer to Node's:Automocking and manual
__mocks__files now apply to ESM on Node 24.9+. Static imports, dynamicimport()andrequire()of an ESM file generate an automock from the real module's namespace instead of failing with "Attempting to import a mock without a factory" (#16391).Many
jest.unstable_mockModulegaps are closed: mocks apply when the mocked file isrequire()d directly, async factories run once and fail the import instead of crashing the worker 😅, and mocks made insidejest.isolateModulesstay scoped to that block (#16389, #16365).require(esm), CJS/ESM interop,import.meta,data:URIs and error ordering now match Node in dozens of edge cases. See the Fixes section for the full list (#16364 through #16391).The
module-syncexport condition resolves, so packages that expose their ESM entry point forrequire()load the same file Node picks (#16336).
The intentional divergences from Node's module system are now documented on the ECMAScript Modules page (#16368).
Resolver
The default resolver honors Node's
--preserve-symlinks/NODE_PRESERVE_SYMLINKS(#16260).moduleNameMapperapplies to both spellings of core module specifiers (fsandnode:fs), and builtins that only exist prefixed (node:sqlite,node:test) resolve asynchronously (#16390, #16388).A user resolver can be written as an ES module (#16332).
On top of the highlights there are ~60 fixes across
jest-circus,jest-haste-map,jest-config,jest-mockand the transform cache keys. See the full changelog below 😀Features
@jest/expect-utils, jest-mock: Add
mockFn.whenCalledWith(...args)for configuring return values per argument list, with first-class asymmetric-matcher support@jest/expect-utils: Export
AsymmetricMatcherandFunctionParameterstypes (previously private toexpect)[jest-circus, jest-core, jest-jasmine2, jest-test-result, jest-types]--collectTestsnow expandstest.each/describe.eachcases and reports per-status counts (skipped/todo via the newwouldRunflag for selected tests) plus a summary line that match a real run, including under--testNamePatternand.only/fdescribefocus on both the circus and jasmine2 runners[jest-circus, jest-environment, jest-runtime, jest-types]Add describe-level retries viajest.retryTimes(..., {entireDescribe: true})[jest-circus, jest-message-util, jest-reporters, jest-types]AddretryMessagestoAssertionResultand exportformatErrorStack, so the retry log renders nestedcauseandAggregateErrorsections with code frames instead of serialized[cause]:/[errors]:markersjest-circus, jest-types: Add
unhandledErrorsDetailedtoCircus.RunResult, so an unhandled rejection reports itscausechain andAggregateErrorentries with code frames instead of a pre-serialized stackjest-haste-map: Replace
NodeWatcherandFSEventsWatcherwith@parcel/watcherfor the non-watchman watch pathjest-resolve: Bump
unrs-resolverto 1.12.1, removejest-pnp-resolverand unnecessary checksjest-resolve: Honor Node's
--preserve-symlinks/NODE_PRESERVE_SYMLINKSin the default resolver by passingsymlinks: falsetounrs-resolverjest-runtime: Apply automocking and manual
__mocks__files to synchronously evaluable ESM graphs on Node 24.9+ - static imports, dynamicimport()andrequire()of an ESM file now generate an automock from the real module's namespace instead of failing with "Attempting to import a mock without a factory". Graphs that need async evaluation (top-level await) or an async-only resolver or transformer still throwjest-runtime: Route
process.getBuiltinModulethrough the sandbox, so it returns the sandboxprocessand the hookednode:moduleinstead of the host'sjest-runtime: Throw an actionable error from
module.register()andmodule.registerHooks()inside a test - the hooks attached to the loader running Jest itself, never saw the sandboxed requires they were meant for, and stayed registered for every later test file in the workerjest-runtime: Surface resolution and import-attribute errors in an ESM graph before executing any of its CJS dependencies on Node 24.9+, matching Node's run-nothing-on-a-broken-graph behavior; the legacy loader on older versions keeps its linking-time execution order
jest-runtime: Throw
ERR_SOURCE_PHASE_NOT_DEFINEDwith an actionable message forimport sourceandimport.source(), instead of failing at instantiation with V8's bare "Source phase import object is not defined"jest-runtime: Emit the JSON-without-import-attribute deprecation warning once per test file instead of once per worker, so it is no longer silently swallowed for every file after the first
jest-runtime: Set
import.meta.maintotruein the test file andfalsein every module it loads, matching Node 24+jest-runtime: Resolve the
module-syncexport condition, so a package that exposes its ESM entry point forrequire()loads the same file Node wouldjest-snapshot: Add external snapshot paths to custom reporter failure details
Fixes
jest-console, jest-reporters:
CustomConsolenow buffers console output soTestResult.consoleis populated for reporters whenverboseis enabled, whileGitHubActionsReporteravoids replaying buffered output in verbose mode[expect, jest-message-util, jest-pattern, jest-regex-util, jest-util]Revertnode:protocol imports to restore webpack/browser-bundle compatibilityexpect: Widen
toMatchObjectandobjectContainingparameter type fromRecord<string, unknown>toobjectso class instances are acceptedjest-circus: Call a generator test body with the shared test context, so
thismatches what a regular test function receivesjest-circus: Capture the error listeners of the parent process instead of the in-sandbox
process, so listeners registered before the test file survive teardown and sandbox listeners no longer leak onto the parentjest-circus: Clear
currentlyRunningTestafter skipped and todo testsjest-circus: Prevent late
done()callbacks from affecting later test or hook invocationsjest-circus, jest-jasmine2: Honor
--expandwhen formattingnode:assertfailures, instead of always collapsing the diffjest-circus, jest-jasmine2, jest-message-util: Serialize the inner errors of an
AggregateErrorintofailureMessages,retryReasonsandunhandledErrors, so--jsonoutput and reporter annotations include themjest-circus, jest-snapshot: Keep snapshot state and counts correct when a test retries
@jest/create-cache-key-function: Include the caller support flags in the generated key, so a transformer that emits ESM or CJS based on them no longer shares one cache entry between the two
@jest/create-cache-key-function: Include the stringified project config in the generated key, so editing a transformer's own settings invalidates what it cached
@jest/transform: Include the caller support flags in a transform's cache key, so a file transformed both as ESM and as CJS no longer serves one shape's output for the other
jest-config: Add missing
findRelatedTests,outputFile, andreplnameentries toValidConfigso they no longer trigger spurious "Unknown option" warningsjest-config: Use
--configfor the global config when multiple--projectsare specifiedjest-core: Serialize
bigintvalues in--jsonand--outputFileoutput as their literal form (4n), instead of failing the run withTypeError: Do not know how to serialize a BigIntjest-core: Do not report a
CustomGCasync resource (used by N-API addons such as napi-rs for per-isolate GC bookkeeping) as an open handle, since it isnapi_unref'd by the addon and can never keep the event loop alivejest-each: Keep a
$&,$`,$'or$$inside a%pparam value out of the replacement, so the title shows the value instead of the text around itjest-each: Interpolate a
bigintinto a%jtitle as its literal form ("4n") at any depth, instead of throwingTypeError: Do not know how to serialize a BigIntwhile collecting the testsjest-environment, jest-runtime: Bind
sandboxInjectedGlobalsto the right values wheninjectGlobalsisfalse, instead of shifting every one of them by a positionjest-environment-node, jest-util: Only warn about a conflicting
globalsCleanupmode when one was explicitly configured, and follow the mode that is actually in effectjest-environment-node, jest-util: Stop resolving lazy globals when setting up an environment, so Node 26's builtin module globals are no longer loaded (and no longer emit their deprecation warnings) for every test file
jest-haste-map: Keep watch mode alive when an outside process briefly makes a file unreadable on Windows, instead of tearing the watcher down on
EPERMjest-haste-map: Keep indexing when an outside process holds a file open on Windows, instead of failing the whole crawl on
EPERMjest-haste-map: Keep a duplicated manual mock resolving when the file it pointed at is deleted in watch mode
jest-haste-map: Shut the worker farm down when a duplicate manual mock aborts the build under
throwOnModuleCollisionjest-haste-map: Attach the watchman client's
errorlistener before the first command, so a watchman failure falls back to the node crawler instead of crashing on an unhandlederrorevent, and always end the clientjest-haste-map: Stop delivering watch events after
WatchmanWatcheris closed, and route its warnings through the configured consolejest-haste-map: Restore the nested
duplicatesindex correctly inModuleMap.fromJSON, so a haste collision reported inside a test worker raisesDuplicateHasteCandidatesErrorinstead of aTypeError- breaking
jest-haste-map: Match watched files on a full extension, so
moduleFileExtensions: ['js']no longer acceptsfoo.mjs jest-haste-map: Delimit the fields that make up the haste map cache key, so two different option sets cannot hash to the same cache file
jest-message-util: Print the inner errors of an
AggregateErrorthrown inside a testjest-message-util: Indent nested
causeandAggregateErrorsections of a test failure by one level per depth, so the nesting is legible instead of rendering flatjest-message-util: Color stack traces line by line so blank lines stay blank
jest-message-util: Detect Jest's own frames without assuming the checkout directory's name, and cover
@jest/*packages, so stack traces and code frames point at user codejest-mock:
mockResolvedValue/mockRejectedValuenow see all overload return types, so a Promise-returning overload survives even when a later overload returns a non-Promise (e.g.pg.Client['end'])@jest-environment/jsdom-abstract: Make
@types/jsdoma peer dependencyjest-mock: Remove the leftover own accessor descriptor when restoring a
spyOnof an inherited getter or setter, so the instance keeps reflecting the prototypejest-resolve: Include
extensionsToTreatAsEsmin theshouldLoadAsEsmcache key, so projects with different extension lists don't read each other's answersjest-resolve: Make
getModuleIDAsyncbuild and cachedata:URI module IDs the same way asgetModuleIDjest-resolve: Keep the
node:prefix when resolving a core module asynchronously, so a builtin that only exists prefixed (node:sea,node:sqlite,node:test,node:test/reporters) resolves instead of failing as a missing bare packagejest-resolve: Look up manual mocks for
node:protocol specifiers under the unprefixed name they are stored asjest-resolve: Apply
moduleNameMapperconsistently to both spellings of core module specifiers (fsvsnode:fs)jest-resolve: Keep virtual and ordinary mock module IDs isolated across test files
jest-resolve: Guard missing
require.resolve.pathsjest-resolve, jest-config, jest-runner: Support a user resolver written as an ES module
jest-resolve, jest-runtime: Throw the CJS parse error for ESM syntax in a
"type": "commonjs"package or a.cjsfile instead of loading it as ESM, matching Node@jest/source-map: Keep source map sources that name a scheme, such as
webpack:///, instead of resolving them into a path that does not exist@jest/source-map: Look up
--testLocationInResultspositions at the right column, and keep a mapping to the first column instead of discarding it@jest/source-map: Warn when a source map cannot be parsed, instead of silently leaving its frames untranslated
jest-runner, @jest/source-map: Keep a source-mapped stack for an error thrown after the test environment was torn down
jest-runtime, @jest/source-map: Keep source maps past teardown and past the next test file's
install, so a stack from a file no earlier stack mentioned still points at the original sourcejest-runtime: Report that no coverage was collected when
getAllV8CoverageInfoCopyis called afterteardown, instead of returning an empty resultjest-runtime: Cache a CJS module's parsed exports before walking its re-exports, so two modules that re-export each other no longer overflow the stack when imported from ESM
jest-runtime: Keep a re-exported ES module's parse failure from marking the re-exporting CommonJS file as ESM, so
module.exports = require('./dep.mjs')loads instead of failing withmodule is not definedjest-runtime: Scope module mocks instantiated inside
jest.isolateModules/isolateModulesAsyncto that block, so a mock first imported there no longer outlives it - matching how CommonJS mocks already behavejest-runtime: Suspend module isolation while generating an automock, so loading the real module to read its shape no longer populates the isolated registry
jest-runtime: Check a cached ES module's status before
require()returns it, so a module whose evaluation threw rethrows that error and one left linked by a failed sibling is evaluated instead of returning uninitialized bindingsjest-runtime: Report the original
ERR_REQUIRE_ASYNC_MODULEwhen arequire()of a top-level-await graph is retried, instead of a spurious "concurrentimport()" errorjest-runtime: Throw the evaluation error when another caller's
import()of the same module failed while we awaited it, instead of resolving with the errored modulejest-runtime: Mark the result of
require()ing an ES module that has a default export with__esModule: truethrough a live-binding facade, and serve the same object fromrequire.cache, matching Nodejest-runtime: Provide a CommonJS module's exports under the
'module.exports'named export when imported from ESM, matching Node 23+jest-runtime: Give the test file itself a non-null
require.mainjest-runtime: Populate
module.childrenwith the modules a file loads, matching Nodejest-runtime: Provide
import.meta.resolveandimport.meta.jestindata:URI modules, accept any-case mediatype parameters, and use Node's error codes for invaliddata:URIsjest-runtime: Key ES modules by full URL, so query and fragment suffixes create the same module instances as Node and show up in
import.meta.urljest-runtime: Share modules between overlapping graphs when a CommonJS module
require()s an ES module mid-load, instead of evaluating shared dependencies twicejest-runtime: Throw
ERR_REQUIRE_CYCLE_MODULElike Node when a CommonJS modulerequire()s an ES module that is still being loaded, instead of evaluating the module a second timejest-runtime: Key builtin modules in the ESM registry by one canonical specifier
jest-runtime:
import.meta.resolve()for a builtin uses itsnode:specifierjest-runtime: Fall back to native ESM when a
.jsfile contains ESM syntax but has no"type":"module"markerjest-runtime: Allow
require()of ESM-marked files on Node < 24.9 via transform fallbackjest-runtime, @jest/transform: Surface actionable
ERR_REQUIRE_ESMerror for files with untransformed ESM syntax instead of the generic "unexpected token" messagejest-runtime: Support older test environments whose
moduleMockerdoes not implementclearMocksOnScopejest-runtime: Apply
jest.unstable_mockModulewhen the mocked file itself isrequire()d, not only when it is imported as a dependencyjest-runtime: Apply
jest.unstable_mockModuleto statically importeddata:URIs on Node 24.9+, matching dynamicimport()jest-runtime: Run an async
jest.unstable_mockModulefactory once per module instead of twice, and fail the import instead of crashing the worker when the factory rejectsjest-runtime: Hide a
require(esm)module that failed to evaluate fromrequire.cache, as Node does, instead of exposing a namespace with uninitialized bindingsjest-runtime: Strip the byte-order mark when importing a JSON module, matching
require()and Nodejest-runtime: Throw
ERR_REQUIRE_ASYNC_MODULEwhenrequire(esm)runs under an async-only custom resolver, instead of silently resolving with the default resolverjest-runtime: Parse imported JSON modules with the test realm's
JSON, so their objects passinstanceof Objectinside the test likerequire()d JSON doesjest-runtime: Accept every
file:URL string in the sandboxedmodule.createRequire, including one with alocalhostauthority, as Node doesjest-runtime: Point at
{virtual: true}whenjest.mockorjest.unstable_mockModuleis given a module that cannot be resolvedjest-reporters: Fix coverage report table formatting in CI/GitHub Actions environments where
process.stdout.columnsis undefined by falling back to theCOLUMNSenv var or80columns in CI, preserving existing behaviour in other non-TTY environmentsjest-runtime: Support CJS-in-ESM exports via
"module.exports"named exportsjest-snapshot: Keep a skipped or failed test's hinted snapshots, instead of reporting them obsolete
jest-util: Stop
globsToMatcherreusing a cached matcher compiled with different picomatch options, and keep itsdot: truedefault whendotis passed asundefinedpretty-format: Move the
react-isaliases into the@jestscope, so they cannot be shadowed by unrelated packages published under the alias names
Chore & Maintenance
- deprecated
@jest/source-map: Deprecate
getCallsitein favour ofSourceMapSupport#getCallsite
30.4.1
8 May 2026[jest-config, jest-core, jest-runner, jest-schemas, jest-types]Allow custom runner configuration options via tuple format['runner-path', {options}]jest-runtime: Align CJS-from-ESM default export with Node:
module.exportsis always the ESM default,__esModuleunwrapping is no longer applied
30.4.0
7 May 2026babel-jest: Support collecting coverage from
.mts,.cts(and other) files[jest-circus, jest-cli, jest-config, jest-core, jest-jasmine2, jest-types]Add--collect-testsflag to discover and list tests without executing themjest-config, jest-runner, jest-worker: Add
workerGracefulExitTimeoutconfig option to control how long workers are given to exit before being force-killed
Big release! 😀
Main feature is a rewrite of our custom runtime in preparation for stabilisation of native support of ESM. As part of that work
require(esm)module is now supported on Node 24.9+ (still requires--experimental-vm-moduleslike before).In addition we now support fake timers for the recently released
TemporalAPI in Node v26.React 19 is also supported properly in
pretty-format, meaning snapshots of React components now work like they should.Due to all the changes, there might be regressions that snuck in. Please report them!
Full list of changes below
Features
babel-jest: Support collecting coverage from
.mts,.cts(and other) files[jest-circus, jest-cli, jest-config, jest-core, jest-jasmine2, jest-types]Add--collect-testsflag to discover and list tests without executing themjest-config, jest-runner, jest-worker: Add
workerGracefulExitTimeoutconfig option to control how long workers are given to exit before being force-killedjest-config: Add support for
jest.config.mtsas a valid configuration file[jest-config, jest-core, jest-reporters, jest-runner]verboseandsilentcan now be set per-project; the project-level value overrides the global value for that project's tests@jest/fake-timers: Accept
Temporal.Durationinjest.advanceTimersByTime()andjest.advanceTimersByTimeAsync()@jest/fake-timers: Accept
Temporal.InstantandTemporal.ZonedDateTimeinjest.setSystemTime()anduseFakeTimers({now})@jest/fake-timers: Support faking
Temporal.Now.*jest-mock: Add
clearMocksOnScope(scope)onModuleMockerfor clearing every mock function exposed on a scope objectjest-resolve: Add
canResolveSync()onResolverso callers can detect when a user-configured resolver only exports anasynchookjest-runtime: Use synchronous
evaluate()for ES modules without top-levelawaiton Node versions that support it (v24.9+), and prefer the synchronous transform path when a sync transformer is configuredjest-runtime: Support
require()of ES modules on Node v24.9+jest-runtime: Validate TC39 import attributes (
with { type: 'json' }) on ESM imports@jest/transform: Add
canTransformSync(filename)onScriptTransformerso callers can pick the sync vs async transform pathjest-util: Add
isErrorhelperpretty-format: Support React 19
Fixes
expect-utils: Fix
toStrictEqualfailing onstructuredCloneresults due to cross-realm constructor mismatch@jest/expect-utils: Prevent
toMatchObject/subset matching from throwing when encountering exotic iterablesfake-timers: Convert
Dateto milliseconds before passing to@sinonjs/fake-timersjest: Export
GlobalConfigandProjectConfigTypeScript typesjest-circus: Prevent crash when
asyncErroris undefined for non-Error throwsjest-circus, jest-jasmine2: Include
Error.causein JSONfailureMessagesoutputjest-config: Fix preset path resolution on Windows when the preset uses subpath
exportsjest-config: Allow
collectCoverageandcoverageProviderin project config without a validation warningjest-config: Project config validator now emits "is not supported in an individual project configuration" instead of "probably a typing mistake" for known global-only options
jest-environment-node: Fix
--localstorage-filewarning on Node 25+jest-reporters: Apply global coverage threshold to unmatched pattern files in addition to glob/path thresholds
[jest-reporters, jest-runner, jest-runtime, jest-transform]Fix coverage report not showing correct code coverage when usingprojectsconfig optionjest-runtime: Resolve
expectand@jest/expectfrom the internal module registry so test-file imports share the sameJestAssertionErroras the globalexpectjest-runtime: Improve CJS-from-ESM interop:
__esModule/Babel default unwrap, broader named-export coverage, and shared CJS singleton across importersjest-runtime: Load
.jsfiles with ESM syntax but no"type":"module"marker as native ESMjest-runtime: Extend the
.js-with-ESM-syntax fallback torequire()on Node v24.9+ - falls back torequire(esm)when the CJS parser rejects ESM syntaxjest-runtime: Fix deadlocks and double-evaluation in concurrent ESM and wasm imports
jest-runtime: Fix error when
require()is called after the Jest environment has been torn downjest-runtime: Fix missing error when
import()is called after the Jest environment has been torn downjest-runtime: Fix virtual
unstable_mockModuleregistrations not respected in ESMjest-runtime: Apply
moduleNameMapperwhen resolving modules withrequire.resolve()and thepathsoption
30.3.0
10 Mar 2026jest-config: Add
defineConfigandmergeConfighelpers for type-safe Jest configjest-fake-timers: Add
setTimerTickModeto configure how timers advance*: Reduce token usage when run through LLMs
Features
jest-config: Add
defineConfigandmergeConfighelpers for type-safe Jest configjest-fake-timers: Add
setTimerTickModeto configure how timers advance*: Reduce token usage when run through LLMs
Fixes
jest-config: Keep CLI coverage output when using
--jsonwith--outputFilejest-mock: Use
Symbolfrom test environmentjest-reporters: Fix issue where console output not displayed for GHA reporter even with
silent: falseoptionjest-runtime: Fix issue where user cannot utilize dynamic import despite specifying
--experimental-vm-modulesNode optionjest-test-sequencer: Fix issue where failed tests due to compilation errors not getting re-executed even with
--onlyFailuresCLI optionjest-util: Make sure
process.features.require_moduleisfalse
30.2.0
28 Sep 2025jest-environment-jsdom-abstract: Add support for JSDOM v27
babel-jest: Export the
TransformerConfiginterfacejest-config: Fix
jest.config.tswith TS loader specified in docblock pragma
Features
jest-environment-jsdom-abstract: Add support for JSDOM v27
Fixes
babel-jest: Export the
TransformerConfiginterfacejest-config: Fix
jest.config.tswith TS loader specified in docblock pragma
30.1.2
1 Sep 2025jest-snapshot-utils: Correct snapshot header regexp to work with newline across OSes
30.1.1
27 Aug 2025jest-snapshot-utils: Fix deprecated goo.gl snapshot warning not handling Windows end-of-line sequences
30.1.0
27 Aug 2025jest-leak-detector: Configurable GC aggressiveness regarding to V8 heap snapshot generation
jest-runtime: Reduce redundant ReferenceError messages
jest-core: Include test modules that failed to load when --onlyFailures is active
Features
jest-leak-detector: Configurable GC aggressiveness regarding to V8 heap snapshot generation
jest-runtime: Reduce redundant ReferenceError messages
jest-core: Include test modules that failed to load when --onlyFailures is active
Fixes
Fix deprecated goo.gl snapshot guide link not getting replaced with fully canonical URL
jest-circus: Fix
it.concurrentnot working withdescribe.skipjest-snapshot: Fix mangled inline snapshot updates when used with Prettier 3 and CRLF line endings
jest-runtime: Importing from
@jest/globalsin more than one file no longer breaks relative paths
30.0.5
22 Jul 2025jest-config: Allow
testMatchto take a string valuejest-worker: Let
workerIdleMemoryLimitaccept 0 to always restart worker child processesexpect: Fix
biginterror
30.0.4
2 Jul 2025expect: The
Inversetype is now exportedexpect: Support
async functionsintoBejest: Jest --onlyFailures --listTests now correctly lists only failed tests
Features
expect: The
Inversetype is now exportedexpect: Support
async functionsintoBe
Fixes
jest: Jest --onlyFailures --listTests now correctly lists only failed tests
jest-snapshot: Handle line endings in snapshots
30.0.2
19 Jun 2025jest-matcher-utils: Make 'deepCyclicCopyObject' safer by setting descriptors to a null-prototype object
jest-util: Make garbage collection protection property writable
30.0.1
18 Jun 2025- deprecated
*: Remove and deprecate
jest-replpackage jest-resolver: Implement the
defaultAsyncResolverjest-resolver: Resolve builtin modules correctly
What's Changed
Features
jest-resolver: Implement the
defaultAsyncResolver
Fixes
jest-resolver: Resolve builtin modules correctly
jest-environment-node, jest-util: Avoid setting globals cleanup protection symbol when feature is off
Chore & Maintenance
- deprecated
*: Remove and deprecate
jest-replpackage
30.0.0
10 Jun 2025- breaking
jest-config: Add
mtsandctsto defaultmoduleFileExtensionsconfig - breaking
jest-config: Update
testMatchandtestRegexdefault option for supportingmjs,cjs,mts, andcts - breaking
@jest/core: Changed
--filterto accept an object with shape{ filtered: Array<string> }to match documentation
Today we are happy to announce the release of Jest 30. This release features a substantial number of changes, fixes, and improvements. While it is one of the largest major releases of Jest ever, we admit that three years for a major release is too long. In the future, we are aiming to make more frequent major releases to keep Jest great for the next decade.
If you want to skip all the news and just get going, run
npm install jest@^30.0.0and follow the migration guide: Upgrading from Jest 29 to 30.Features
*: Renamed
globalsCleanupModetoglobalsCleanupand--waitNextEventLoopTurnForUnhandledRejectionEventsto--waitForUnhandledRejectionsexpect: Add
ArrayOfasymmetric matcher for validating array elements.babel-jest: Add option
excludeJestPresetto allow opting out ofbabel-preset-jestexpect: Revert #15038 to fix
expect(fn).toHaveBeenCalledWith(expect.objectContaining(...))when there are multiple callsjest-circus, jest-cli, jest-config: Add
waitNextEventLoopTurnForUnhandledRejectionEventsflag to minimise performance impact of correct detection of unhandled promise rejections introducedjest-circus: Add a
waitBeforeRetryoption tojest.retryTimesjest-circus: Add a
retryImmediatelyoption tojest.retryTimesjest-circus, jest-jasmine2: Allow
setupFilesAfterEnvto export an async functionjest-circus, jest-test-result: Add
startedAttimestamp inTestCaseResultObjectwithinonTestCaseResultjest-cli: Export
buildArgv- breaking
jest-config: Add
mtsandctsto defaultmoduleFileExtensionsconfig - breaking
jest-config: Update
testMatchandtestRegexdefault option for supportingmjs,cjs,mts, andcts jest-config: Loads config file from provided path in
package.jsonjest-config: Allow loading
jest.config.ctsfilesjest-config: Show
rootDirin error message when apresetfails to loadjest-config: Support loading TS config files using
esbuild-registervia docblock loaderjest-config: Allow passing TS config loader options via docblock comment
jest-config: If Node is running with type stripping enabled, do not require a TS loader
@jest/core: Group together open handles with the same stack trace (#13417, & #14789)
@jest/core: Add
perfStatsto surface test setup overhead- breaking
@jest/core: Changed
--filterto accept an object with shape{ filtered: Array<string> }to match documentation @jest/core: Support
--outputFileoption for--listTests@jest/core: Stringify Errors properly with
--jsonflag- breaking
@jest/core, @jest/test-sequencer: Exposes
globalConfig&contextstoTestSequencer(#14535, & #14543) jest-each: Introduce
%$option to add number of the test to its title- breaking
@jest/environment: Remove deprecated
jest.genMockFromModule() - breaking
@jest/environment: Remove unnecessary defensive code
- breaking
jest-environment-jsdom: Upgrade JSDOM to v22
@jest/environment-jsdom-abstract: Introduce new package which abstracts over the
jsdomenvironment, allowing usage of custom versions of JSDOMjest-environment-node: Update jest environment with dispose symbols
Symbol(#14888 & #14909)- breaking
expect, @jest/expect: Add type inference for function parameters in
CalledWithassertions @jest/expect-utils: Properly compare all types of
TypedArrays- breaking
@jest/fake-timers: Upgrade
@sinonjs/fake-timersto v13 (#14544 & #15470) @jest/fake-timers: Exposing new modern timers function
advanceTimersToFrame()which advances all timers by the needed milliseconds to execute callbacks currently scheduled withrequestAnimationFramejest-matcher-utils: Add
SERIALIZABLE_PROPERTIESto allow custom serialization of objectsjest-mock: Add support for the Explicit Resource Management proposal to use the
usingkeyword withjest.spyOn(object, methodName)jest-reporters: Add support for DEC mode 2026
jest-resolver: Support
file://URLs as paths[jest-resolve,jest-runtime,jest-resolve-dependencies]Pass the conditions when resolving stub modulesjest-runtime: Exposing new modern timers function
jest.advanceTimersToFrame()from@jest/fake-timersjest-runtime: Support
import.meta.filenameandimport.meta.dirname(available from Node 20.11)jest-runtime: Support
import.meta.resolve- breaking
jest-runtime: Make it mandatory to pass
globalConfigto theRuntimeconstructor jest-runtime: Add
unstable_unmockModulejest-runtime: Add
onGenerateMocktransformer callback for auto generated callbacks (#15433 & #15482)- breaking
jest-runtime: Use
vm.compileFunctionovervm.Script @jest/types:
test.each(): Accept a readonly (as const) table properly@jest/types: Improve argument type inference passed to
testanddescribecallback functions fromeachtables- breaking
jest-snapshot: Add support for Error causes in snapshots
jest-snapshot: Support Prettier 3
@jest/util-snapshot: Extract utils used by tooling from
jest-snapshotinto its own package- breaking
pretty-format: Do not render empty string children (
'') in React plugin
Fixes
expect: Show
AggregateErrorto display*: Replace
exitwithexit-xbabel-plugin-jest-hoist: Use
denylistinstead of the deprecatedblacklistfor Babel 8 supportbabel-plugin-jest-hoist: Do not rely on buggy Babel behaviour
expect: Check error instance type for
toThrow/toThrowErrorexpect: Improve diff for failing
expect.objectContainingexpect: Use
Array.isArrayto check if an array is anArrayexpect: Fix Error
causeassertion errorsjest-changed-files: Print underlying errors when VCS commands fail
jest-changed-files: Abort
sl rootcall if output resembles a steam locomotive- breaking
jest-circus: Prevent false test failures caused by promise rejections handled asynchronously
jest-circus: Replace recursive
makeTestResultsimplementation with iterative onejest-circus: Omit
expect.hasAssertions()errors if a test already has errorsjest-circus, jest-expect, jest-snapshot: Pass
test.failingtests when containing failing snapshot matchersjest-circus: Concurrent tests now emit jest circus events at the correct point and in the expected order.
- breaking
jest-cli: Validate CLI flags that require arguments receives them
jest-config: Make sure to respect
runInBandoptionjest-config: Support
testTimeoutin project configjest-config: Support
coverageReportersin project configjest-config: Allow
reportersin project configjest-config: Allow Node16/NodeNext/Bundler
moduleResolutionin project's tsconfig@jest/create-cache-key-function: Correct the return type of
createCacheKeyjest-each: Allow
$keypathtemplates withnullorundefinedvalues@jest/expect-utils: Fix comparison of
DataView- breaking
@jest/expect-utils: Exclude non-enumerable in object matching
@jest/expect-utils: Fix comparison of
URL@jest/expect-utils: Check
Symbolproperties in equality@jest/expect-utils: Catch circular references within arrays when matching objects
@jest/expect-utils: Fix not addressing to Sets and Maps as objects without keys
jest-haste-map: Fix errors or clobbering with multiple
hasteImplModulePathsjest-leak-detector: Make leak-detector more aggressive when running GC
jest-runtime: Properly handle re-exported native modules in ESM via CJS
jest-runtime: Refactor
_importCoreModelso required core module is consistent if modified while loading- breaking
jest-schemas, jest-types: Fix type of
testFailureExitCodeconfig option jest-util: Make sure
isInteractiveworks in a browser- breaking
pretty-format: Print
ArrayBufferandDataViewcorrectly pretty-format: Fixed a bug where "anonymous custom elements" were not being printed as expected.
jest-cli: When specifying paths on the command line, only match against the relative paths of the test files
[BREAKING] Changes
testPathPatternconfiguration option totestPathPatterns, which now takes a list of patterns instead of the regex.[BREAKING]
--testPathPatternis now--testPathPatterns[BREAKING] Specifying
testPathPatternswhen programmatically callingwatchmust be specified asnew TestPathPatterns(patterns), whereTestPathPatternscan be imported from@jest/pattern
jest-reporters, jest-runner: Unhandled errors without stack get correctly logged to console
jest-util: Always load
mjsfiles withimportjest-worker: Properly handle a circular reference error when worker tries to send an assertion fails where either the expected or actual value is circular
jest-worker: Properly handle a BigInt when worker tries to send an assertion fails where either the expected or actual value is BigInt
expect: Resolve issue where
ObjectContainingmatched non-object values. ([#15463])(#15463).Adds a
conditional/checkto ensure the argument passed toexpectis an object.Add unit tests for new
ObjectContainingbehavior.Remove
invalid/wrongtest case assertions forObjectContaining.
jest-worker: Addresses incorrect state on exit
Performance
- breaking
*: Bundle all of Jest's modules into
index.js(#12348, #14550 & #14661) jest-haste-map: Only spawn one process to check for
watchmaninstallationjest-runner: Better cleanup
source-map-supportafter test to resolve (minor) memory leak[jest-circus, jest-environment-node, jest-repl, jest-runner, jest-util]Cleanup global variables on environment teardown to reduce memory leaks (#15215 & #15636 & #15643)
Chore & Maintenance
- security
[jest-environment-jsdom, jest-environment-jsdom-abstract]Increased version of jsdom to^26.0.0(#15325CVE-2024-37890) - breaking
*: Drop support for Node.js versions 14, 16, 19, 21 and 23 (#14460, #15118, #15623, #15640)
- breaking
*: Drop support for
typescript@4.3, minimum version is now5.4(#14542, #15621) - breaking
*: Add ESM wrapper for all of Jest's modules
- breaking
*: Upgrade to
glob@10 - breaking
babel-jest, babel-preset-jest: Increase peer dependency of
@babel/coreto^7.11 - breaking
expect: Remove
.toBeCalled(),.toBeCalledTimes(),.toBeCalledWith(),.lastCalledWith(),.nthCalledWith(),.toReturn(),.toReturnTimes(),.toReturnWith(),.lastReturnedWith(),.nthReturnedWith()and.toThrowError()matcher aliases - breaking
jest-cli, jest-config, @jest/types: Remove deprecated
--initargument - breaking
jest-mock: Remove
MockFunctionMetadataType,MockFunctionMetadataandSpyInstancetypes
- 29.x
29.7.0
12 Sep 2023create-jest: Add
npm init/yarn createinitialiser for Jest projectsjest-validate: Allow deprecation warnings for unknown options
jest-resolver: Replace unmatched capture groups in
moduleNameMapperwith empty string instead ofundefined
Features
create-jest: Add
npm init/yarn createinitialiser for Jest projectsjest-validate: Allow deprecation warnings for unknown options
Fixes
jest-resolver: Replace unmatched capture groups in
moduleNameMapperwith empty string instead ofundefinedjest-snapshot: Allow for strings as well as template literals in inline snapshots
@jest/test-sequencer: Calculate test runtime if
perStats.durationis missing
Performance
@jest/create-cache-key-function: Cache access of
NODE_ENVandBABEL_ENV
29.6.4
24 Aug 2023jest-environment-node: Make sure
atobandbtoaare writeable in Node 20jest-worker: Additional error wrapper for
parentPort.postMessageto fix unhandledDataCloneError.
Fixes
jest-environment-node: Make sure
atobandbtoaare writeable in Node 20jest-worker: Additional error wrapper for
parentPort.postMessageto fix unhandledDataCloneError.
29.6.3
21 Aug 2023- breaking
jest-mock: Revert #13692 as it was a breaking change
- breaking
jest-mock: Revert #13866 as it was a breaking change
- breaking
jest-mock: Revert #13867 as it was a breaking change
Fixes
expect, @jest/expect-utils:
ObjectContainingsupportsymbolas keyexpect: Remove
@types/nodefrom dependenciesjest-core: Use workers in watch mode by default to avoid crashes (#14059 & #14085).
jest-reporters: Update
istanbul-lib-instrumentdependency to v6.- breaking
jest-mock: Revert #13692 as it was a breaking change
- breaking
jest-mock: Revert #13866 as it was a breaking change
- breaking
jest-mock: Revert #13867 as it was a breaking change
@jest/reporters: Marks Reporter's hooks as optional
jest-runtime: Fix dynamic ESM import module bug when loaded module through
jest.isolateModulesAsync
29.6.2
27 Jul 2023jest-circus: Fix snapshot matchers in concurrent tests when nr of tests exceeds
maxConcurrency@jest/core: When running global setup and teardown, do not try to change the
messageproperty of the thrown error object when themessageproperty is unwritablejest-snapshot: Move
@types/prettierfromdependenciestodevDependencies
Fixes
jest-circus: Fix snapshot matchers in concurrent tests when nr of tests exceeds
maxConcurrency@jest/core: When running global setup and teardown, do not try to change the
messageproperty of the thrown error object when themessageproperty is unwritablejest-snapshot: Move
@types/prettierfromdependenciestodevDependenciesjest-snapshot: Throw an explicit error if Prettier v3 is used
jest-reporters: Add "skipped" and "todo" symbols to Github Actions Reporter
29.6.0
4 Jul 2023- security
*: Update
semverdependency to get vulnerability fix jest-circus, jest-snapshot: Add support for snapshot matchers in concurrent tests
jest-cli: Include type definitions to generated config files
Features
jest-circus, jest-snapshot: Add support for snapshot matchers in concurrent tests
jest-cli: Include type definitions to generated config files
jest-snapshot: Support arrays as property matchers
[jest-core, jest-circus, jest-reporter, jest-runner]Added support for reporting about start individual test cases using jest-circus
Fixes
jest-circus: Prevent false test failures caused by promise rejections handled asynchronously
jest-config: Handle frozen config object
jest-config: Allow
coverageDirectoryandcollectCoverageFromin project configjest-core: Always use workers in watch mode to avoid crashes (#14059).
jest-environment-jsdom, jest-environment-node: Fix assignment of
customExportConditionsviatestEnvironmentOptionswhen custom env subclass defines a default valuejest-matcher-utils: Fix copying value of inherited getters
jest-mock: Tweak typings to allow
jest.replaceProperty()replace methodsjest-mock: Improve user input validation and error messages of
spyOnandreplacePropertymethodsjest-runtime: Bind
jest.isolateModulesAsynctothisjest-runtime: Forward
wrapperLengthto theScriptconstructor ascolumnOffsetfor accurate debuggingjest-runtime: Guard
_isMockFunctionaccess withinjest-snapshot: Fix a potential bug when not using prettier and improve performance
@jest/transform: Do not instrument
.jsonmodulesjest-worker: Restart a shut down worker before sending it a task
Chore & Maintenance
- security
*: Update
semverdependency to get vulnerability fix
29.5.0
6 Mar 2023jest-changed-files: Support Sapling
jest-circus, @jest/cli, jest-config: Add feature to randomize order of tests via CLI flag or through the config file
[jest-cli, jest-config, @jest/core, jest-haste-map, @jest/reporters, jest-runner, jest-runtime, @jest/types]AddworkerThreadsconfiguration option to allow using worker threads for parallelization
Features
jest-changed-files: Support Sapling
jest-circus, @jest/cli, jest-config: Add feature to randomize order of tests via CLI flag or through the config file
[jest-cli, jest-config, @jest/core, jest-haste-map, @jest/reporters, jest-runner, jest-runtime, @jest/types]AddworkerThreadsconfiguration option to allow using worker threads for parallelizationjest-cli: Export
yargsOptionsjest-config: Add
openHandlesTimeoutoption to configure possible open handles warning.@jest/create-cache-key-function: Allow passing
lengthargument tocreateCacheKey()function and set its default value to16on Windowsjest-message-util: Add support for AggregateError (#13946 & #13947)
jest-message-util: Add support for Error causes in
testandit(#13935 & #13966)jest-reporters: Add
summaryThresholdoption to summary reporter to allow overriding the internal threshold that is used to print the summary of all failed tests when the number of test suites surpasses itjest-runtime: Expose
@sinonjs/fake-timersasync APIs functionsadvanceTimersByTimeAsync(msToRun)(tickAsync(msToRun)),advanceTimersToNextTimerAsync(steps)(nextAsync),runAllTimersAsync(runAllAsync), andrunOnlyPendingTimersAsync(runToLastAsync)jest-runtime, @jest/transform: Allow V8 coverage provider to collect coverage from files which were not loaded explicitly
jest-snapshot: Add support to
ctsandmtsTypeScript files to inline snapshotsjest-worker: Add
startmethod to worker farmsjest-worker: Support passing a URL as path to worker
Fixes
babel-plugin-jest-hoist: Fix unwanted hoisting of nested
jestusagesjest-circus: Send test case results for
todotestsjest-circus: Update message printed on test timeout
jest-circus: Avoid creating the word "testfalse" when
takesDoneCallbackisfalsein the message printed on test timeout AND updated timeouts testjest-environment-jsdom: Stop setting
documenttonullon teardown@jest/expect-utils: Update
toStrictEqual()to be able to checkjest.fn().mock.calls@jest/test-result: Allow
TestResultsProcessortype to return a Promise
29.4.3
15 Feb 2023expect: Update
toThrow()to be able to use errorcausesjest-core: Allow to use
workerIdleMemoryLimitwith only 1 worker orrunInBandoptionjest-message-util: Add support for error
causes (#13868 & #13912)
Features
expect: Update
toThrow()to be able to use errorcausesjest-core: Allow to use
workerIdleMemoryLimitwith only 1 worker orrunInBandoptionjest-message-util: Add support for error
causes (#13868 & #13912)jest-runtime: Revert
import assertionsfor JSON modules as it's been relegated to Stage 2
Fixes
@jest/expect-utils:
subsetEqualityshould consider also an object's inherited string keysjest-mock: Clear mock state when
jest.restoreAllMocks()is calledjest-mock: Prevent
mockImplementationOnceandmockReturnValueOncebleeding intowithImplementationjest-mock: Do not restore mocks when
jest.resetAllMocks()is called
29.4.2
7 Feb 2023@jest/core: Instrument significant lifecycle events with
performance.mark()expect, @jest/expect: Provide type of
actualas a generic argument toMatchersto allow better-typed extensionsjest-circus: Added explicit mention of test failing because
done()is not being called in error message
Features
@jest/core: Instrument significant lifecycle events with
performance.mark()
Fixes
expect, @jest/expect: Provide type of
actualas a generic argument toMatchersto allow better-typed extensionsjest-circus: Added explicit mention of test failing because
done()is not being called in error messagejest-runtime: Handle CJS re-exports of node core modules from ESM
jest-transform: Downgrade
write-file-atomicto v4jest-worker: Ignore IPC messages not intended for Jest
29.4.1
26 Jan 2023expect, jest-circus, @jest/types: Implement
numPassingAssertsof testResults to track the number of passing asserts in a testjest-core: Add newlines to JSON output
@jest/reporters: Automatic log folding in GitHub Actions Reporter
Features
expect, jest-circus, @jest/types: Implement
numPassingAssertsof testResults to track the number of passing asserts in a testjest-core: Add newlines to JSON output
@jest/reporters: Automatic log folding in GitHub Actions Reporter
Fixes
@jest/expect-utils:
toMatchObjectdiffs should includeSymbolpropertiesjest-runtime: Handle missing
replaceProperty@jest/types: Add partial support for
donecallbacks in typings ofeach
29.4.0
24 Jan 2023expect, @jest/expect-utils: Support custom equality testers
jest-config, jest-worker: Use
os.availableParallelismif available to calculate number of workers to spawn@jest/globals, jest-mock: Add
jest.replaceProperty()that replaces property value
Features
expect, @jest/expect-utils: Support custom equality testers
jest-config, jest-worker: Use
os.availableParallelismif available to calculate number of workers to spawn@jest/globals, jest-mock: Add
jest.replaceProperty()that replaces property valuejest-haste-map: Ignore Sapling vcs directories (
.sl/)jest-resolve: Support subpath imports (#13705, #13723, #13777)
jest-runtime: Add
jest.isolateModulesAsyncfor scoped module initialization of asynchronous functionsjest-runtime: Add
jest.isEnvironmentTornDownfunctionjest-test-result: Added
skippedandfocusedstatus toFormattedTestResultjest-transform: Support for asynchronous
createTransformer
Fixes
jest-environment-node: Fix non-configurable globals
@jest/expect-utils:
toMatchObjectshould handleSymbolpropertiesjest-mock: Fix
mockResetandresetAllMocksundefinedreturn valuejest-resolve: Add global paths to
require.resolve.pathsjest-resolve: Correct node core module detection when using
node:specifiersjest-runtime: Support WASM files that import JS resources
jest-runtime: Use the
scriptTransformercache injest-runnerjest-runtime: Enforce import assertions when importing JSON in ESM (#12755 & #13805)
jest-snapshot: Make sure to import
babeloutside of the sandboxjest-transform: Ensure the correct configuration is passed to preprocessors specified multiple times in the
transformoption
29.3.1
8 Nov 2022jest-config: Do not warn about
presetinProjectConfigjest-transform: Defer creation of cache directory
29.3.0
7 Nov 2022jest-runtime: Support WebAssembly (Wasm) imports in ESM modules
jest-config: Add config validation for
projectsoptionjest-mock: Treat cjs modules as objects so they can be mocked
Features
jest-runtime: Support WebAssembly (Wasm) imports in ESM modules
Fixes
jest-config: Add config validation for
projectsoptionjest-mock: Treat cjs modules as objects so they can be mocked
jest-worker: Throw an error instead of hanging when jest workers terminate unexpectedly
29.2.2
24 Oct 2022@jest/test-sequencer: Make sure sharding does not produce empty groups
jest-circus: Test marked as
todoare shown as todo when inside a focussed describejest-mock: Ensure mock resolved and rejected values are promises from correct realm
Fixes
@jest/test-sequencer: Make sure sharding does not produce empty groups
jest-circus: Test marked as
todoare shown as todo when inside a focussed describejest-mock: Ensure mock resolved and rejected values are promises from correct realm
jest-snapshot: Don't highlight passing asymmetric property matchers in snapshot diff
29.2.1
18 Oct 2022@jest/globals, jest-mock: Add
jest.Spied*utility typesjest-environment-node: Make
globalThis.performancewritable for Node 19 and fake timersjest-mock: Revert #13398 to restore mocking of setters
Features
@jest/globals, jest-mock: Add
jest.Spied*utility types
Fixes
jest-environment-node: Make
globalThis.performancewritable for Node 19 and fake timersjest-mock: Revert #13398 to restore mocking of setters
Performance
*: Use sha1 instead of sha256 for hashing
29.2.0
14 Oct 2022@jest/cli, jest-config: A seed for the test run will be randomly generated, or set by a CLI option
@jest/cli, jest-config:
--show-seedwill display the seed value in the report, and can be set via a CLI flag or through the config filejest-config: Add
readInitialConfigutility function
Features
@jest/cli, jest-config: A seed for the test run will be randomly generated, or set by a CLI option
@jest/cli, jest-config:
--show-seedwill display the seed value in the report, and can be set via a CLI flag or through the config filejest-config: Add
readInitialConfigutility functionjest-core: Allow
testResultsProcessorto be async[@jest/environment, jest-environment-node, jest-environment-jsdom, jest-runtime]AddgetSeed()to thejestobjectexpect, @jest/expect-utils: Allow
isAutility to take a type argumentexpect: Expose
AsyncExpectationResultandSyncExpectationResulttypes
Fixes
babel-plugin-jest-hoist: Ignore
TSTypeQuerywhen checking for hoisted referencesjest-core: Fix
detectOpenHandlesfalse positives for some special objects such asTLSWRAPjest-mock: Fix mocking of getters and setters on classes
jest-reporters: Transform file paths into hyperlinks
@jest/types: Infer type of
eachtable correctly when the table is a tuple or array@jest/types: Rework typings to allow the
*ReturnedWithmatchers to be called with no argument
Performance
jest-runner: Do not instrument v8 coverage data if coverage should not be collected
29.1.2
30 Sep 2022expect, @jest/expect: Revert buggy inference of argument types for
*CalledWithand*ReturnedWithmatchers introduced in 29.1.0jest-worker: Add missing dependency on
jest-util
29.1.0
28 Sep 2022expect, @jest/expect: Support type inference for function parameters in
CalledWithassertionsexpect, @jest/expect: Infer type of
*ReturnedWithmatchers argument@jest/environment, jest-runtime: Allow
jest.requireActualandjest.requireMockto take a type argument
Features
expect, @jest/expect: Support type inference for function parameters in
CalledWithassertionsexpect, @jest/expect: Infer type of
*ReturnedWithmatchers argument@jest/environment, jest-runtime: Allow
jest.requireActualandjest.requireMockto take a type argument@jest/environment: Allow
jest.mockandjest.doMockto take a type argument@jest/fake-timers: Add
jest.now()to return the current fake clock time (#13244, #13246)@jest/mock: Add
withImplementationmethod for temporarily overriding a mockexpect: Export
toThrow*matchers
Fixes
jest-circus, jest-jasmine2: Fix error messages for Node's
assert.throesjest-haste-map: Remove
__proto__usagejest-mock: Improve
spyOntypings to handle optional propertiesjest-mock: Fix mocking of getters and setters on classes
jest-snapshot: Throw useful error when an array is passed as property matchers
jest-snapshot: Prioritize parser used in the project
jest-transform: Attempt to work around issues with atomic writes on Windows
29.0.3
10 Sep 2022@jest/environment, jest-runtime: Allow passing a generic type argument to
jest.createMockFromModule<T>()methodexpect: Expose
ExpectationResulttypejest-snapshot: Expose
Contexttype
Features
@jest/environment, jest-runtime: Allow passing a generic type argument to
jest.createMockFromModule<T>()methodexpect: Expose
ExpectationResulttypejest-snapshot: Expose
Contexttype@jest/globals: Add
jest.Mocktype helper
Fixes
jest-core: Capture
execErrorduringTestScheduler.scheduleTestsand dispatch to reportersjest-resolve: Make sure to resolve module paths after looking at
exportsjest-resolve: Improve error on module not found deep in the
requirestackjest-snapshot: Fix typings of snapshot matchers
29.0.2
3 Sep 2022jest-transform: Expose
TransformFactorytypebabel-plugin-jest-hoist: Support imported
jestin mock factoryjest-mock: Align the behavior and return type of
generateFromMetadatamethod
Features
jest-transform: Expose
TransformFactorytype
Fixes
babel-plugin-jest-hoist: Support imported
jestin mock factoryjest-mock: Align the behavior and return type of
generateFromMetadatamethodjest-runtime: Support
jest.resetModules()with ESM
29.0.1
26 Aug 2022jest-snapshot: Pass
snapshotFormatthrough when diffing snapshots
29.0.0
25 Aug 2022- breaking
expect: Differentiate between
MatcherContextMatcherUtilsandMatcherStatetypes - breaking
jest-config: Make
snapshotFormatdefault toescapeString: falseandprintBasicPrototype: false - breaking
jest-config: Remove undocumented
collectCoverageOnlyFromoption
Blog post: jestjs.io/blog/2022/08/25/jest-29
Features
- breaking
expect: Differentiate between
MatcherContextMatcherUtilsandMatcherStatetypes jest-circus: Add support for
test.failing.each- breaking
jest-config: Make
snapshotFormatdefault toescapeString: falseandprintBasicPrototype: false - breaking
jest-config: Remove undocumented
collectCoverageOnlyFromoption - breaking
jest-environment-jsdom: Upgrade to
jsdom@20(#13037, #13058) @jest/globals: Add
jest.Mocked,jest.MockedClass,jest.MockedFunctionandjest.MockedObjectutility types- breaking
jest-mock: Refactor
Mocked*utility types.MaybeMockedDeepandMaybeMockedbecameMockedandMockedShallowrespectively; only deep mocked variants ofMockedClass,MockedFunctionandMockedObjectare exported (#13123, #13124) - breaking
jest-mock: Change the default
jest.mockedhelper’s behavior to deep mocked - breaking
jest-snapshot: Let
babelfind config when updating inline snapshots - breaking
@jest/test-result, @jest/types: Replace
BytesandMillisecondstypes withnumber jest-worker: Adds
workerIdleMemoryLimitoption which is used as a check for worker memory leaks >= Node 16.11.0 and recycles child workers as required (#13056, #13105, #13106, #13107)- breaking
pretty-format: Remove
ConvertAnsiplugin in favour ofjest-serializer-ansi-escapes pretty-format: Allow to opt out from sorting object keys with
compareKeys: null
Fixes
jest-config: Fix testing multiple projects with TypeScript config files
@jest/expect-utils: Fix deep equality of ImmutableJS Record
jest-haste-map: Increase the maximum possible file size that jest-haste-map can handle
jest-runtime: Properly support CJS re-exports from dual packages
jest-snapshot: Make
prettierPathoptional inSnapshotStatejest-snapshot: Fix parsing error from inline snapshot files with
JSXjest-worker: When a process runs out of memory worker exits correctly and doesn't spin indefinitely
Chore & Maintenance
- breaking
*: Drop support for Node v12 and v17
- breaking
jest-snapshot: Require
rootDiras argument toSnapshotState
- 28.x
28.1.3
13 Jul 2022jest-leak-detector: Use native
FinalizationRegistrywhen it exists to get rid of external C dependencyjest-changed-files: Fix a lock-up after repeated invocations
@jest/expect-utils: Fix deep equality of ImmutableJS OrderedSets
Features
jest-leak-detector: Use native
FinalizationRegistrywhen it exists to get rid of external C dependency
Fixes
28.1.2
29 Jun 2022jest-runtime: Avoid star type import from
@jest/globals
Fixes
jest-runtime: Avoid star type import from
@jest/globals
28.1.1
7 Jun 2022jest: Expose
Configtype@jest/reporters: Improve
GitHubActionsReporters annotation format
Features
jest: Expose
Configtype@jest/reporters: Improve
GitHubActionsReporters annotation format@jest/types: Infer argument types passed to
testanddescribecallback functions fromeachtables (#12885, #12905)
Fixes
@jest/expect-utils: Fix deep equality of ImmutableJS OrderedMaps
jest-docblock: Handle multiline comments in parseWithComments
jest-mock: Improve
spyOnerror messagesjest-runtime: Correctly report V8 coverage with
resetModules: truejest-worker: Make
JestWorkerFarmhelper type to include methods of worker module that take more than one argument
28.1.0
6 May 2022jest-circus: Add
failingtest modifier that inverts the behaviour of testsjest-environment-node, jest-environment-jsdom: Allow specifying
customExportConditionsexpect: Adjust typings of
lastCalledWith,nthCalledWith,toBeCalledWithmatchers to allow a case there a mock was called with no arguments
Features
jest-circus: Add
failingtest modifier that inverts the behaviour of testsjest-environment-node, jest-environment-jsdom: Allow specifying
customExportConditions
Fixes
expect: Adjust typings of
lastCalledWith,nthCalledWith,toBeCalledWithmatchers to allow a case there a mock was called with no arguments@jest/expect-utils: Fix deep equality of ImmutableJS Lists
jest-core: Do not collect
SIGNREQUESTas open handles
28.0.3
29 Apr 2022jest-config: Normalize
reportersoption defined in presets@jest/reporters: Fix trailing slash in matching
coverageThresholdkeyjest-resolve: Fix (experimental) ESM module mocking for re-exports
Fixes
jest-config: Normalize
reportersoption defined in presets@jest/reporters: Fix trailing slash in matching
coverageThresholdkeyjest-resolve: Fix (experimental) ESM module mocking for re-exports
@jest/transform: Throw better error if an invalid return value if encountered
28.0.1
26 Apr 2022- removed
jest-serializer: Remove deprecated module from source tree
jest-resolve: Expose
ResolverOptionstypeexpect: Add missing dependency
jest-util
Features
jest-resolve: Expose
ResolverOptionstype
Fixes
expect: Add missing dependency
jest-utiljest-circus: Improve
test.concurrentjest-resolve: Correctly throw an error if
jsdomtest environment is used, but not installed
Chore & Maintenance
- removed
jest-serializer: Remove deprecated module from source tree
28.0.0
25 Apr 2022- breaking
jest-cli, jest-config: Remove
testURLconfig, usetestEnvironmentOptions.urlinstead - breaking
jest-cli: Remove undocumented
--timersoption - breaking
jest-config: Stop shipping
jest-environment-jsdomby default
Blog post: jestjs.io/blog/2022/04/25/jest-28
Features
babel-jest: Export
createTransformerfunctionexpect: Expose
AsymmetricMatchers,MatcherFunctionandMatcherFunctionWithStateinterfaces (#12363, #12376)jest-circus: Support error logging before retry
jest-circus, jest-jasmine2: Allowed classes and functions as
describeandit/testnames- breaking
jest-cli, jest-config: Remove
testURLconfig, usetestEnvironmentOptions.urlinstead jest-cli, jest-core: Add
--shardparameter for distributed parallel test execution- breaking
jest-cli: Remove undocumented
--timersoption - breaking
jest-config: Stop shipping
jest-environment-jsdomby default - breaking
jest-config: Stop shipping
jest-jasmine2by default jest-config, @jest/types: Add
citoGlobalConfig- breaking
jest-config: Rename
moduleLoadertoruntime - breaking
jest-config: Rename
extraGlobalstosandboxInjectedGlobals - breaking
jest-config: Throw an error instead of showing a warning if multiple configs are used
- breaking
jest-config: Do not normalize long deprecated configuration options
preprocessorIgnorePatterns,scriptPreprocessor,setupTestFrameworkScriptFileandtestPathDirs jest-cli, jest-core: Add
--ignoreProjectsCLI argument to ignore test suites by project namejest-core: Pass project config to
globalSetup/globalTeardownfunction as second argumentjest-core: Stabilize test runners with event emitters
- breaking
jest-core, jest-watcher: Move
TestWatcherclass tojest-watcherpackage jest-core: Allow using Summary Reporter as stand-alone reporter
- breaking
jest-environment-jsdom: Upgrade jsdom to 19.0.0
- breaking
jest-environment-jsdom: Add default
browsercondition toexportConditionsforjsdomenvironment - breaking
jest-environment-jsdom: Pass global config to Jest environment constructor for
jsdomenvironment - breaking
jest-environment-jsdom: Second argument
contextto constructor is mandatory - breaking
jest-environment-node: Add default
nodeandnode-addonconditions toexportConditionsfornodeenvironment - breaking
jest-environment-node: Pass global config to Jest environment constructor for
nodeenvironment - breaking
jest-environment-node: Second argument
contextto constructor is mandatory jest-environment-node: Add all available globals to test globals, not just explicit ones (#12642, #12696)
@jest/expect: New module which extends
expectwithjest-snapshotmatchers (#12404, #12410, #12418)@jest/expect-utils: New module exporting utils for
expect- breaking
@jest/fake-timers: Rename
timersconfiguration option tofakeTimers - breaking
@jest/fake-timers: Allow
jest.useFakeTimers()andprojectConfig.fakeTimersto take an options bag - breaking
jest-haste-map:
HasteMap.createnow returns a promise jest-haste-map: Add support for
dependencyExtractorwritten in ESM- breaking
jest-mock: Rename exported utility types
ClassLike,FunctionLike,ConstructorLikeKeys,MethodLikeKeys,PropertyLikeKeys; remove exports of utility typesArgumentsOf,ArgsType,ConstructorArgumentsOf- TS builtin utility typesConstructorParametersandParametersshould be used instead (#12435, #12489) jest-mock: Improve
isMockFunctionto infer types of passed function- breaking
jest-mock: Improve the usage of
jest.fngeneric type argument jest-mock: Add support for auto-mocking async generator functions
jest-mock: Add
contextsmember to mock functions@jest/reporters: Add GitHub Actions reporter (#11320, #12658)
@jest/reporters: Pass
reporterContextto custom reporter constructors as third argument- breaking
jest-resolve: Add support for
package.jsonexports(#11961, #12373) jest-resolve: Support package self-reference
jest-resolve, jest-runtime: Add support for
data:URI import and mockjest-resolve, jest-runtime: Add support for async resolver
- breaking
jest-resolve: Remove
browser?: booleanfrom resolver options,conditions: ['browser']should be used instead jest-resolve: Expose
JestResolver,AsyncResolver,SyncResolver,PackageFilter,PathFilterandPackageJSONtypes (#12707,jest-runner: Allow
setupFilesmodule to export an async functionjest-runner: Allow passing
testEnvironmentOptionsvia docblocksjest-runner: Expose
CallbackTestRunner,EmittingTestRunnerabstract classes andCallbackTestRunnerInterface,EmittingTestRunnerInterfaceto help typing third party runners (#12646, #12715)jest-runner: Lock version of
source-map-supportto 0.5.13- breaking
jest-runtime:
Runtime.createHasteMapnow returns a promise jest-runtime: Calling
jest.resetModulesfunction will clear FS and transform cache- breaking
jest-runtime: Remove
Contexttype export, it must be imported from@jest/test-result jest-runtime: Add
import.meta.jest@jest/schemas: New module for JSON schemas for Jest's config
@jest/source-map: Migrate from
source-mapto@jridgewell/trace-mapping- breaking
jest-transform: Make it required for
process()andprocessAsync()methods to always return structured data jest-test-result: Add duration property to JSON test output
- breaking
jest-watcher: Make
PatternPromptclass to takeentityNameas third constructor parameter instead ofthis._entityName - breaking
jest-worker: Allow only absolute
workerPath - breaking
jest-worker: Default to advanced serialization when using child process workers
pretty-format: New
maxWidthparameter
Fixes
*: Use
sha256instead ofmd5as hashing algortihm for compatibility with FIPS systems- breaking
babel-jest: Pass
rootDirasrootin Babel's options expect: Move typings of
.not,.rejectsand.resolvesmodifiers outside ofMatchersinterfaceexpect: Throw useful error if
expect.extendis called with invalid matchersexpect: Fix
iterableEqualityignores other propertiesexpect: Fix print for the
closeTomatcherjest-changed-files: Improve
changedFilesWithAncestorpattern for Mercurial SCMjest-circus, @jest/types: Disallow undefined value in
TestContexttypejest-config: Correctly detect CI environment and update snapshots accordingly
jest-config: Pass
moduleTypestots-nodeto enforce CJS when transpiling- breaking
jest-config: Add
mjsandcjsto defaultmoduleFileExtensionsconfig jest-config, jest-haste-map: Allow searching for tests in
node_modulesby exposingretainAllFiles- breaking
jest-core: Exit with status
1if no tests are found with--findRelatedTestsflag jest-core: Do not report unref-ed subprocesses as open handles
jest-each:
%#is not replaced with index of the test casejest-each: Fixes error message with incorrect count of missing arguments
jest-environment-jsdom: Make
jsdomaccessible to extending environments againjest-environment-jsdom: Log JSDOM errors more cleanly
jest-environment-node: Add
MessageChannel,MessageEventto globalsjest-environment-node: Add
structuredCloneto globals- breaking
@jest/expect-utils: Fix false positives when looking for
undefinedprop jest-haste-map: Don't use partial results if file crawl errors
jest-haste-map: Make watchman existence check lazy+async
- breaking
jest-jasmine2, jest-types: Move all
jasminespecific types from@jest/typesto its own package jest-jasmine2: Do not set
durationto0for skipped testsjest-matcher-utils: Pass maxWidth to
pretty-formatto avoid printing every element in arrays by defaultjest-mock: Fix function overloads for
spyOnto allow more correct type inference in complex objectjest-mock: Handle overridden
Function.nameproperty@jest/reporters: Notifications generated by the
--notifyflag are no longer persistent in GNOME Shell.@jest/reporters: Move missing icon file which is needed for
NotifyReporterclass.@jest/reporters: Update
v8-to-istanbuljest-resolver: Call custom resolver with core node.js modules
jest-runner: Correctly resolve
source-map-supportjest-worker: Fix
Farmexecution results memory leak
Chore & Maintenance
- breaking
*: Drop support for Node v10 and v15 and target first LTS
16.13.0 - breaking
*: Drop support for
typescript@3.8, minimum version is now4.3(#11142, #12648) - breaking
babel-jest: Only export
createTransformer - breaking
expect: Remove support for importing
build/utils - breaking
expect: Migrate to ESM
- breaking
expect: Snapshot matcher types are moved to
@jest/expect - breaking
jest-config: Remove
getTestEnvironmentexport - breaking
jest-config: Rename config option
nametoid - breaking
jest-environment-jsdom: Migrate to ESM
- breaking
jest-environment-node: Migrate to ESM
- breaking
jest-jasmine2, jest-runtime: Use
Symbolto passjest.setTimeoutvalue instead ofjasminespecific logic - breaking
jest-phabricator: Migrate to ESM
- breaking
jest-resolve: Make
requireResolveFunctionargument mandatory - breaking
jest-runner: Remove some type exports from
@jest/test-result - breaking
jest-runner: Second argument to constructor (
Context) is not optional - breaking
jest-serializer: Deprecate package in favour of using
v8APIs directly - breaking
jest-snapshot: Migrate to ESM
- breaking
jest-types: Remove
Config.GlobandConfig.Path
Performance
- breaking
jest-haste-map: Default to
nodecrawler over shelling out tofindifwatchmanis not enabled
- 27.x
27.5.1
8 Feb 2022jest-config: Support comments in JSON config file
pretty-format: Expose
ConvertAnsipluginexpect: Add type definitions for asymmetric
closeTomatcher
27.5.0
5 Feb 2022expect: Add asymmetric matcher
expect.closeTojest-mock: Added
mockFn.mock.lastCallto retrieve last argumentexpect: Add a fix for
.toHaveProperty('')
Features
expect: Add asymmetric matcher
expect.closeTojest-mock: Added
mockFn.mock.lastCallto retrieve last argument
Fixes
expect: Add a fix for
.toHaveProperty('')jest-each, @jest/globals: Allow passing
ReadonlyArraytype of a table todescribe.eachandtest.each@jest/globals: Add missing
optionsargument tojest.doMocktypingjest-environment-node: Add
atobandbtoajest-matcher-utils: Correct diff for expected asymmetric matchers
jest-message-util: Fix
.getTopFrame()(andtoMatchInlineSnapshot()) withmjsfiles
Performance
jest-resolve: Skip error creation on not found
statcalls
27.4.6
4 Jan 2022jest-environment-node: Add
AbortSignaljest-environment-node: Add Missing node global
performancejest-runtime: Handle missing
mockedproperty
Fixes
jest-environment-node: Add
AbortSignaljest-environment-node: Add Missing node global
performancejest-runtime: Handle missing
mockedproperty
Performance
jest-configperf: only register ts-node once when loading TS config files
27.4.5
13 Dec 2021jest-worker: Stop explicitly passing
process.env
27.4.4
10 Dec 2021babel-jest: Add
process.versionchunk to the cache keyjest-environment: Add
mockedtojestobjectjest-worker: Stop explicitly passing
execArgv
Fixes
babel-jest: Add
process.versionchunk to the cache keyjest-environment: Add
mockedtojestobjectjest-worker: Stop explicitly passing
execArgv