unstale

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 init

@unstale/cli on npm

jest 30196 changes

Breaking changes 47

  • Module mocks instantiated inside an isolated block are now scoped to that block instead of outliving it.

    30.5.0release notes

  • Calls to module.register() and module.registerHooks() inside a test now throw an actionable error because their hooks cannot affect sandboxed requires.

    30.5.0release notes

  • Watched files now match full extensions, so moduleFileExtensions: ['js'] no longer accepts foo.mjs.

    30.5.0release notes

  • 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.

    30.5.0release notes

  • When importing CJS from ESM, module.exports is always the ESM default; __esModule unwrapping is no longer applied, aligning behavior with Node.

    30.4.1release notes

  • The global coverage threshold now applies to unmatched pattern files in addition to glob and path thresholds.

    30.4.0release notes

  • pretty-format now prints ArrayBuffer in a human-readable way instead of showing internal fields.

    30.0.0upgrade guide

  • Adds type inference for function parameters in CalledWith assertions.

    30.0.0release notes

  • Adds an ESM wrapper for all Jest modules.

    30.0.0release notes

  • Various expect aliases were removed; use the migration guidance and eslint-plugin-jest autofixer to update affected code.

    30.0.0upgrade guide

  • Custom filter functions must return an object with a filtered array instead of returning an array directly.

    30.0.0upgrade guide

  • The glob v10 upgrade may change pattern syntax and behavior, including brace expansions and extglobs, so some custom patterns may need adjustment.

    30.0.0upgrade guiderelease notes

  • Renamed globalsCleanupMode to globalsCleanup.

    30.0.0release notes

  • Bundling internal modules into single files means unofficial deep-import paths may no longer exist; use public APIs or documented interfaces.

    30.0.0upgrade guide

  • The package now uses JSDOM v26, which may introduce behavior changes in the DOM environment.

    30.0.0upgrade guideupgrade guide

  • Upgrades JSDOM to v22.

    30.0.0release notes

  • The interactive configuration initialization command was removed; use a package-manager create command to scaffold a config.

    30.0.0upgrade guiderelease notes

  • The legacy mock-generation function was removed; use jest.createMockFromModule instead.

    30.0.0upgrade guiderelease notes

  • Removes the deprecated jest.genMockFromModule API.

    30.0.0release notes

  • Module paths passed to jest.mock() must now match case exactly.

    30.0.0upgrade guide

  • This alias matcher was removed; use toHaveBeenLastCalledWith instead.

    30.0.0upgrade guiderelease notes

  • This alias matcher was removed; use toHaveLastReturnedWith instead.

    30.0.0upgrade guiderelease notes

  • This mock-function type was removed from the public API.

    30.0.0upgrade guiderelease notes

  • Jest 30 drops support for Node 14, 16, 19, and 21; the minimum supported Node version is 18.x.

    30.0.0upgrade guideupgrade guide

  • Drops support for Node.js versions 14, 16, 19, 21, and 23.

    30.0.0release notes

  • Object matchers now exclude non-enumerable properties by default, which can affect expect.objectContaining and equality checks.

    30.0.0upgrade guideupgrade guide

  • This alias matcher was removed; use toHaveBeenNthCalledWith instead.

    30.0.0upgrade guiderelease notes

  • This alias matcher was removed; use toHaveNthReturnedWith instead.

    30.0.0upgrade guiderelease notes

  • The React snapshot serializer omits empty string children instead of rendering them in snapshot output.

    30.0.0upgrade guiderelease notes

  • Constructing a Runtime now requires a globalConfig parameter.

    30.0.0upgrade guiderelease notes

  • Snapshot printing changed, including replacement of deprecated goo.gl links, so existing snapshots may need updating.

    30.0.0upgrade guide

  • This mock-function type was removed from the public API; use jest.Spied instead.

    30.0.0upgrade guiderelease notes

  • Fixes the type of the testFailureExitCode configuration option.

    30.0.0release notes

  • The default testMatch option changes to support mjs, cjs, mts, and cts.

    30.0.0release notes

  • The path-filtering flag is now plural and accepts multiple patterns separated by spaces or by repeating the flag.

    30.0.0upgrade guideupgrade guiderelease notes

  • Programmatic watch-mode callers must construct a TestPathPatterns instance instead of passing testPathPattern.

    30.0.0upgrade guiderelease notes

  • Replaces testPathPattern with testPathPatterns, which accepts a list of patterns instead of a regex.

    30.0.0release notes

  • The default testRegex option changes to support mjs, cjs, mts, and cts.

    30.0.0release notes

  • This alias matcher was removed; use toHaveBeenCalled instead.

    30.0.0upgrade guiderelease notes

  • This alias matcher was removed; use toHaveBeenCalledTimes instead.

    30.0.0upgrade guiderelease notes

  • This alias matcher was removed; use toHaveBeenCalledWith instead.

    30.0.0upgrade guiderelease notes

  • This alias matcher was removed; use toHaveReturned instead.

    30.0.0upgrade guiderelease notes

  • This alias matcher was removed; use toHaveReturnedTimes instead.

    30.0.0upgrade guiderelease notes

  • This alias matcher was removed; use toHaveReturnedWith instead.

    30.0.0upgrade guiderelease notes

  • This alias matcher was removed; use toThrow instead.

    30.0.0upgrade guiderelease notes

  • The minimum TypeScript version is now 5.4 for users of Jest type definitions.

    26.0.0, 30.0.0upgrade guiderelease notesupgrade guiderelease notes

  • Renamed --waitNextEventLoopTurnForUnhandledRejectionEvents to --waitForUnhandledRejections.

    30.0.0release notes

