Packages

jest-util

30.5.1 · 1 Sep 2026MIT156.2M / weekRepositoryHomepagenpmAtom feed

Your version

28.0.0

major25 Apr 2022Where it was published

28.1.3 is the newest release of 28.x.

In short

48 breaking35 new27 fixed14 internal

  • breaking

    jest-cli, jest-config: Remove testURL config, use testEnvironmentOptions.url instead

  • breaking

    jest-cli: Remove undocumented --timers option

  • breaking

    jest-config: Stop shipping jest-environment-jsdom by default

  • breaking

    jest-config: Stop shipping jest-jasmine2 by default

  • breaking

    jest-config: Rename moduleLoader to runtime

  • breaking

    jest-config: Rename extraGlobals to sandboxInjectedGlobals

  • 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, setupTestFrameworkScriptFile and testPathDirs

Release note

Blog post: jestjs.io/blog/2022/04/25/jest-28

Features

  • babel-jest: Export createTransformer function

  • expect: Expose AsymmetricMatchers, MatcherFunction and MatcherFunctionWithState interfaces (#12363, #12376)

  • jest-circus: Support error logging before retry

  • jest-circus, jest-jasmine2: Allowed classes and functions as describe and it/test names

  • breaking

    jest-cli, jest-config: Remove testURL config, use testEnvironmentOptions.url instead

  • jest-cli, jest-core: Add --shard parameter for distributed parallel test execution

  • breaking

    jest-cli: Remove undocumented --timers option

  • breaking

    jest-config: Stop shipping jest-environment-jsdom by default

  • breaking

    jest-config: Stop shipping jest-jasmine2 by default

  • jest-config, @jest/types: Add ci to GlobalConfig

  • breaking

    jest-config: Rename moduleLoader to runtime

  • breaking

    jest-config: Rename extraGlobals to sandboxInjectedGlobals

  • 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, setupTestFrameworkScriptFile and testPathDirs

  • jest-cli, jest-core: Add --ignoreProjects CLI argument to ignore test suites by project name

  • jest-core: Pass project config to globalSetup/globalTeardown function as second argument

  • jest-core: Stabilize test runners with event emitters

  • breaking

    jest-core, jest-watcher: Move TestWatcher class to jest-watcher package

  • 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 browser condition to exportConditions for jsdom environment

  • breaking

    jest-environment-jsdom: Pass global config to Jest environment constructor for jsdom environment

  • breaking

    jest-environment-jsdom: Second argument context to constructor is mandatory

  • breaking

    jest-environment-node: Add default node and node-addon conditions to exportConditions for node environment

  • breaking

    jest-environment-node: Pass global config to Jest environment constructor for node environment

  • breaking

    jest-environment-node: Second argument context to 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 expect with jest-snapshot matchers (#12404, #12410, #12418)

  • @jest/expect-utils: New module exporting utils for expect

  • breaking

    @jest/fake-timers: Rename timers configuration option to fakeTimers

  • breaking

    @jest/fake-timers: Allow jest.useFakeTimers() and projectConfig.fakeTimers to take an options bag

  • breaking

    jest-haste-map: HasteMap.create now returns a promise

  • jest-haste-map: Add support for dependencyExtractor written in ESM

  • breaking

    jest-mock: Rename exported utility types ClassLike, FunctionLike, ConstructorLikeKeys, MethodLikeKeys, PropertyLikeKeys; remove exports of utility types ArgumentsOf, ArgsType, ConstructorArgumentsOf - TS builtin utility types ConstructorParameters and Parameters should be used instead (#12435, #12489)

  • jest-mock: Improve isMockFunction to infer types of passed function

  • breaking

    jest-mock: Improve the usage of jest.fn generic type argument

  • jest-mock: Add support for auto-mocking async generator functions

  • jest-mock: Add contexts member to mock functions

  • @jest/reporters: Add GitHub Actions reporter (#11320, #12658)

  • @jest/reporters: Pass reporterContext to custom reporter constructors as third argument

  • breaking

    jest-resolve: Add support for package.json exports (#11961, #12373)

  • jest-resolve: Support package self-reference

  • jest-resolve, jest-runtime: Add support for data: URI import and mock

  • jest-resolve, jest-runtime: Add support for async resolver

  • breaking

    jest-resolve: Remove browser?: boolean from resolver options, conditions: ['browser'] should be used instead

  • jest-resolve: Expose JestResolver, AsyncResolver, SyncResolver, PackageFilter, PathFilter and PackageJSON types (#12707,

  • jest-runner: Allow setupFiles module to export an async function

  • jest-runner: Allow passing testEnvironmentOptions via docblocks

  • jest-runner: Expose CallbackTestRunner, EmittingTestRunner abstract classes and CallbackTestRunnerInterface, EmittingTestRunnerInterface to help typing third party runners (#12646, #12715)

  • jest-runner: Lock version of source-map-support to 0.5.13

  • breaking

    jest-runtime: Runtime.createHasteMap now returns a promise

  • jest-runtime: Calling jest.resetModules function will clear FS and transform cache

  • breaking

    jest-runtime: Remove Context type 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-map to @jridgewell/trace-mapping

  • breaking

    jest-transform: Make it required for process() and processAsync() methods to always return structured data

  • jest-test-result: Add duration property to JSON test output

  • breaking

    jest-watcher: Make PatternPrompt class to take entityName as third constructor parameter instead of this._entityName

  • breaking

    jest-worker: Allow only absolute workerPath

  • breaking

    jest-worker: Default to advanced serialization when using child process workers

  • pretty-format: New maxWidth parameter

Fixes

  • *: Use sha256 instead of md5 as hashing algortihm for compatibility with FIPS systems

  • breaking

    babel-jest: Pass rootDir as root in Babel's options

  • expect: Move typings of .not, .rejects and .resolves modifiers outside of Matchers interface

  • expect: Throw useful error if expect.extend is called with invalid matchers

  • expect: Fix iterableEquality ignores other properties

  • expect: Fix print for the closeTo matcher

  • jest-changed-files: Improve changedFilesWithAncestor pattern for Mercurial SCM

  • jest-circus, @jest/types: Disallow undefined value in TestContext type

  • jest-config: Correctly detect CI environment and update snapshots accordingly

  • jest-config: Pass moduleTypes to ts-node to enforce CJS when transpiling

  • breaking

    jest-config: Add mjs and cjs to default moduleFileExtensions config

  • jest-config, jest-haste-map: Allow searching for tests in node_modules by exposing retainAllFiles

  • breaking

    jest-core: Exit with status 1 if no tests are found with --findRelatedTests flag

  • jest-core: Do not report unref-ed subprocesses as open handles

  • jest-each: %# is not replaced with index of the test case

  • jest-each: Fixes error message with incorrect count of missing arguments

  • jest-environment-jsdom: Make jsdom accessible to extending environments again

  • jest-environment-jsdom: Log JSDOM errors more cleanly

  • jest-environment-node: Add MessageChannel, MessageEvent to globals

  • jest-environment-node: Add structuredClone to globals

  • breaking

    @jest/expect-utils: Fix false positives when looking for undefined prop

  • 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 jasmine specific types from @jest/types to its own package

  • jest-jasmine2: Do not set duration to 0 for skipped tests

  • jest-matcher-utils: Pass maxWidth to pretty-format to avoid printing every element in arrays by default

  • jest-mock: Fix function overloads for spyOn to allow more correct type inference in complex object

  • jest-mock: Handle overridden Function.name property

  • @jest/reporters: Notifications generated by the --notify flag are no longer persistent in GNOME Shell.

  • @jest/reporters: Move missing icon file which is needed for NotifyReporter class.

  • @jest/reporters: Update v8-to-istanbul

  • jest-resolver: Call custom resolver with core node.js modules

  • jest-runner: Correctly resolve source-map-support

  • jest-worker: Fix Farm execution 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 now 4.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 getTestEnvironment export

  • breaking

    jest-config: Rename config option name to id

  • breaking

    jest-environment-jsdom: Migrate to ESM

  • breaking

    jest-environment-node: Migrate to ESM

  • breaking

    jest-jasmine2, jest-runtime: Use Symbol to pass jest.setTimeout value instead of jasmine specific logic

  • breaking

    jest-phabricator: Migrate to ESM

  • breaking

    jest-resolve: Make requireResolveFunction argument 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 v8 APIs directly

  • breaking

    jest-snapshot: Migrate to ESM

  • breaking

    jest-types: Remove Config.Glob and Config.Path

Performance

  • breaking

    jest-haste-map: Default to node crawler over shelling out to find if watchman is not enabled