Packages

jest-util

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

Your version

22.0.0

major18 Dec 2017Where it was published

22.4.3 is the newest release of 22.x.

In short

7 breaking1 removed30 new31 fixed18 internal

  • breaking

    expect: Replace identity equality with Object.is in toBe matcher

  • breaking

    jest-environment-jsdom: Upgrade to JSDOM@11

  • breaking

    jest-environment-*: Add Async Test Environment APIs, dispose is now teardown

  • breaking

    jest-snapshot: Concatenate name of test and snapshot

  • breaking

    jest-cli: Fail if no tests are found

  • breaking

    jest-snapshot: Add a serializer for jest.fn to allow a snapshot of a jest mock

  • breaking

    *: Drop support for Node.js version 4

  • removed

    jest-worker: Remove debug and inspect flags from the arguments sent to the child

Release note

Fixes

  • jest-resolve: Use module.builtinModules as BUILTIN_MODULES when it exists

  • removed

    jest-worker: Remove debug and inspect flags from the arguments sent to the child

  • jest-config: Use all --testPathPattern and <regexForTestFiles> args in testPathPattern

  • jest-cli: Do not support --watch inside non-version-controlled environments

  • jest-config: Escape Windows path separator in testPathPattern CLI arguments

  • jest-jasmine: Register sourcemaps as node environment to improve performance with jsdom

  • pretty-format: Do not call toJSON recursively

  • pretty-format: Fix errors when identity-obj-proxy mocks CSS Modules

  • babel-jest: Fix support for namespaced babel version 7

  • expect: Fix .toThrow for promises

  • jest-docblock: Pragmas should preserve urls

  • jest-cli: Check if npm_lifecycle_script calls Jest directly

  • jest-cli: Fix --showConfig to show all configs

  • jest-cli: Throw if maxWorkers doesn't have a value

  • jest-cli: Use fs.realpathSync.native if available

  • jest-config: Fix --passWithNoTests

  • jest-config: Support rootDir tag in testEnvironment

  • jest-editor-support: Fix --showConfig to support jest 20 and jest 21

  • jest-editor-support: Fix editor support test for node 4

  • jest-mock: Support mocking constructor in mockImplementationOnce

  • jest-runtime: Fix manual user mocks not working with custom resolver

  • jest-util: Fix runOnlyPendingTimers for setTimeout inside setImmediate

  • jest-message-util: Always remove node internals from stacktraces

  • jest-resolve: Changes method of determining builtin modules to include missing builtins

  • pretty-format: Prevent error in pretty-format for window in jsdom test env

  • jest-resolve: Preserve module identity for symlinks

  • jest-config: Include error message for preset json

  • pretty-format: Throw PrettyFormatPluginError if a plugin halts with an exception

  • expect: Keep the stack trace unchanged when PrettyFormatPluginError is thrown by pretty-format

  • jest-environment-jsdom: Fix asynchronous test will fail due to timeout issue.

  • jest-cli: Fix --onlyChanged path case sensitivity on Windows platform

  • jest-runtime: Use realpath to match transformers

  • breaking

    expect: Replace identity equality with Object.is in toBe matcher

Features

  • jest-config: Add Global Setup/Teardown options

  • jest-config: Add testEnvironmentOptions to apply to jsdom options or node context.

  • jest-jasmine2: Update Timeout error message to jest.timeout and display current timeout value

  • jest-runner: Enable experimental detection of leaked contexts

  • jest-cli: Add combined coverage threshold for directories.

  • jest-mock: Add timestamps to mock state.

  • eslint-plugin-jest: Add prefer-to-have-length lint rule.

  • breaking

    jest-environment-jsdom: Upgrade to JSDOM@11

  • breaking

    jest-environment-*: Add Async Test Environment APIs, dispose is now teardown

  • jest-cli: Add an option to clear the cache

  • babel-plugin-jest-hoist: Improve error message, that the second argument of jest.mock must be an inline function

  • breaking

    jest-snapshot: Concatenate name of test and snapshot

  • breaking

    jest-cli: Fail if no tests are found

  • jest-diff: Highlight only last of odd length leading spaces

  • jest-docblock: Add docblock.print()

  • jest-docblock: Add strip

  • jest-docblock: Preserve leading whitespace in docblock comments

  • jest-docblock: Remove leading newlines from parswWithComments().comments

  • jest-editor-support: Add Snapshots metadata

  • jest-editor-support: Adds an 'any' to the typedef for updateFileWithJestStatus

  • jest-editor-support: Better monorepo support

  • jest-environment-jsdom: Add simple rAF polyfill in jsdom environment to work with React 16

  • jest-environment-node: Implement node Timer api

  • jest-jasmine2: Add testPath to reporter callbacks

  • jest-mock: Added support for naming mocked functions with .mockName(value) and .mockGetName()

  • jest-runtime: Add module.loaded, and make module.require not enumerable

  • jest-runtime: Add module.parent

  • jest-runtime: Support sourcemaps in transformers

  • breaking

    jest-snapshot: Add a serializer for jest.fn to allow a snapshot of a jest mock

  • jest-worker: Initial version of parallel worker abstraction, say hello!

  • jest-jasmine2: Add testLocationInResults flag to add location information per spec to test results

  • jest-environment-jsdom: Update JSOM to 11.4, which includes built-in support for requestAnimationFrame

  • jest-cli: Hide watch usage output when running on non-interactive environments

  • jest-snapshot: Promises support for toThrowErrorMatchingSnapshot

  • jest-cli: Explain which snapshots are obsolete

Chore & Maintenance

  • breaking

    *: Drop support for Node.js version 4