Security 1

  • The aliases are moved into the @jest scope so unrelated packages published under the alias names cannot shadow them.

    30.5.0release notes

Deprecations 3

  • A project config containing this option now warns instead of dropping it without notice.

    30.5.1release notes

  • A project config containing this global-only option now warns instead of silently ignoring it.

    30.5.1release notes

  • getCallsite is deprecated in favor of SourceMapSupport#getCallsite.

    30.5.0release notes

New APIs and options 53

  • The @jest/expect-utils package now exports the AsymmetricMatcher type, which was previously private to expect.

    30.5.0release notes

  • CommonJS exports are available under the module.exports named export when imported from ESM, matching Node 23+.

    30.5.0release notes

  • The @jest/expect-utils package now exports the FunctionParameters type, which was previously private to expect.

    30.5.0release notes

  • Snapshot failure details expose the path to the external .snap file for custom reporters.

    30.5.0release notes

  • Assertion results now include retry messages, with nested causes and AggregateError sections rendered with code frames.

    30.5.0release notes

  • Set entireDescribe: true to retry a whole describe block, rerunning its hooks, child tests and nested describes on each attempt.

    30.5.0release notes

  • Circus run results now include detailed unhandled errors, including cause chains and AggregateError entries with code frames.

    30.5.0release notes

  • Mock functions can configure chained mock behavior for specific argument lists, including asymmetric matchers; unmatched calls fall through to the base mock.

    30.5.0release notes

  • Selected tests in --collectTests output have a new flag indicating whether they would run.

    30.5.0release notes

  • Custom runner configuration options can be specified using the tuple format ['runner-path', {options}].

    30.4.1release notes

  • Resolver callers can detect when a user-configured resolver only exports an async hook.

    30.4.0release notes

  • ScriptTransformer callers can choose the synchronous or asynchronous transform path.

    30.4.0release notes

  • ModuleMocker can clear every mock function exposed on a scope object.

    30.4.0release notes

  • Discover and list tests without executing them.

    30.4.0release notes

  • Exports the GlobalConfig TypeScript type.

    30.4.0release notes

  • Adds an error-checking helper to jest-util.

    30.4.0release notes

  • Accepts Temporal.Duration values.

    30.4.0release notes

  • Use jest.config.mts as a valid Jest configuration file.

    30.4.0release notes

  • Exports the ProjectConfig TypeScript type.

    30.4.0release notes

  • Set silent per project; the project-level value overrides the global value for that project's tests.

    30.4.0release notes

  • Set verbose per project; the project-level value overrides the global value for that project's tests.

    30.4.0release notes

  • Control how long workers are given to exit before being force-killed.

    30.4.0release notes

  • Adds a helper for type-safe Jest configuration.

    30.3.0release notes

  • Adds a method to configure how timers advance.

    30.3.0release notes

  • Adds a modern timers function that advances timers by the milliseconds needed to run callbacks scheduled with requestAnimationFrame.

    30.0.0release notes

  • Exports buildArgv from jest-cli.

    30.0.0release notes

  • Supports coverageReporters in project configuration.

    30.0.0release notes

  • Adds a babel-jest option to opt out of babel-preset-jest.

    30.0.0release notes

  • The new asymmetric matcher validates every element of an array against a condition or type.

    30.0.0upgrade guiderelease notes

  • The testEnvironmentOptions.globalsCleanup setting controls global cleanup mode: soft is the default, on enables cleanup, and off disables the feature.

    30.0.0upgrade guide

  • Jest runtime supports import.meta.dirname.

    30.0.0release notes

  • Jest runtime supports import.meta.filename.

    30.0.0release notes

  • Jest runtime supports import.meta.resolve.

    30.0.0release notes

  • Jest config files can now be written in TypeScript.

    30.0.0upgrade guide

  • Jest now ships this package to make it easier to compose a custom test environment based on jsdom.

    30.0.0upgrade guiderelease notes

  • Advances all pending requestAnimationFrame callbacks to the next frame boundary, helping test animations without guessing millisecond durations.

    30.0.0upgrade guide

  • Jest can now load jest.config.cts files.

    30.0.0release notes

  • Registers a callback invoked whenever Jest generates a module mock, allowing the mock to be modified before it is returned to the test environment.

    30.0.0upgrade guiderelease notes

  • The retryImmediately option retries a failed test immediately instead of waiting until the entire test suite finishes.

    30.0.0upgrade guiderelease notes

  • The waitBeforeRetry option lets you specify a delay between retry attempts.

    30.0.0upgrade guiderelease notes

  • Jest spies can be declared with JavaScript's using syntax and are automatically restored when the block ends.

    30.0.0upgrade guiderelease notes

  • Adds an experimental API for finer control when unmocking modules, especially with native ESM.

    30.0.0upgrade guiderelease notes

  • Adds perfStats to surface test setup overhead.

    30.0.0release notes

  • Use protectProperties from jest-util to mark specific global objects as protected from globals cleanup.

    30.0.0upgrade guide

  • Allows reporters in project configuration.

    30.0.0release notes

  • Custom objects can define a static SERIALIZABLE_PROPERTIES property to control which properties appear in snapshots and error messages.

    30.0.0upgrade guiderelease notes

  • The %$ placeholder in test.each titles is replaced with the test case's sequence number.

    30.0.0upgrade guiderelease notes

  • Adds a startedAt timestamp to the result object passed to onTestCaseResult.

    30.0.0release notes

  • Custom sequencers now receive additional globalConfig and contexts context.

    30.0.0upgrade guiderelease notes

  • Supports testTimeout in project configuration.

    30.0.0release notes

  • Loader options for TypeScript config files can be passed via a docblock comment.

    30.0.0release notes

  • This configuration flag controls the extra event-loop turn used to confirm a rejection remains unhandled; disabling it restores the previous behavior.

    30.0.0upgrade guide

  • Adds a flag to reduce the performance impact of correct unhandled promise rejection detection.

    30.0.0release notes

