# jest-matcher-utils

> A set of utility functions for expect and related packages

Latest version **30.5.2** (published 2026-09-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install jest-matcher-utils
pnpm add jest-matcher-utils
yarn add jest-matcher-utils
bun add jest-matcher-utils
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 30.5.2 |
| Published | 2026-09-18 |
| First published | 2016-07-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^18.14.0 \|\| ^20.0.0 \|\| ^22.0.0 \|\| >=24.0.0 |
| Dependencies | 4 |
| Unpacked size | 32 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 45465 |
| Maintainers | aaronabramov, simenb, rickhanlonii, openjs-operations, cpojer |

## Links

- npm: https://www.npmjs.com/package/jest-matcher-utils
- Repository: https://github.com/jestjs/jest
- Homepage: https://github.com/jestjs/jest#readme
- Issues: https://github.com/jestjs/jest/issues
- npm.io page: https://npm.io/package/jest-matcher-utils

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [jest-diff](https://npm.io/package/jest-diff.md) 30.5.2
- [pretty-format](https://npm.io/package/pretty-format.md) 30.5.1
- [@jest/get-type](https://npm.io/package/@jest/get-type.md) 30.5.0

## Recent versions

- 30.5.2 (latest) — 2026-09-18
- 30.0.0-rc.1 (next) — 2025-06-09
- 30.5.1 — 2026-09-01
- 30.5.0 — 2026-08-28
- 30.4.1 — 2026-05-08
- 30.4.0 — 2026-05-07
- 30.3.0 — 2026-03-10
- 30.2.0 — 2025-09-28
- 30.1.2 — 2025-09-01
- 30.1.1 — 2025-08-27
- 30.1.0 — 2025-08-27
- 30.0.5 — 2025-07-22
- 30.0.4 — 2025-07-02
- 30.0.3 — 2025-06-25
- 30.0.2 — 2025-06-19
- … 242 more at https://npm.io/package/jest-matcher-utils/versions

## README

# jest-matcher-utils

This package's exports are most notably used by `expect`'s [`this.utils`](https://jestjs.io/docs/expect#thisutils).

## Installation

To add this package as a dependency of a project, run either of the following commands:

- `npm install jest-matcher-utils`
- `yarn add jest-matcher-utils`

## Exports ([src/index.ts](https://github.com/jestjs/jest/blob/HEAD/packages/jest-matcher-utils/src/index.ts))

### Functions

`stringify` `highlightTrailingWhitespace` `printReceived` `printExpected` `printWithType` `ensureNoExpected` `ensureActualIsNumber` `ensureExpectedIsNumber` `ensureNumbers` `ensureExpectedIsNonNegativeInteger` `printDiffOrStringify` `diff` `pluralize` `getLabelPrinter` `matcherErrorMessage` `matcherHint`

### Types

`MatcherHintOptions` `DiffOptions`

### Constants

`EXPECTED_COLOR` `RECEIVED_COLOR` `INVERTED_COLOR` `BOLD_WEIGHT` `DIM_COLOR` `SUGGEST_TO_CONTAIN_EQUAL` `SERIALIZABLE_PROPERTIES`

---
_Source: https://npm.io/package/jest-matcher-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
