npm / jest
jest
What changed in jest 26 to 30, from its official release notes, upgrade guides and advisories. Also covers @types/jest. Sources checked 2026-11-30.
165 breaking1 security4 deprecations118 new APIs and options10 performance68 behavior and defaults16 tooling73 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initjest 30196 changes
Breaking changes 47
Module mocks instantiated inside an isolated block are now scoped to that block instead of outliving it.
Calls to
module.register()andmodule.registerHooks()inside a test now throw an actionable error because their hooks cannot affect sandboxed requires.Watched files now match full extensions, so
moduleFileExtensions: ['js']no longer acceptsfoo.mjs.ESM requiring, CJS/ESM interop and related error behavior are brought closer to Node, including live-binding facades and Node-compatible errors for cycles and top-level await.
When importing CJS from ESM, module.exports is always the ESM default; __esModule unwrapping is no longer applied, aligning behavior with Node.
The global coverage threshold now applies to unmatched pattern files in addition to glob and path thresholds.
pretty-formatnow printsArrayBufferin a human-readable way instead of showing internal fields.Adds type inference for function parameters in CalledWith assertions.
Adds an ESM wrapper for all Jest modules.
Various expect aliases were removed; use the migration guidance and eslint-plugin-jest autofixer to update affected code.
Custom filter functions must return an object with a
filteredarray instead of returning an array directly.The glob v10 upgrade may change pattern syntax and behavior, including brace expansions and extglobs, so some custom patterns may need adjustment.
Renamed globalsCleanupMode to globalsCleanup.
Bundling internal modules into single files means unofficial deep-import paths may no longer exist; use public APIs or documented interfaces.
The package now uses JSDOM v26, which may introduce behavior changes in the DOM environment.
Upgrades JSDOM to v22.
The interactive configuration initialization command was removed; use a package-manager create command to scaffold a config.
The legacy mock-generation function was removed; use
jest.createMockFromModuleinstead.Removes the deprecated jest.genMockFromModule API.
Module paths passed to
jest.mock()must now match case exactly.This alias matcher was removed; use
toHaveBeenLastCalledWithinstead.This alias matcher was removed; use
toHaveLastReturnedWithinstead.This mock-function type was removed from the public API.
Jest 30 drops support for Node 14, 16, 19, and 21; the minimum supported Node version is 18.x.
Drops support for Node.js versions 14, 16, 19, 21, and 23.
Object matchers now exclude non-enumerable properties by default, which can affect
expect.objectContainingand equality checks.This alias matcher was removed; use
toHaveBeenNthCalledWithinstead.This alias matcher was removed; use
toHaveNthReturnedWithinstead.The React snapshot serializer omits empty string children instead of rendering them in snapshot output.
Constructing a
Runtimenow requires aglobalConfigparameter.Snapshot printing changed, including replacement of deprecated goo.gl links, so existing snapshots may need updating.
This mock-function type was removed from the public API; use
jest.Spiedinstead.Fixes the type of the testFailureExitCode configuration option.
The default testMatch option changes to support mjs, cjs, mts, and cts.
The path-filtering flag is now plural and accepts multiple patterns separated by spaces or by repeating the flag.
Programmatic watch-mode callers must construct a
TestPathPatternsinstance instead of passingtestPathPattern.Replaces testPathPattern with testPathPatterns, which accepts a list of patterns instead of a regex.
The default testRegex option changes to support mjs, cjs, mts, and cts.
This alias matcher was removed; use
toHaveBeenCalledinstead.This alias matcher was removed; use
toHaveBeenCalledTimesinstead.This alias matcher was removed; use
toHaveBeenCalledWithinstead.This alias matcher was removed; use
toHaveReturnedinstead.This alias matcher was removed; use
toHaveReturnedTimesinstead.This alias matcher was removed; use
toHaveReturnedWithinstead.This alias matcher was removed; use
toThrowinstead.The minimum TypeScript version is now 5.4 for users of Jest type definitions.
Renamed --waitNextEventLoopTurnForUnhandledRejectionEvents to --waitForUnhandledRejections.
Security 1
The aliases are moved into the @jest scope so unrelated packages published under the alias names cannot shadow them.
Deprecations 3
A project config containing this option now warns instead of dropping it without notice.
A project config containing this global-only option now warns instead of silently ignoring it.
getCallsite is deprecated in favor of SourceMapSupport#getCallsite.
New APIs and options 53
The
@jest/expect-utilspackage now exports theAsymmetricMatchertype, which was previously private toexpect.CommonJS exports are available under the
module.exportsnamed export when imported from ESM, matching Node 23+.The
@jest/expect-utilspackage now exports theFunctionParameterstype, which was previously private toexpect.Snapshot failure details expose the path to the external
.snapfile for custom reporters.Assertion results now include retry messages, with nested causes and AggregateError sections rendered with code frames.
Set
entireDescribe: trueto retry a whole describe block, rerunning its hooks, child tests and nested describes on each attempt.Circus run results now include detailed unhandled errors, including cause chains and AggregateError entries with code frames.
Mock functions can configure chained mock behavior for specific argument lists, including asymmetric matchers; unmatched calls fall through to the base mock.
Selected tests in
--collectTestsoutput have a new flag indicating whether they would run.Custom runner configuration options can be specified using the tuple format ['runner-path', {options}].
Resolver callers can detect when a user-configured resolver only exports an async hook.
ScriptTransformer callers can choose the synchronous or asynchronous transform path.
ModuleMocker can clear every mock function exposed on a scope object.
Discover and list tests without executing them.
Exports the GlobalConfig TypeScript type.
Adds an error-checking helper to jest-util.
Accepts Temporal.Duration values.
Use jest.config.mts as a valid Jest configuration file.
Exports the ProjectConfig TypeScript type.
Set silent per project; the project-level value overrides the global value for that project's tests.
Set verbose per project; the project-level value overrides the global value for that project's tests.
Control how long workers are given to exit before being force-killed.
Adds a helper for type-safe Jest configuration.
Adds a method to configure how timers advance.
Adds a modern timers function that advances timers by the milliseconds needed to run callbacks scheduled with requestAnimationFrame.
Exports buildArgv from jest-cli.
Supports coverageReporters in project configuration.
Adds a babel-jest option to opt out of babel-preset-jest.
The new asymmetric matcher validates every element of an array against a condition or type.
The testEnvironmentOptions.globalsCleanup setting controls global cleanup mode: soft is the default, on enables cleanup, and off disables the feature.
Jest runtime supports import.meta.dirname.
Jest runtime supports import.meta.filename.
Jest runtime supports import.meta.resolve.
Jest config files can now be written in TypeScript.
Jest now ships this package to make it easier to compose a custom test environment based on jsdom.
Advances all pending requestAnimationFrame callbacks to the next frame boundary, helping test animations without guessing millisecond durations.
Jest can now load jest.config.cts files.
Registers a callback invoked whenever Jest generates a module mock, allowing the mock to be modified before it is returned to the test environment.
The retryImmediately option retries a failed test immediately instead of waiting until the entire test suite finishes.
The waitBeforeRetry option lets you specify a delay between retry attempts.
Jest spies can be declared with JavaScript's using syntax and are automatically restored when the block ends.
Adds an experimental API for finer control when unmocking modules, especially with native ESM.
Adds perfStats to surface test setup overhead.
Use protectProperties from jest-util to mark specific global objects as protected from globals cleanup.
Allows reporters in project configuration.
Custom objects can define a static SERIALIZABLE_PROPERTIES property to control which properties appear in snapshots and error messages.
The %$ placeholder in test.each titles is replaced with the test case's sequence number.
Adds a startedAt timestamp to the result object passed to onTestCaseResult.
Custom sequencers now receive additional
globalConfigandcontextscontext.Supports testTimeout in project configuration.
Loader options for TypeScript config files can be passed via a docblock comment.
This configuration flag controls the extra event-loop turn used to confirm a rejection remains unhandled; disabling it restores the previous behavior.
Adds a flag to reduce the performance impact of correct unhandled promise rejection detection.
Performance 8
Warm resolution cost is cut by reusing resolver factories and cached strings, and by avoiding Error construction for swallowed misses.
babel, semver, and synckit are loaded lazily, avoiding loading about 200 modules when requiring the package unless writing inline snapshots needs them.
Cached metadata is reused for files whose haste name is a known duplicate, avoiding repeated reads and parsing on startup.
Repeated work on the resolution hot path is reduced through memoization and skipped preparation when no moduleNameMapper is configured.
Per-require overhead is reduced by skipping unnecessary module ID resolution and manual-mock probes, sharing a require.cache proxy, and caching empty files.
The watchman socket path is cached and the version probe is replaced with get-sockname, so warm runs spawn no watchman processes.
Bundling Jest's internal modules into single files reduces the number of files loaded and improves startup performance.
Jest relies on unrs-resolver for module resolution, making it more feature-rich, standards-compliant, and faster; projects may see faster runs and lower memory use.
Behavior and default changes 32
When no transformer claims a .ts, .mts or .cts file, Jest strips its TypeScript types with Node.
A project config containing this global-only option now warns instead of silently ignoring it.
A project config containing this option now warns instead of dropping it without notice.
Inner errors and nested causes render with code frames and indentation, and are included in JSON output, retry reasons and reporter annotations.
Collection expands
test.eachanddescribe.eachcases, reports per-status counts and a summary line, and accounts for selected tests that would run.When multiple
--projectsare specified,--configis now used for the global config.On Node 24.9+, automocking and manual
__mocks__files apply to synchronously evaluable ESM graphs, including static imports, dynamic imports andrequire().Jest sets
import.meta.mainto true in the test file and false in modules it loads, matching Node 24+.The default resolver now honors Node's
--preserve-symlinksoption andNODE_PRESERVE_SYMLINKSenvironment variable.The parameter type now accepts
objectrather than onlyRecord<string, unknown>, allowing class instances.A custom resolver can now be written as an ES module.
Improves interop with __esModule/Babel default unwrapping, broader named-export coverage, and a shared CJS singleton across importers.
JSON failureMessages output now includes Error.cause.
Jest validates TC39 import attributes on ESM imports.
Accepts Temporal.Instant and Temporal.ZonedDateTime values.
Loads .js files with ESM syntax as native ESM even without a type:module marker.
Known global-only options now receive the message “is not supported in an individual project configuration” instead of “probably a typing mistake.”
Supports requiring ES modules on Node v24.9+.
On Node v24.9+, the .js-with-ESM-syntax fallback uses require(esm) when the CJS parser rejects ESM syntax.
On Node versions that support it, ES modules without top-level await use synchronous evaluate(); Jest prefers the synchronous transform path when a sync transformer is configured.
The now option accepts Temporal.Instant and Temporal.ZonedDateTime values.
pretty-formatnow printsDataViewin a human-readable way instead of showing internal fields.Snapshot serialization now includes an error's
causeproperty when present.The resolver supports file:// URLs as paths.
The default extensions now include
.mtsand.cts.Allows Node16, NodeNext, and Bundler moduleResolution in a project's tsconfig.
Official Jest packages now export themselves through the package
exportsfield, including ESM wrappers for ESM-context use.Jest loads a configuration file from the path provided in package.json.
Test files listed in setupFilesAfterEnv can now export an async function or use top-level await.
The default pattern now recognizes
.mjs,.cjs,.mts, and.ctsfiles as test files.When Node runs with type stripping enabled, Jest no longer requires a TypeScript loader.
Jest waits an extra event-loop turn before failing a test for a rejection, avoiding false failures when the promise is later caught.
Tooling 8
babel-jest can collect coverage from .mts files.
Fake timers can now fake Temporal.Now.*.
The matcher types now infer function parameter types more accurately and can surface compile-time errors for mismatched test arguments.
Jest now errors when flags requiring arguments, such as
--maxWorkersor--selectProjects, are given without a value.TypeScript config files can be loaded using esbuild-register via a docblock loader.
Support for import.meta.* and file:// was added when using native ESM with Jest.
Jest supports .mts and .cts files by default, without requiring extra configuration.
Jest is better at detecting and reporting open handles, helping identify tests that cause hangs or slow runs.
Fixes and other changes 44
The command reports the released version instead of the previous version.
Absolute Windows paths in sources and sourceRoot resolve as absolute paths instead of being appended to the transformed file's directory.
Cache keys report the released version instead of the previous version.
Table row keys are escaped before building the interpolation RegExp, so special characters in column names no longer cause errors or match incorrectly.
The config that supplies the global config no longer warns about global-only options.
Patterns are matched against the module specifier as written again.
Package imports specifiers such as #dep resolve under ESM again.
ES modules are keyed by full URL, so query and fragment suffixes create distinct module instances and appear in
import.meta.url, matching Node.The option is now honored when formatting
node:assertfailures instead of always collapsing the diff.This config entry is now recognized by
ValidConfigand no longer triggers a spurious unknown-option warning.When given an unresolvable module with
{virtual: true}, the error now points at the virtual option.JSON output now serializes bigint values in literal form, such as
4n, instead of failing the run.Return-type inference now considers all overloads, preserving Promise-returning overloads even when a later overload returns a non-Promise.
The resolver now handles the
module-syncexport condition so packages can resolve the same ESM entry point forrequire()as Node.Jest now populates
module.childrenwith the modules a file loads, matching Node.Mappings now apply consistently to both bare and
node:-prefixed spellings of core module specifiers.The test file itself now has a non-null
require.main.Injected globals are now bound to the correct values when
injectGlobalsis false.Generator test bodies now receive the shared test context, so
thisbehaves as it does in a regular test function.Mocks apply when the mocked file is directly required, async factories run once and rejected factories fail the import instead of crashing the worker, and mocks remain scoped to isolated modules.
Fixes named imports from CJS modules whose module.exports is a function with own-property exports.
Prevents jest-circus from crashing when asyncError is undefined for non-Error throws.
Project configurations can set collectCoverage without a validation warning.
Fixes deadlocks and double-evaluation during concurrent ESM and wasm imports.
Project configurations can set coverageProvider without a validation warning.
Fake timers convert Date values to milliseconds before passing them to @sinonjs/fake-timers.
Test-file imports resolve expect and @jest/expect from the internal module registry so they share the global expect's JestAssertionError.
Restores the missing error when import() is called after the Jest environment has been torn down.
Fixes the warning on Node 25+.
Applied when resolving modules with require.resolve() and the paths option.
Fixes Windows preset path resolution when the preset uses subpath exports.
Fixes incorrect code coverage in coverage reports when using the projects config option.
pretty-format supports React 19 so snapshots of React components work properly.
Fixes errors when require() is called after the Jest environment has been torn down.
Subset matching no longer throws when encountering exotic iterables.
No longer fails on structuredClone results due to cross-realm constructor mismatch.
Virtual registrations are now respected in ESM.
Fixes dynamic import when the Node option
--experimental-vm-modulesis specified.Console output is now displayed for the GHA reporter when
silent: false.Preserves CLI coverage output when using
--jsonwith--outputFile.Failed tests due to compilation errors are re-executed when
--onlyFailuresis used.Allows $keypath templates to use null or undefined values.
Improves argument type inference for test and describe callback functions using each tables.
Accepts readonly (as const) tables properly.
jest 2938 changes
Breaking changes 21
The
Bytestype is replaced withnumber.The undocumented
collectCoverageOnlyFromoption is removed.The ConvertAnsi plugin is removed from pretty-format; use jest-serializer-ansi-escapes instead.
The environment upgrades jsdom from v19 to v20; users of the environment need TypeScript 4.5 or newer.
This package is the stated replacement for the removed
ConvertAnsiplugin.The helper's default behavior changes to deep mocked.
The MaybeMocked utility type is no longer exported from jest-mock; use MockedShallow instead.
The MaybeMockedDeep utility type is no longer exported from jest-mock; use Mocked instead.
The
Millisecondstype is replaced withnumber.jest-mock exports Mocked in place of MaybeMockedDeep.
Only deep mocked variants of
MockedClassare exported.Only deep mocked variants of
MockedFunctionare exported.Only deep mocked variants of
MockedObjectare exported.jest-mock exports MockedShallow in place of MaybeMocked.
Support for Node versions 12 and 17 is dropped because both are EOL.
rootDiris now required as an argument toSnapshotState.The default snapshot formatting changes to {escapeString: false, printBasicPrototype: false}; set both options to true to keep the old behavior.
The default for
snapshotFormat.escapeStringchanges tofalse.The default for
snapshotFormat.printBasicPrototypechanges tofalse.The supported Node versions are 14.15, 16.10, 18.0 and above.
Support for
weak-napiis removed from the leak detector.
New APIs and options 7
Setting
compareKeystonullopts out of sorting object keys.Adds the
jest.Mockedutility type to@jest/globals.Adds the
jest.MockedClassutility type to@jest/globals.Adds the
jest.MockedFunctionutility type to@jest/globals.Adds the
jest.MockedObjectutility type to@jest/globals.Adds support for
test.failing.each.Adds an option that checks for worker memory leaks on Node 16.11.0 and later and recycles child workers as required.
Behavior and default changes 2
jsdom@20 adds support for crypto.getRandomValues(), allowing packages like uuid and nanoid to work without extra polyfills.
jest.mocked() now wraps deep member types by default; pass {shallow: true} for the former shallow behavior.
Tooling 1
The MatcherContext, MatcherUtils and MatcherState types are differentiated.
Fixes and other changes 7
Babel finds config when updating inline snapshots.
Adds proper support for CJS re-exports from dual packages.
Fixes deep equality of ImmutableJS Record.
Fixes parsing errors from inline snapshot files with JSX.
prettierPathis optional inSnapshotState.Fixes testing multiple projects with TypeScript config files.
When a process runs out of memory, the worker exits correctly instead of spinning indefinitely.
jest 28102 changes
Breaking changes 35
The browser boolean is removed from resolver options; use conditions: ['browser'] instead.
Child process workers default to advanced serialization.
The second argument to the jsdom environment constructor is mandatory.
The second argument to the node environment constructor is mandatory.
The Context type is no longer exported from jest-runtime; import it from @jest/test-result.
expect, jest-environment-jsdom, jest-environment-node, jest-phabricator, and jest-snapshot migrate to ESM.
Renamed to sandboxInjectedGlobals.
Replaces the timers configuration option.
Jest exits with status 1 if no tests are found with this flag.
HasteMap.create now returns a promise.
Replaces the name configuration option.
Removes the legacy isRegExpSupported export.
Removes the getTestEnvironment export.
No longer included in the default installation; users who need it must install it explicitly.
No longer included in the default installation; users who need it must install it explicitly.
Several exported utility types are renamed, and ArgumentsOf, ArgsType, and ConstructorArgumentsOf are removed in favor of TypeScript built-ins.
Renamed to runtime.
Using multiple configurations now throws an error instead of showing a warning.
The config option name is renamed to id.
Custom resolvers are called with core Node.js modules.
Drops support for Node 10 and Node 15.
Transform process() methods must always return structured data.
Transform processAsync() methods must always return structured data.
The requireResolveFunction argument is now mandatory.
Replaces the moduleLoader configuration option.
Runtime.createHasteMap now returns a promise.
Replaces the extraGlobals configuration option.
This long-deprecated configuration option is no longer normalized.
Use testEnvironmentOptions.url in place of the removed testURL configuration.
The testURL configuration option is removed; use testEnvironmentOptions.url instead.
The TestWatcher class moves from jest-core to the jest-watcher package.
The undocumented --timers option is removed.
The fake-timers configuration option is renamed to fakeTimers.
Raises the minimum supported TypeScript version to 4.3.
jest-worker accepts only absolute workerPath values.
Deprecations 1
The package is deprecated in favor of using v8 APIs directly.
New APIs and options 39
Allows timers to advance automatically.
The expect package exposes the AsymmetricMatchers interface.
Adds support for asynchronous resolvers, enabling tools like Vite to integrate better with Jest.
jest-resolve exposes the AsyncResolver type.
Exposes the CallbackTestRunner abstract class to help type third-party runners.
Exposes CallbackTestRunnerInterface to help type third-party runners.
Mock functions gain a contexts member.
babel-jest exports createTransformer; it is the only export from babel-jest.
Adds support for data URLs, allowing inline JavaScript to run without using eval.
Adds a duration property to JSON test output.
Exposes the EmittingTestRunner abstract class to help type third-party runners.
Exposes EmittingTestRunnerInterface to help type third-party runners.
The expect types now allow custom matchers to be added.
Exposes more of the underlying modern fake-timers implementation through configuration and runtime APIs.
Adds ci to the GlobalConfig type.
The project config is passed to globalSetup as its second argument.
The project config is passed to globalTeardown as its second argument.
Adds a CLI argument to ignore test suites by project name.
Provides access to jest through import.meta in ESM.
Allows test environment options to be set inline in a file.
New module that extends expect with jest-snapshot matchers.
New module exporting utilities for expect.
New module providing JSON schemas for Jest configuration.
jest.useFakeTimers() accepts an options bag.
jest-resolve exposes the JestResolver type.
The jsdom environment constructor receives global config.
The expect package exposes the MatcherFunction interface.
The expect package exposes the MatcherFunctionWithState interface.
pretty-format adds a maxWidth parameter.
Adds MessageChannel to node environment globals.
Adds MessageEvent to node environment globals.
jest-resolve exposes the PackageFilter type.
jest-resolve exposes the PackageJSON type.
jest-resolve exposes the PathFilter type.
Custom reporter constructors receive reporterContext as their third argument.
Exposes retainAllFiles to allow searching for tests in node_modules.
Adds a CLI option for running parts of a test suite across different machines.
Adds structuredClone to node environment globals.
jest-resolve exposes the SyncResolver type.
Behavior and default changes 17
Auto-mocking now supports async generator functions.
Supports dependencyExtractor implementations written in ESM.
Classes and functions are allowed as describe names.
jest-circus supports error logging before retry.
The node environment adds node and node-addon as default export conditions.
Adds full support for package exports, beyond the main entry point and packages without a main field.
Classes and functions are allowed as it names.
Defaults to the node crawler rather than shelling out to find when watchman is not enabled.
Calling jest.resetModules clears the filesystem and transform caches.
The default moduleFileExtensions now includes mjs and cjs.
Jest copies globals missing from the test environment from the global environment in which Jest runs.
jest-environment-node provides node and node-addons conditions; jest-environment-jsdom provides the browser condition.
jest-resolve supports package self-reference.
This long-deprecated configuration option is no longer normalized.
For CJS, setup files can export an async function, which Jest calls and awaits before loading tests.
The Summary Reporter can now be used as a stand-alone reporter.
Classes and functions are allowed as test names.
Tooling 3
Adds a reporter that uses GitHub Actions annotations to print test errors inline.
Improved type inference for functions passed to isMockFunction.
The usage of the jest.fn generic type argument is improved.
Fixes and other changes 7
Correctly detects CI environments and updates snapshots accordingly.
Calling expect.extend with invalid matchers throws a useful error.
The node environment constructor receives global config.
PatternPrompt takes entityName as its third constructor parameter instead of this._entityName.
babel-jest passes rootDir as root in Babel's options.
Fixes false positives when looking for an undefined prop.
Unref-ed subprocesses are no longer reported as open handles.
jest 27101 changes
Breaking changes 52
The returned function now returns a Promise.
A describe block must not return anything.
Tests that take a done callback and also have return values now fail.
The unused options argument is removed from the Env constructor.
The process exits with code 1 if a test logs after teardown.
It is now the inverse of expect.objectContaining(), as documented.
The enabledTestsMap config is removed; use filter instead.
jest-get-type is converted to an ES Module.
root moves into config, and getConsoleOutput requires GlobalConfig.
The deprecated, unused Runtime method is removed.
The global variable is no longer injected into the module wrapper.
Hooks and tests may return only a Promise, not other return values.
The deprecated function form of ignorePattern is no longer supported.
Prettier is optional for inline snapshots; Jest falls back to string replacement.
The unused isCoreModule option is removed.
jest-diff now uses only named exports.
The jest-runtime CLI moves to jest-repl.
The API passes an options bag instead of separate config and other options.
The API passes an options bag instead of multiple boolean options.
jest-worker now uses named exports.
This long-deprecated function was removed; use expect.extend instead.
The long-deprecated jest.addMatchers API is removed, along with jest.resetModuleRegistry and jest.runTimersToTime.
This long-deprecated function was removed; use jest.resetModules instead.
This long-deprecated function was removed; use jest.advanceTimersByTime instead.
The modern fake timers implementation becomes the default; call jest.useFakeTimers("legacy") to use the old implementation.
The deprecated mapCoverage option is removed.
matcherResult on JestAssertionError is now a string rather than a function.
The default file extension order changes by moving json behind ts and tsx.
Tests fail when multiple done() calls are made.
jest-each ignores excess words in headings.
Support for Node 13 was dropped.
node-notifier becomes a peer dependency of jest-reporters.
Jest supports only Node LTS releases and Node 15.
An exports field is added to all package.json files.
Packages migrated to ESM-style exports may require consumers to adjust imports, such as using a default import for pretty-format.
recursiveBlacklist is removed in favor of recursiveDenylist.
Jest disables jest-pnp-resolver for Yarn 2.
The function always returns a Promise, and its third parameter is now RequireAndTranspileModuleOptions, which accepts applyInteropRequireDefault.
Transforms are run over runner and testRunner modules.
Modules specified in this configuration option are now transformed like the rest of your code.
Test environments no longer support runScript.
ScriptTransformer is no longer exported; use the asynchronous createScriptTransformer function.
The JSDOM environment no longer provides the Node globals setImmediate and clearImmediate.
Modules specified in this configuration option are now transformed like the rest of your code.
The default test environment changes from jsdom to node; projects using DOM APIs can configure jsdom or use per-file environment configuration.
Modules specified in this configuration option are now transformed like the rest of your code.
The default test runner changes from jest-jasmine2 to jest-circus; projects relying on Jasmine-specific APIs may need to opt back in.
Modules specified in this configuration option are now transformed like the rest of your code.
The TestScheduler export is replaced with createTestScheduler.
Modern fake timers become the default; configure timers as legacy to retain the old implementation when enabling fake timers globally.
toContain is stricter about the received value's type.
Some TypeScript types are stricter.
New APIs and options 17
AbortController is available in the Node environment globals.
AbortController is added to the Node environment globals.
requireOrImportModule accepts an applyInteropRequireDefault option.
Jest transformers support asynchronous code transformations.
babel-jest supports asynchronous transformation.
jest-worker supports custom task queues and provides a PriorityQueue implementation.
This option makes jest-haste-map follow symlinks for test files.
ESM can be used for the test environment.
jest-config allows this option to be passed through to jest-haste-map.
A custom HasteMap class implementation can now be configured.
jest-worker adds an in-order scheduling policy.
jest-each supports interpolation with object properties.
LogEntry is exported.
This option controls whether prototypes are printed for raw objects or arrays.
The programmatic API can run multiple projects.
A utility for importing CJS or ESM is added.
All reporters gain a static filepath property.
Performance 2
Reading and parsing package.json files is cached.
Initialization per test file is roughly 70% faster than in Jest 26, though the improvement may be less noticeable in many projects.
Behavior and default changes 17
ESM is supported for files other than .js and .mjs.
globalSetup and globalTeardown files written in ESM are supported.
Inline snapshots can now be used without Prettier.
Presets written in ESM are supported.
Jest config options are passed to transformer process and getCacheKey functions.
Reporters written in ESM are supported.
Runners written in ESM are supported.
Test files symlinked into the test directory can now be handled.
Interpolation supports array indices and object properties; percent signs and excess heading words are handled differently.
Test environments written in ESM are supported.
Test runners written in ESM are supported.
More TestSequencer methods can be asynchronous.
Test sequencers written in ESM are supported.
TestWatcher now extends emittery.
Transforms can now be asynchronous, enabling effective transpilation through tools such as esbuild, Snowpack, and Vite.
Transformers written in ESM are supported.
Watch plugins written in ESM are supported.
Tooling 4
Asynchronous code transformations are supported.
Custom runners, reporters, watch plugins, and other modules can be loaded as ES modules.
Interactive mode can now step through failed tests one at a time, in addition to reviewing and updating failed snapshots.
Transpiled transformers are supported.
Fixes and other changes 9
jest-changed-files uses -- to separate paths from revisions.
console.dir now respects its second argument correctly.
beforeAll and afterAll hooks inside skipped describe blocks are no longer executed.
The global module registry no longer leaks into the isolateModules registry.
CJS reexports are detected as named exports in ESM.
Jest throws the correct error when attempting to load ESM through require.
testLocation is fixed on Windows when using test.each.
Array indices are supported with template strings.
The configured failure exit code is used when bailing from a failed test.
jest 2618 changes
Breaking changes 10
Throws a proper error if a test or hook is defined asynchronously.
Removes support for the browser field.
Removes build-es5 from the expect, jest-mock, and pretty-format packages.
jest-environment-jsdom upgrades jsdom to v16, which may affect tests that depend on jsdom behavior.
Renames LolexFakeTimers to ModernFakeTimers.
Jest drops support for Node 8.
Removes providesModuleNodeModules.
Removes the long-deprecated require.requireActual method.
Removes the long-deprecated require.requireMock method.
Aligns test execution order with jasmine's top-to-bottom order.
New APIs and options 2
Adds createMockFromModule as an alias for genMockFromModule.
Adds the possibility of using a modern fake timers implementation backed by @sinonjs/fake-timers.
Fixes and other changes 6
Files are no longer reported as changed when they are only accessed.
Handles null being passed to createTransformer.
Provides a more descriptive error when a hook is defined inside a test.
Shows a relative path from the root directory in module not found errors.
Fixes a bug involving absolute paths in moduleNameMapper and jest.mock.
Fixes time formatting duration and consolidates time formatting code.