Performance 8

  • Warm resolution cost is cut by reusing resolver factories and cached strings, and by avoiding Error construction for swallowed misses.

    30.5.0release notes

  • babel, semver, and synckit are loaded lazily, avoiding loading about 200 modules when requiring the package unless writing inline snapshots needs them.

    30.5.0release notes

  • Cached metadata is reused for files whose haste name is a known duplicate, avoiding repeated reads and parsing on startup.

    30.5.0release notes

  • Repeated work on the resolution hot path is reduced through memoization and skipped preparation when no moduleNameMapper is configured.

    30.5.0release notes

  • Per-require overhead is reduced by skipping unnecessary module ID resolution and manual-mock probes, sharing a require.cache proxy, and caching empty files.

    30.5.0release notes

  • The watchman socket path is cached and the version probe is replaced with get-sockname, so warm runs spawn no watchman processes.

    30.5.0release notes

  • Bundling Jest's internal modules into single files reduces the number of files loaded and improves startup performance.

    30.0.0upgrade guide

  • 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.

    30.0.0upgrade guide

Behavior and default changes 32

  • When no transformer claims a .ts, .mts or .cts file, Jest strips its TypeScript types with Node.

    30.5.2release notesupgrade guide

  • A project config containing this global-only option now warns instead of silently ignoring it.

    30.5.1release notes

  • A project config containing this option now warns instead of dropping it without notice.

    30.5.1release notes

  • Inner errors and nested causes render with code frames and indentation, and are included in JSON output, retry reasons and reporter annotations.

    30.5.0release notes

  • Collection expands test.each and describe.each cases, reports per-status counts and a summary line, and accounts for selected tests that would run.

    30.5.0release notes

  • When multiple --projects are specified, --config is now used for the global config.

    30.5.0release notes

  • On Node 24.9+, automocking and manual __mocks__ files apply to synchronously evaluable ESM graphs, including static imports, dynamic imports and require().

    30.5.0release notes

  • Jest sets import.meta.main to true in the test file and false in modules it loads, matching Node 24+.

    30.5.0release notes

  • The default resolver now honors Node's --preserve-symlinks option and NODE_PRESERVE_SYMLINKS environment variable.

    30.5.0release notes

  • The parameter type now accepts object rather than only Record<string, unknown>, allowing class instances.

    30.5.0release notes

  • A custom resolver can now be written as an ES module.

    30.5.0release notes

  • Improves interop with __esModule/Babel default unwrapping, broader named-export coverage, and a shared CJS singleton across importers.

    30.4.0release notes

  • JSON failureMessages output now includes Error.cause.

    30.4.0release notes

  • Jest validates TC39 import attributes on ESM imports.

    30.4.0release notes

  • Accepts Temporal.Instant and Temporal.ZonedDateTime values.

    30.4.0release notes

  • Loads .js files with ESM syntax as native ESM even without a type:module marker.

    30.4.0release notes

  • Known global-only options now receive the message “is not supported in an individual project configuration” instead of “probably a typing mistake.”

    30.4.0release notes

  • Supports requiring ES modules on Node v24.9+.

    30.4.0release notes

  • On Node v24.9+, the .js-with-ESM-syntax fallback uses require(esm) when the CJS parser rejects ESM syntax.

    30.4.0release notes

  • 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.

    30.4.0release notes

  • The now option accepts Temporal.Instant and Temporal.ZonedDateTime values.

    30.4.0release notes

  • pretty-format now prints DataView in a human-readable way instead of showing internal fields.

    30.0.0upgrade guide

  • Snapshot serialization now includes an error's cause property when present.

    30.0.0upgrade guide

  • The resolver supports file:// URLs as paths.

    30.0.0release notes

  • The default extensions now include .mts and .cts.

    30.0.0upgrade guiderelease notes

  • Allows Node16, NodeNext, and Bundler moduleResolution in a project's tsconfig.

    30.0.0release notes

  • Official Jest packages now export themselves through the package exports field, including ESM wrappers for ESM-context use.

    30.0.0upgrade guide

  • Jest loads a configuration file from the path provided in package.json.

    30.0.0release notes

  • Test files listed in setupFilesAfterEnv can now export an async function or use top-level await.

    30.0.0upgrade guiderelease notes

  • The default pattern now recognizes .mjs, .cjs, .mts, and .cts files as test files.

    30.0.0upgrade guide

  • When Node runs with type stripping enabled, Jest no longer requires a TypeScript loader.

    30.0.0release notes

  • Jest waits an extra event-loop turn before failing a test for a rejection, avoiding false failures when the promise is later caught.

    30.0.0upgrade guideupgrade guide

Tooling 8

  • babel-jest can collect coverage from .mts files.

    30.4.0release notes

  • Fake timers can now fake Temporal.Now.*.

    30.4.0release notes

  • The matcher types now infer function parameter types more accurately and can surface compile-time errors for mismatched test arguments.

    30.0.0upgrade guide

  • Jest now errors when flags requiring arguments, such as --maxWorkers or --selectProjects, are given without a value.

    30.0.0upgrade guide

  • TypeScript config files can be loaded using esbuild-register via a docblock loader.

    30.0.0release notes

  • Support for import.meta.* and file:// was added when using native ESM with Jest.

    30.0.0upgrade guide

  • Jest supports .mts and .cts files by default, without requiring extra configuration.

    30.0.0upgrade guide

  • Jest is better at detecting and reporting open handles, helping identify tests that cause hangs or slow runs.

    30.0.0upgrade guide

