Skip to main content
Home

@std/expect@1.0.17
Built and signed on GitHub Actions

Works with
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score94%
Downloads2/wk
Published6 months ago (1.0.17)

Jest compatible `expect` assertion functions

This module provides Jest compatible expect assertion functionality.

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:

Only these functions are still not available:

  • Matchers:
    • toMatchSnapshot
    • toMatchInlineSnapshot
    • toThrowErrorMatchingSnapshot
    • toThrowErrorMatchingInlineSnapshot

The 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.

Built and signed on
GitHub Actions

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/expect

Import symbol

import * as expect from "@std/expect";
or

Import directly with a jsr specifier

import * as expect from "jsr:@std/expect";