Packages

jest-util

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

Your version

24.0.0

major25 Jan 2019Where it was published

24.9.0 is the newest release of 24.x.

In short

23 breaking42 new1 faster59 fixed38 internal

  • breaking

    jest-each: Add primitive pretty printing for interpolated titles

  • breaking

    jest-diff: Support diffing numbers and booleans instead of returning null for different ones

  • breaking

    jest-diff: Replace diff with diff-sequences package

  • breaking

    jest-cli: Only set error process error codes when they are non-zero

  • breaking

    jest-config: Deprecate setupTestFrameworkScriptFile in favor of new setupFilesAfterEnv

  • breaking

    jest-worker: Add functionality to call a setup method in the worker before the first call and a teardown method when ending the farm

  • breaking

    jest-config: Set default notifyMode to failure-change

  • breaking

    jest-haste-map: Remove support for @providesModule

Release note

Features

  • breaking

    jest-each: Add primitive pretty printing for interpolated titles

  • jest-runtime: Add jest.isolateModules for scoped module initialization

  • breaking

    jest-diff: Support diffing numbers and booleans instead of returning null for different ones

  • breaking

    jest-diff: Replace diff with diff-sequences package

  • breaking

    jest-cli: Only set error process error codes when they are non-zero

  • breaking

    jest-config: Deprecate setupTestFrameworkScriptFile in favor of new setupFilesAfterEnv

  • breaking

    jest-worker: Add functionality to call a setup method in the worker before the first call and a teardown method when ending the farm

  • breaking

    jest-config: Set default notifyMode to failure-change

  • breaking

    jest-haste-map: Remove support for @providesModule

  • breaking

    jest-haste-map: Replace internal data structures to improve performance

  • breaking

    jest-haste-map: Use relative paths to allow remote caching

  • breaking

    jest-haste-map: Remove name from hash in HasteMap.getCacheFilePath

  • breaking

    babel-preset-jest: Export a function instead of an object for Babel 7 compatibility

  • breaking

    jest-haste-map: Expose relative paths when getting the file iterator

  • breaking

    jest-cli: Run code transforms over global{Setup,Teardown}

  • jest-haste-map: Add hasteFS.getSize(path)

  • jest-cli: Print version ending in -dev when running a local Jest clone

  • jest-cli: Add Support for globalSetup and globalTeardown in projects

  • jest-runtime: Add extraGlobals to config to load extra global variables into the execution vm

  • jest-util: Export specialChars containing Unicode characters and ANSI escapes for console output

  • jest-config: Handle typescript (ts and tsx) by default

  • jest-validate: Add support for comments in package.json using a "//" key

  • jest-config: Add shorthand for watch plugins and runners

  • jest-jasmine2/jest-circus/jest-cli: Add test.todo

  • pretty-format: Option to not escape strings in diff messages

  • jest-haste-map: Add getFileIterator to HasteFS for faster file iteration

  • jest-config: Add readConfigs function, previously in jest-cli

  • jest-snapshot: Enable configurable snapshot paths

  • pretty-format: Support HTMLCollection and NodeList in DOMCollection plugin

  • jest-runtime: Pass the normalized configuration to script transformers

  • expect: Improve report when assertion fails, part 3

  • jest-runtime: If require fails without a file extension, print all files that match with one

  • jest-haste-map: Make ignorePattern optional

  • jest-haste-map: Add getCacheFilePath to get the path to the cache file for a HasteMap instance

  • jest-runtime: Remove cacheDirectory from ignorePattern for HasteMap if not necessary

  • jest-validate: Add syntax to validate multiple permitted types

  • jest-config: Accept an array as as well as a string for testRegex ([#7209]#7209))

  • expect/jest-matcher-utils: Improve report when assertion fails, part 4

  • expect/jest-matcher-utils: Improve report when assertion fails, part 5

  • expect: Check constructor equality in .toStrictEqual()

  • jest-util: Add jest.getTimerCount() to get the count of scheduled fake timers

  • jest-config: Add dependencyExtractor option to use a custom module to extract dependencies from files (#7313, #7349, #7350, #7362)

  • jest-haste-map: Accept a getCacheKey method in hasteImplModulePath modules to reset the cache when the logic changes

  • jest-config: Add haste.computeSha1 option to compute the sha-1 of the files in the haste map

  • expect: expect(Infinity).toBeCloseTo(Infinity) Treats Infinity as equal in toBeCloseTo matcher

  • jest-worker: Add node worker-thread support to jest-worker

  • jest-config: Allow bail setting to be configured with a number allowing tests to abort after n of failures

  • jest-config: Allow % based configuration of --max-workers

  • jest-runner: Instantiate the test environment class with the current testPath

  • jest-config: Always resolve jest-environment-jsdom from jest-config

  • expect: Improve report when assertion fails, part 6

  • jest-worker: Add enableWorkerThreads option to explicitly opt-in to worker_threads if available

Fixes

  • expect: Accept inherited properties in toHaveProperty matcher

  • jest-diff: Do not claim that -0 and 0 have no visual difference

  • jest-mock: Fix automock for numeric function names

  • jest-config: Ensure existsSync is only called with a string parameter

  • expect: toStrictEqual considers sparseness of arrays.

  • jest-cli: Fix empty coverage data for untested files

  • breaking

    jest-cli: Do not use text-summary coverage reporter by default if other reporters are configured

  • breaking

    jest-mock: Fix bugs with mock/spy result tracking of recursive functions

  • breaking

    jest-haste-map: Recover files correctly after haste name collisions are fixed

  • breaking

    pretty-format: Omit non-enumerable symbol properties

  • breaking

    *: Upgrade to Babel 7, dropping support for Babel 6

  • jest-cli: Avoid watch mode causing bad terminal behavior in some cases

  • jest-runner/jest-worker: Fix missing console output in verbose mode

  • expect: Standardize file naming in expect

  • jest-each: Add empty array validation check

  • jest-cli: Interrupt tests if interactive watch plugin key is pressed

  • jest-each: Add each array validation check

  • jest-haste-map: Do not visit again files with the same sha-1

  • jest-jasmine2: Fix memory leak in Error objects hold by the framework

  • jest-haste-map: Fixed Haste whitelist generation for scoped modules on Windows

  • jest-mock: Fix inheritance of static properties and methods in mocks

  • jest-mock: Fix mocking objects without Object.prototype in their prototype chain

  • jest-mock: Check _isMockFunction is true rather than truthy on potential mocks

  • jest-cli: Update jest-cli to show git ref in message when using changedSince

  • [jest-jasmine2] Fix crash when test return Promise rejected with null

  • jest-runtime: Check _isMockFunction is true rather than truthy on potential global mocks

  • jest-jasmine: Show proper error message from async assert errors

  • jest-jasmine2: Better error message when a describe block is empty

  • jest-jasmine2: Pending calls inside async tests are reported as pending not failed

  • jest-circus: Better error message when a describe block is empty

  • jest-jasmine2: Add missing testLocationResults for xit and fit

  • expect: Return false from asymmetric matchers if received value isn’t string

  • jest-cli: Fix unhandled error when a bad revision is provided to changedSince

  • jest-config: Moved dynamically assigned cwd from jest-cli to default configuration in jest-config

  • jest-config: Fix getMaxWorkers on termux

  • jest-runtime: Throw an explicit error if js is missing from moduleFileExtensions

  • jest-runtime: Fix missing coverage when using negative glob pattern in testMatch

  • *: Ensure maxWorkers is at least 1 (was 0 in some cases where there was only 1 CPU)

  • jest-runtime: Fix transform cache invalidation when requiring a test file from multiple projects

  • jest-changed-files: Return correctly the changed files when using lastCommit=true on Mercurial repositories

  • babel-jest: Cache includes babel environment variables

  • jest-config: Use strings instead of RegExp instances in normalized configuration

  • jest-circus: Make sure to display real duration even if time is mocked

  • expect: Improves the failing message for toStrictEqual matcher.

  • expect: Improves the failing message for toEqual matcher.

  • jest-resolve: Fix not being able to resolve path to mapped file with custom platform

  • jest-message-util: Improve parsing of error messages for unusually formatted stack traces

  • jest-runtime: Ensure error message text is not lost on errors with code frames

  • jest-haste-map: Fix to resolve path that is start with words same as rootDir

  • expect: Fix toMatchObject matcher when used with Object.create(null)

  • jest-haste-map: Remove legacy condition for duplicate module detection

  • jest-haste-map: Fix require detection with trailing commas and ignore import typeof modules

  • jest-cli: Fix to set prettierPath via config file

  • expect: Test more precisely for class instance getters

  • jest-cli: Support dashed args

  • jest-cli: Fix to run in band tests if watch mode enable when runInBand arg used

  • jest-runtime: Fix mistake as test files when run coverage issue.

  • jest-cli: Print info about passWithNoTests flag

  • pretty-format: Omit unnecessary symbol filter for object keys

  • jest-runtime: Fix requireActual on node_modules with mock present

  • jest-resolve: Fix isBuiltinModule to support versions of node without module.builtinModules

  • babel-jest: Set cwd to be resilient to it changing during the runtime of the tests

  • jest-snapshot: Write and read snapshots from disk even if fs is mocked

  • jest-config: Normalize config.cwd and config.rootDir using `realpath

  • jest-environment-node: Fix buffer property is not ArrayBuffer issue.

  • babel-plugin-jest-hoist: Ignore TS type annotations when looking for out-of-scope references

  • jest-config: Add name to project if one does not exist to pick correct resolver

  • jest-runtime: Pass watchPathIgnorePatterns to Haste instance

  • jest-runtime: Resolve mock files via Haste when using require.resolve

Chore & Maintenance

  • breaking

    *: Require Node.js 6+ for all packages

  • breaking

    jest-util: Remove long-deprecated globals for fake timers

  • breaking

    *: Upgrade to Micromatch 3

  • breaking

    *: Remove regenerator-runtime injection

Performance

  • jest-mock: Improve getType function performance.