Fixes and other changes 44

  • The command reports the released version instead of the previous version.

    30.5.2release notes

  • Absolute Windows paths in sources and sourceRoot resolve as absolute paths instead of being appended to the transformed file's directory.

    30.5.2release notes

  • Cache keys report the released version instead of the previous version.

    30.5.2release notes

  • Table row keys are escaped before building the interpolation RegExp, so special characters in column names no longer cause errors or match incorrectly.

    30.5.2release notes

  • The config that supplies the global config no longer warns about global-only options.

    30.5.1release notes

  • Patterns are matched against the module specifier as written again.

    30.5.1release notes

  • Package imports specifiers such as #dep resolve under ESM again.

    30.5.1release notes

  • ES modules are keyed by full URL, so query and fragment suffixes create distinct module instances and appear in import.meta.url, matching Node.

    30.5.0release notes

  • The option is now honored when formatting node:assert failures instead of always collapsing the diff.

    30.5.0release notes

  • This config entry is now recognized by ValidConfig and no longer triggers a spurious unknown-option warning.

    30.5.0release notes

  • When given an unresolvable module with {virtual: true}, the error now points at the virtual option.

    30.5.0release notes

  • JSON output now serializes bigint values in literal form, such as 4n, instead of failing the run.

    30.5.0release notes

  • Return-type inference now considers all overloads, preserving Promise-returning overloads even when a later overload returns a non-Promise.

    30.5.0release notes

  • The resolver now handles the module-sync export condition so packages can resolve the same ESM entry point for require() as Node.

    30.5.0release notes

  • Jest now populates module.children with the modules a file loads, matching Node.

    30.5.0release notes

  • Mappings now apply consistently to both bare and node:-prefixed spellings of core module specifiers.

    30.5.0release notes

  • The test file itself now has a non-null require.main.

    30.5.0release notes

  • Injected globals are now bound to the correct values when injectGlobals is false.

    30.5.0release notes

  • Generator test bodies now receive the shared test context, so this behaves as it does in a regular test function.

    30.5.0release notes

  • 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.

    30.5.0release notes

  • Fixes named imports from CJS modules whose module.exports is a function with own-property exports.

    30.4.2release notes

  • Prevents jest-circus from crashing when asyncError is undefined for non-Error throws.

    30.4.0release notes

  • Project configurations can set collectCoverage without a validation warning.

    30.4.0release notes

  • Fixes deadlocks and double-evaluation during concurrent ESM and wasm imports.

    30.4.0release notes

  • Project configurations can set coverageProvider without a validation warning.

    30.4.0release notes

  • Fake timers convert Date values to milliseconds before passing them to @sinonjs/fake-timers.

    30.4.0release notes

  • Test-file imports resolve expect and @jest/expect from the internal module registry so they share the global expect's JestAssertionError.

    30.4.0release notes

  • Restores the missing error when import() is called after the Jest environment has been torn down.

    30.4.0release notes

  • Fixes the warning on Node 25+.

    30.4.0release notes

  • Applied when resolving modules with require.resolve() and the paths option.

    30.4.0release notes

  • Fixes Windows preset path resolution when the preset uses subpath exports.

    30.4.0release notes

  • Fixes incorrect code coverage in coverage reports when using the projects config option.

    30.4.0release notes

  • pretty-format supports React 19 so snapshots of React components work properly.

    30.4.0release notes

  • Fixes errors when require() is called after the Jest environment has been torn down.

    30.4.0release notes

  • Subset matching no longer throws when encountering exotic iterables.

    30.4.0release notes

  • No longer fails on structuredClone results due to cross-realm constructor mismatch.

    30.4.0release notes

  • Virtual registrations are now respected in ESM.

    30.4.0release notes

  • Fixes dynamic import when the Node option --experimental-vm-modules is specified.

    30.3.0release notes

  • Console output is now displayed for the GHA reporter when silent: false.

    30.3.0release notes

  • Preserves CLI coverage output when using --json with --outputFile.

    30.3.0release notes

  • Failed tests due to compilation errors are re-executed when --onlyFailures is used.

    30.3.0release notes

  • Allows $keypath templates to use null or undefined values.

    30.0.0release notes

  • Improves argument type inference for test and describe callback functions using each tables.

    30.0.0release notes

  • Accepts readonly (as const) tables properly.

    30.0.0release notes

jest 2938 changes

