Packages

jest-util

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

Your version

23.0.0

major24 May 2018Where it was published

23.4.0 is the newest release of 23.x.

In short

7 breaking49 new30 fixed12 internal

  • breaking

    jest-snapshot: Concatenate name of test, optional snapshot name and count

  • breaking

    jest-jasmine2: Adds error throwing and descriptive errors to it/ test for invalid arguments. [jest-circus] Adds error throwing and descriptive errors to it/ test for invalid arguments

  • breaking

    jest-mock: Include tracked call results in serialized mock

  • breaking

    jest-mock: Replace timestamps with invocationCallOrder

  • breaking

    pretty-format: Remove undefined props from React elements

  • breaking

    babel-jest: Always return object from transformer

  • breaking

    jest-runtime: Remove jest.genMockFn and jest.genMockFunction

Release note

Features

  • expect: Expose getObjectSubset, iterableEquality, and subsetEquality

  • jest-snapshot: Add snapshot property matchers

  • jest-config: Support jest-preset.js files within Node modules

  • jest-cli: Add --detectOpenHandles flag which enables Jest to potentially track down handles keeping it open after tests are complete.

  • jest-jasmine2: Add data driven testing based on jest-each

  • jest-matcher-utils: Change "suggest to equal" message to be more advisory

  • jest-message-util: Don't ignore messages with vendor anymore

  • jest-validate: Get rid of jest-config dependency

  • jest-validate: Adds option to inject deprecationEntries

  • breaking

    jest-snapshot: Concatenate name of test, optional snapshot name and count

  • jest-runtime: Allow for transform plugins to skip the definition process method if createTransformer method was defined.

  • expect: Add stack trace for async errors

  • jest-jasmine2: Add stack trace for timeouts

  • jest-jasmine2: Add stack trace for thrown non-Errors

  • jest-runtime: Prevent modules from marking themselves as their own parent

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

  • expect: Add support for async matchers

  • expect: Suggest toContainEqual

  • jest-config: Export Jest's default options

  • jest-editor-support: Move coverage to ProjectWorkspace.collectCoverage

  • jest-editor-support: Add coverage option to runner

  • jest-haste-map: Support extracting dynamic imports

  • expect: Improve output format for mismatchedArgs in mock/spy calls.

  • jest-cli: Add support for using --coverage in combination with watch mode, --onlyChanged, --findRelatedTests and more

  • breaking

    jest-jasmine2: Adds error throwing and descriptive errors to it/ test for invalid arguments. [jest-circus] Adds error throwing and descriptive errors to it/ test for invalid arguments

  • jest-matcher-utils: Add isNot option to matcherHint function

  • jest-config: Add <rootDir> to runtime files not found error report

  • expect: Make toThrow matcher pass only if Error object is returned from promises

  • expect: Add isError to utils

  • expect: Add inverse matchers (expect.not.arrayContaining, etc., #5517)

  • expect: expect.extend now also extends asymmetric matchers

  • jest-mock: Update spyOnProperty to support spying on the prototype chain

  • jest-mock: Add tracking of return values in the mock property

  • jest-mock: Add tracking of thrown errors in the mock property

  • Add nthCalledWith spy matcher

  • jest-cli: Add isSerial property that runners can expose to specify that they can not run in parallel

  • expect: Add .toBeCalledTimes and toHaveBeenNthCalledWith aliases

  • jest-cli: Interactive Snapshot Mode improvements

  • jest-editor-support: Add no-color option to runner

  • jest-jasmine2: Pretty-print non-Error object errors

  • jest-message-util: Include column in stack frames

  • expect: Introduce toStrictEqual

  • expect: Add return matchers

  • jest-cli: Improve snapshot summaries

  • expect: Include custom mock names in error messages

  • jest-diff: Support returning diff from oneline strings

  • expect: Improve return matchers

  • jest-cli: Overhaul watch plugin hooks names

  • breaking

    jest-mock: Include tracked call results in serialized mock

Fixes

  • jest-cli: Fix stdin encoding to utf8 for watch plugins.

  • expect: Better detection of DOM Nodes for equality

  • jest-cli: Fix misleading action description for F key when in "only failed tests" mode.

  • jest-worker: Stick calls to workers before processing them

  • babel-plugin-jest-hoist: Allow using console global variable

  • jest-jasmine2: Always remove node core message from assert stack traces

  • expect: Add stack trace when expect.assertions and expect.hasAssertions causes test failures.

  • jest-runtime: Throw a more useful error when trying to require modules after the test environment is torn down

  • breaking

    jest-mock: Replace timestamps with invocationCallOrder

  • jest-jasmine2: Install sourcemap-support into normal runtime to catch runtime errors

  • jest-jasmine2: Added assertion error handling inside afterAll hook

  • jest-cli: Remove the notifier actions in case of failure when not in watch mode.

  • jest-mock: Extend .toHaveBeenCalled return message with outcome

  • jest-runner: Assign process.env.JEST_WORKER_ID="1" when in runInBand mode

  • jest-cli: Add descriptive error message when trying to use globalSetup/globalTeardown file that doesn't export a function.

  • expect: Do not rely on instanceof RegExp, since it will not work for RegExps created inside of a different VM

  • jest-resolve: Update node module resolution algorithm to correctly handle symlinked paths

  • jest-editor-support: Update Settings to use spawn in shell option

  • jest-cli: Improve the error message when 2 projects resolve to the same config

  • jest-runtime: Remove retainLines from coverage instrumentation

  • jest-cli: Fix update snapshot issue when using watchAll

  • expect: Fix rejects.not matcher

  • jest-runtime: Prevent Babel warnings on large files

  • jest-mock: Prevent mockRejectedValue from causing unhandled rejection

  • pretty-format: Handle React fragments better

  • pretty-format: Handle formatting of React.forwardRef and Context components

  • jest-cli: Switch collectCoverageFrom back to a string

  • jest-regex-util: Fix handling regex symbols in tests path on Windows

  • jest-util: Fix handling of NaN/Infinity in mock timer delay

  • jest-resolve: Generalise test for package main entries equivalent to ".".

  • jest-config: Ensure that custom resolvers are used when resolving the configuration

  • website: Fix website docs

  • expect: Fix isEqual Set and Map to compare object values and keys regardless of order

  • breaking

    pretty-format: Remove undefined props from React elements

  • jest-haste-map: Properly resolve mocked node modules without package.json defined

Chore & Maintenance

  • breaking

    babel-jest: Always return object from transformer

  • breaking

    jest-runtime: Remove jest.genMockFn and jest.genMockFunction