--- title: "@std/expect" description: "Jest compatible `expect` assertion functions" jsr: jsr:@std/expect pkg: expect version: 1.0.18 generated: true stability: stable --- ## Overview
This module provides Jest compatible expect assertion functionality.
```js import { expect } from "@std/expect"; const x = 6 * 7; expect(x).toEqual(42); expect(x).not.toEqual(0); await expect(Promise.resolve(x)).resolves.toEqual(42); ```Currently this module supports the following functions:
toBetoEqualtoStrictEqualtoMatchtoMatchObjecttoBeDefinedtoBeUndefinedtoBeNulltoBeNaNtoBeTruthytoBeFalsytoContaintoContainEqualtoHaveLengthtoBeGreaterThantoBeGreaterThanOrEqualtoBeLessThantoBeLessThanOrEqualtoBeCloseTotoBeInstanceOftoThrowtoHavePropertytoMatchSnapshottoMatchInlineSnapshottoHaveBeenCalledtoHaveBeenCalledTimestoHaveBeenCalledWithtoHaveBeenLastCalledWithtoHaveBeenNthCalledWithtoHaveReturnedtoHaveReturnedTimestoHaveReturnedWithtoHaveLastReturnedWithtoHaveNthReturnedWithexpect.addSnapshotSerializerexpect.assertionsexpect.addEqualityTesterexpect.extendexpect.hasAssertionsOnly these functions are still not available:
toThrowErrorMatchingSnapshottoThrowErrorMatchingInlineSnapshotThe tracking issue to add support for unsupported parts of the API is https://github.com/denoland/std/issues/3964.
This module is largely inspired by x/expect module by Allain Lalonde.
### Add to your project ```sh deno add jsr:@std/expect ``` See all symbols in @std/expect on