Breaking changes 21

  • The Bytes type is replaced with number.

    29.0.0release notes

  • The undocumented collectCoverageOnlyFrom option is removed.

    29.0.0release notes

  • The ConvertAnsi plugin is removed from pretty-format; use jest-serializer-ansi-escapes instead.

    29.0.0upgrade guiderelease notes

  • The environment upgrades jsdom from v19 to v20; users of the environment need TypeScript 4.5 or newer.

    29.0.0upgrade guideupgrade guiderelease notes

  • This package is the stated replacement for the removed ConvertAnsi plugin.

    29.0.0release notes

  • The helper's default behavior changes to deep mocked.

    29.0.0release notes

  • The MaybeMocked utility type is no longer exported from jest-mock; use MockedShallow instead.

    29.0.0upgrade guide

  • The MaybeMockedDeep utility type is no longer exported from jest-mock; use Mocked instead.

    29.0.0upgrade guiderelease notes

  • The Milliseconds type is replaced with number.

    29.0.0release notes

  • jest-mock exports Mocked in place of MaybeMockedDeep.

    29.0.0upgrade guide

  • Only deep mocked variants of MockedClass are exported.

    29.0.0release notes

  • Only deep mocked variants of MockedFunction are exported.

    29.0.0release notes

  • Only deep mocked variants of MockedObject are exported.

    29.0.0release notes

  • jest-mock exports MockedShallow in place of MaybeMocked.

    29.0.0upgrade guiderelease notes

  • Support for Node versions 12 and 17 is dropped because both are EOL.

    29.0.0upgrade guiderelease notes

  • rootDir is now required as an argument to SnapshotState.

    29.0.0release notes

  • The default snapshot formatting changes to {escapeString: false, printBasicPrototype: false}; set both options to true to keep the old behavior.

    29.0.0upgrade guideupgrade guide

  • The default for snapshotFormat.escapeString changes to false.

    29.0.0release notes

  • The default for snapshotFormat.printBasicPrototype changes to false.

    29.0.0release notes

  • The supported Node versions are 14.15, 16.10, 18.0 and above.

    29.0.0upgrade guide

  • Support for weak-napi is removed from the leak detector.

    29.0.0release notes

New APIs and options 7

  • Setting compareKeys to null opts out of sorting object keys.

    29.0.0release notes

  • Adds the jest.Mocked utility type to @jest/globals.

    29.0.0release notes

  • Adds the jest.MockedClass utility type to @jest/globals.

    29.0.0release notes

  • Adds the jest.MockedFunction utility type to @jest/globals.

    29.0.0release notes

  • Adds the jest.MockedObject utility type to @jest/globals.

    29.0.0release notes

  • Adds support for test.failing.each.

    29.0.0release notes

  • Adds an option that checks for worker memory leaks on Node 16.11.0 and later and recycles child workers as required.

    29.0.0release notes

Behavior and default changes 2

  • jsdom@20 adds support for crypto.getRandomValues(), allowing packages like uuid and nanoid to work without extra polyfills.

    29.0.0upgrade guide

  • jest.mocked() now wraps deep member types by default; pass {shallow: true} for the former shallow behavior.

    29.0.0upgrade guide

Tooling 1

  • The MatcherContext, MatcherUtils and MatcherState types are differentiated.

    29.0.0release notes

Fixes and other changes 7

  • Babel finds config when updating inline snapshots.

    29.0.0release notes

  • Adds proper support for CJS re-exports from dual packages.

    29.0.0release notes

  • Fixes deep equality of ImmutableJS Record.

    29.0.0release notes

  • Fixes parsing errors from inline snapshot files with JSX.

    29.0.0release notes

  • prettierPath is optional in SnapshotState.

    29.0.0release notes

  • Fixes testing multiple projects with TypeScript config files.

    29.0.0release notes

  • When a process runs out of memory, the worker exits correctly instead of spinning indefinitely.

    29.0.0release notes

jest 28102 changes

Breaking changes 35

  • The browser boolean is removed from resolver options; use conditions: ['browser'] instead.

    28.0.0release notes

  • Child process workers default to advanced serialization.

    28.0.0release notes

  • The second argument to the jsdom environment constructor is mandatory.

    28.0.0release notes

  • The second argument to the node environment constructor is mandatory.

    28.0.0release notes

  • The Context type is no longer exported from jest-runtime; import it from @jest/test-result.

    28.0.0release notes

  • expect, jest-environment-jsdom, jest-environment-node, jest-phabricator, and jest-snapshot migrate to ESM.

    28.0.0release notes

  • Renamed to sandboxInjectedGlobals.

    28.0.0release notes

  • Replaces the timers configuration option.

    28.0.0release notes

  • Jest exits with status 1 if no tests are found with this flag.

    28.0.0release notes

  • HasteMap.create now returns a promise.

    28.0.0release notes

  • Replaces the name configuration option.

    28.0.0release notes

  • Removes the legacy isRegExpSupported export.

    28.0.0release notes

  • Removes the getTestEnvironment export.

    28.0.0release notes

  • No longer included in the default installation; users who need it must install it explicitly.

    28.0.0upgrade guiderelease notes

  • No longer included in the default installation; users who need it must install it explicitly.

    28.0.0upgrade guiderelease notes

  • Several exported utility types are renamed, and ArgumentsOf, ArgsType, and ConstructorArgumentsOf are removed in favor of TypeScript built-ins.

    28.0.0release notes

  • Renamed to runtime.

    28.0.0release notes

  • Using multiple configurations now throws an error instead of showing a warning.

    28.0.0release notes

  • The config option name is renamed to id.

    28.0.0release notes

  • Custom resolvers are called with core Node.js modules.

    28.0.0release notes

  • Drops support for Node 10 and Node 15.

    28.0.0upgrade guiderelease notes

  • Transform process() methods must always return structured data.

    28.0.0release notes

  • Transform processAsync() methods must always return structured data.

    28.0.0release notes

  • The requireResolveFunction argument is now mandatory.

    28.0.0release notes

  • Replaces the moduleLoader configuration option.

    28.0.0release notes

  • Runtime.createHasteMap now returns a promise.

    28.0.0release notes

  • Replaces the extraGlobals configuration option.

    28.0.0release notes

  • This long-deprecated configuration option is no longer normalized.

    28.0.0release notes

  • Use testEnvironmentOptions.url in place of the removed testURL configuration.

    28.0.0release notes

  • The testURL configuration option is removed; use testEnvironmentOptions.url instead.

    28.0.0release notes

  • The TestWatcher class moves from jest-core to the jest-watcher package.

    28.0.0release notes

  • The undocumented --timers option is removed.

    28.0.0release notes

  • The fake-timers configuration option is renamed to fakeTimers.

    28.0.0release notes

  • Raises the minimum supported TypeScript version to 4.3.

    28.0.0upgrade guiderelease notes

  • jest-worker accepts only absolute workerPath values.

    28.0.0release notes

Deprecations 1

  • The package is deprecated in favor of using v8 APIs directly.

    28.0.0release notes

New APIs and options 39

  • Allows timers to advance automatically.

    28.0.0upgrade guide

  • The expect package exposes the AsymmetricMatchers interface.

    28.0.0release notes

  • Adds support for asynchronous resolvers, enabling tools like Vite to integrate better with Jest.

    28.0.0upgrade guiderelease notes

  • jest-resolve exposes the AsyncResolver type.

    28.0.0release notes

  • Exposes the CallbackTestRunner abstract class to help type third-party runners.

    28.0.0release notes

  • Exposes CallbackTestRunnerInterface to help type third-party runners.

    28.0.0release notes

  • Mock functions gain a contexts member.

    28.0.0release notes

  • babel-jest exports createTransformer; it is the only export from babel-jest.

    28.0.0release notes

  • Adds support for data URLs, allowing inline JavaScript to run without using eval.

    28.0.0upgrade guiderelease notes

  • Adds a duration property to JSON test output.

    28.0.0release notes

  • Exposes the EmittingTestRunner abstract class to help type third-party runners.

    28.0.0release notes

  • Exposes EmittingTestRunnerInterface to help type third-party runners.

    28.0.0release notes

  • The expect types now allow custom matchers to be added.

    28.0.0upgrade guide

  • Exposes more of the underlying modern fake-timers implementation through configuration and runtime APIs.

    28.0.0upgrade guide

  • Adds ci to the GlobalConfig type.

    28.0.0release notes

  • The project config is passed to globalSetup as its second argument.

    28.0.0release notes

  • The project config is passed to globalTeardown as its second argument.

    28.0.0release notes

  • Adds a CLI argument to ignore test suites by project name.

    28.0.0release notes

  • Provides access to jest through import.meta in ESM.

    28.0.0upgrade guiderelease notes

  • Allows test environment options to be set inline in a file.

    28.0.0upgrade guiderelease notes

  • New module that extends expect with jest-snapshot matchers.

    28.0.0release notes

  • New module exporting utilities for expect.

    28.0.0release notes

  • New module providing JSON schemas for Jest configuration.

    28.0.0release notes

  • jest.useFakeTimers() accepts an options bag.

    28.0.0release notes

  • jest-resolve exposes the JestResolver type.

    28.0.0release notes

  • The jsdom environment constructor receives global config.

    28.0.0release notes

  • The expect package exposes the MatcherFunction interface.

    28.0.0release notes

  • The expect package exposes the MatcherFunctionWithState interface.

    28.0.0release notes

  • pretty-format adds a maxWidth parameter.

    28.0.0release notes

  • Adds MessageChannel to node environment globals.

    28.0.0release notes

  • Adds MessageEvent to node environment globals.

    28.0.0release notes

  • jest-resolve exposes the PackageFilter type.

    28.0.0release notes

  • jest-resolve exposes the PackageJSON type.

    28.0.0release notes

  • jest-resolve exposes the PathFilter type.

    28.0.0release notes

  • Custom reporter constructors receive reporterContext as their third argument.

    28.0.0release notes

  • Exposes retainAllFiles to allow searching for tests in node_modules.

    28.0.0release notes

  • Adds a CLI option for running parts of a test suite across different machines.

    28.0.0upgrade guiderelease notes

  • Adds structuredClone to node environment globals.

    28.0.0release notes

  • jest-resolve exposes the SyncResolver type.

    28.0.0release notes

Behavior and default changes 17

  • Auto-mocking now supports async generator functions.

    28.0.0release notes

  • Supports dependencyExtractor implementations written in ESM.

    28.0.0release notes

  • Classes and functions are allowed as describe names.

    28.0.0release notes

  • jest-circus supports error logging before retry.

    28.0.0release notes

  • The node environment adds node and node-addon as default export conditions.

    28.0.0release notes

  • Adds full support for package exports, beyond the main entry point and packages without a main field.

    28.0.0upgrade guiderelease notes

  • Classes and functions are allowed as it names.

    28.0.0release notes

  • Defaults to the node crawler rather than shelling out to find when watchman is not enabled.

    28.0.0release notes

  • Calling jest.resetModules clears the filesystem and transform caches.

    28.0.0release notes

  • The default moduleFileExtensions now includes mjs and cjs.

    28.0.0release notes

  • Jest copies globals missing from the test environment from the global environment in which Jest runs.

    28.0.0upgrade guiderelease notes

  • jest-environment-node provides node and node-addons conditions; jest-environment-jsdom provides the browser condition.

    28.0.0upgrade guiderelease notes

  • jest-resolve supports package self-reference.

    28.0.0release notes

  • This long-deprecated configuration option is no longer normalized.

    28.0.0release notes

  • For CJS, setup files can export an async function, which Jest calls and awaits before loading tests.

    28.0.0upgrade guiderelease notes

  • The Summary Reporter can now be used as a stand-alone reporter.

    28.0.0release notes

  • Classes and functions are allowed as test names.

    28.0.0release notes

Tooling 3

  • Adds a reporter that uses GitHub Actions annotations to print test errors inline.

    28.0.0upgrade guiderelease notes

  • Improved type inference for functions passed to isMockFunction.

    28.0.0release notes

  • The usage of the jest.fn generic type argument is improved.

    28.0.0release notes

Fixes and other changes 7

  • Correctly detects CI environments and updates snapshots accordingly.

    28.0.0release notes

  • Calling expect.extend with invalid matchers throws a useful error.

    28.0.0release notes

  • The node environment constructor receives global config.

    28.0.0release notes

  • PatternPrompt takes entityName as its third constructor parameter instead of this._entityName.

    28.0.0release notes

  • babel-jest passes rootDir as root in Babel's options.

    28.0.0release notes

  • Fixes false positives when looking for an undefined prop.

    28.0.0release notes

  • Unref-ed subprocesses are no longer reported as open handles.

    28.0.0release notes

jest 27101 changes

Breaking changes 52

  • The returned function now returns a Promise.

    27.0.0release notes

  • A describe block must not return anything.

    27.0.0upgrade guiderelease notes

  • Tests that take a done callback and also have return values now fail.

    26.0.0, 27.0.0release notesupgrade guiderelease notes

  • The unused options argument is removed from the Env constructor.

    27.0.0release notes

  • The process exits with code 1 if a test logs after teardown.

    27.0.0release notes

  • It is now the inverse of expect.objectContaining(), as documented.

    27.0.0release notes

  • The enabledTestsMap config is removed; use filter instead.

    27.0.0release notes

  • jest-get-type is converted to an ES Module.

    27.0.0release notes

  • root moves into config, and getConsoleOutput requires GlobalConfig.

    27.0.0release notes

  • The deprecated, unused Runtime method is removed.

    27.0.0release notes

  • The global variable is no longer injected into the module wrapper.

    27.0.0release notes

  • Hooks and tests may return only a Promise, not other return values.

    27.0.0release notes

  • The deprecated function form of ignorePattern is no longer supported.

    27.0.0release notes

  • Prettier is optional for inline snapshots; Jest falls back to string replacement.

    27.0.0release notes

  • The unused isCoreModule option is removed.

    27.0.0release notes

  • jest-diff now uses only named exports.

    27.0.0release notes

  • The jest-runtime CLI moves to jest-repl.

    27.0.0release notes

  • The API passes an options bag instead of separate config and other options.

    27.0.0release notes

  • The API passes an options bag instead of multiple boolean options.

    27.0.0release notes

  • jest-worker now uses named exports.

    27.0.0release notes

  • This long-deprecated function was removed; use expect.extend instead.

    27.0.0upgrade guide

  • The long-deprecated jest.addMatchers API is removed, along with jest.resetModuleRegistry and jest.runTimersToTime.

    27.0.0release notes

  • This long-deprecated function was removed; use jest.resetModules instead.

    27.0.0upgrade guide

  • This long-deprecated function was removed; use jest.advanceTimersByTime instead.

    27.0.0upgrade guide

  • The modern fake timers implementation becomes the default; call jest.useFakeTimers("legacy") to use the old implementation.

    27.0.0upgrade guiderelease notes

  • The deprecated mapCoverage option is removed.

    27.0.0release notes

  • matcherResult on JestAssertionError is now a string rather than a function.

    27.0.0release notes

  • The default file extension order changes by moving json behind ts and tsx.

    27.0.0release notes

  • Tests fail when multiple done() calls are made.

    27.0.0release notes

  • jest-each ignores excess words in headings.

    27.0.0release notes

  • Support for Node 13 was dropped.

    27.0.0upgrade guide

  • node-notifier becomes a peer dependency of jest-reporters.

    27.0.0release notes

  • Jest supports only Node LTS releases and Node 15.

    27.0.0release notes

  • An exports field is added to all package.json files.

    27.0.0release notes

  • Packages migrated to ESM-style exports may require consumers to adjust imports, such as using a default import for pretty-format.

    27.0.0upgrade guiderelease notes

  • recursiveBlacklist is removed in favor of recursiveDenylist.

    27.0.0release notes

  • Jest disables jest-pnp-resolver for Yarn 2.

    27.0.0release notes

  • The function always returns a Promise, and its third parameter is now RequireAndTranspileModuleOptions, which accepts applyInteropRequireDefault.

    27.0.0release notes

  • Transforms are run over runner and testRunner modules.

    27.0.0release notes

  • Modules specified in this configuration option are now transformed like the rest of your code.

    27.0.0upgrade guide

  • Test environments no longer support runScript.

    27.0.0release notes

  • ScriptTransformer is no longer exported; use the asynchronous createScriptTransformer function.

    27.0.0release notes

  • The JSDOM environment no longer provides the Node globals setImmediate and clearImmediate.

    27.0.0release notes

  • Modules specified in this configuration option are now transformed like the rest of your code.

    27.0.0upgrade guiderelease notes

  • The default test environment changes from jsdom to node; projects using DOM APIs can configure jsdom or use per-file environment configuration.

    27.0.0upgrade guiderelease notes

  • Modules specified in this configuration option are now transformed like the rest of your code.

    27.0.0upgrade guiderelease notes

  • The default test runner changes from jest-jasmine2 to jest-circus; projects relying on Jasmine-specific APIs may need to opt back in.

    27.0.0upgrade guiderelease notes

  • Modules specified in this configuration option are now transformed like the rest of your code.

    27.0.0upgrade guiderelease notes

  • The TestScheduler export is replaced with createTestScheduler.

    27.0.0release notes

  • Modern fake timers become the default; configure timers as legacy to retain the old implementation when enabling fake timers globally.

    27.0.0upgrade guide

  • toContain is stricter about the received value's type.

    27.0.0release notes

  • Some TypeScript types are stricter.

    27.0.0upgrade guide

New APIs and options 17

  • AbortController is available in the Node environment globals.

    27.0.0release notes

  • AbortController is added to the Node environment globals.

    27.0.0release notes

  • requireOrImportModule accepts an applyInteropRequireDefault option.

    27.0.0release notes

  • Jest transformers support asynchronous code transformations.

    27.0.0release notes

  • babel-jest supports asynchronous transformation.

    27.0.0release notes

  • jest-worker supports custom task queues and provides a PriorityQueue implementation.

    27.0.0release notes

  • This option makes jest-haste-map follow symlinks for test files.

    27.0.0release notes

  • ESM can be used for the test environment.

    27.0.0release notes

  • jest-config allows this option to be passed through to jest-haste-map.

    27.0.0release notes

  • A custom HasteMap class implementation can now be configured.

    27.0.0release notes

  • jest-worker adds an in-order scheduling policy.

    27.0.0release notes

  • jest-each supports interpolation with object properties.

    27.0.0release notes

  • LogEntry is exported.

    27.0.0release notes

  • This option controls whether prototypes are printed for raw objects or arrays.

    27.0.0release notes

  • The programmatic API can run multiple projects.

    27.0.0release notes

  • A utility for importing CJS or ESM is added.

    27.0.0release notes

  • All reporters gain a static filepath property.

    27.0.0release notes

Performance 2

  • Reading and parsing package.json files is cached.

    27.0.0release notes

  • Initialization per test file is roughly 70% faster than in Jest 26, though the improvement may be less noticeable in many projects.

    27.0.0upgrade guide

Behavior and default changes 17

  • ESM is supported for files other than .js and .mjs.

    27.0.0release notes

  • globalSetup and globalTeardown files written in ESM are supported.

    27.0.0release notes

  • Inline snapshots can now be used without Prettier.

    27.0.0upgrade guiderelease notes

  • Presets written in ESM are supported.

    27.0.0release notes

  • Jest config options are passed to transformer process and getCacheKey functions.

    27.0.0release notes

  • Reporters written in ESM are supported.

    27.0.0release notes

  • Runners written in ESM are supported.

    27.0.0release notes

  • Test files symlinked into the test directory can now be handled.

    27.0.0upgrade guide

  • Interpolation supports array indices and object properties; percent signs and excess heading words are handled differently.

    27.0.0release notes

  • Test environments written in ESM are supported.

    27.0.0release notes

  • Test runners written in ESM are supported.

    27.0.0release notes

  • More TestSequencer methods can be asynchronous.

    27.0.0release notes

  • Test sequencers written in ESM are supported.

    27.0.0release notes

  • TestWatcher now extends emittery.

    27.0.0release notes

  • Transforms can now be asynchronous, enabling effective transpilation through tools such as esbuild, Snowpack, and Vite.

    27.0.0upgrade guide

  • Transformers written in ESM are supported.

    27.0.0release notes

  • Watch plugins written in ESM are supported.

    27.0.0release notes

Tooling 4

  • Asynchronous code transformations are supported.

    27.0.0release notes

  • Custom runners, reporters, watch plugins, and other modules can be loaded as ES modules.

    27.0.0upgrade guide

  • Interactive mode can now step through failed tests one at a time, in addition to reviewing and updating failed snapshots.

    27.0.0upgrade guiderelease notes

  • Transpiled transformers are supported.

    27.0.0release notes

Fixes and other changes 9

  • jest-changed-files uses -- to separate paths from revisions.

    27.0.0release notes

  • console.dir now respects its second argument correctly.

    27.0.0release notes

  • beforeAll and afterAll hooks inside skipped describe blocks are no longer executed.

    27.0.0release notes

  • The global module registry no longer leaks into the isolateModules registry.

    27.0.0release notes

  • CJS reexports are detected as named exports in ESM.

    27.0.0release notes

  • Jest throws the correct error when attempting to load ESM through require.

    27.0.0release notes

  • testLocation is fixed on Windows when using test.each.

    27.0.0release notes

  • Array indices are supported with template strings.

    27.0.0release notes

  • The configured failure exit code is used when bailing from a failed test.

    27.0.0release notes

jest 2618 changes

Breaking changes 10

  • Throws a proper error if a test or hook is defined asynchronously.

    26.0.0release notes

  • Removes support for the browser field.

    26.0.0release notes

  • Removes build-es5 from the expect, jest-mock, and pretty-format packages.

    26.0.0release notes

  • jest-environment-jsdom upgrades jsdom to v16, which may affect tests that depend on jsdom behavior.

    26.0.0release notes

  • Renames LolexFakeTimers to ModernFakeTimers.

    26.0.0release notes

  • Jest drops support for Node 8.

    26.0.0release notes

  • Removes providesModuleNodeModules.

    26.0.0release notes

  • Removes the long-deprecated require.requireActual method.

    26.0.0release notes

  • Removes the long-deprecated require.requireMock method.

    26.0.0release notes

  • Aligns test execution order with jasmine's top-to-bottom order.

    26.0.0release notes

New APIs and options 2

  • Adds createMockFromModule as an alias for genMockFromModule.

    26.0.0release notes

  • Adds the possibility of using a modern fake timers implementation backed by @sinonjs/fake-timers.

    26.0.0release notes

Fixes and other changes 6

  • Files are no longer reported as changed when they are only accessed.

    26.0.0release notes

  • Handles null being passed to createTransformer.

    26.0.0release notes

  • Provides a more descriptive error when a hook is defined inside a test.

    26.0.0release notes

  • Shows a relative path from the root directory in module not found errors.

    26.0.0release notes

  • Fixes a bug involving absolute paths in moduleNameMapper and jest.mock.

    26.0.0release notes

  • Fixes time formatting duration and consolidates time formatting code.

    26.0.0release notes