import * as mod from "https://dotland.deno.dev/std@0.223.0/expect/mod.ts";
This module provides Jest compatible expect assertion functionality.
Currently this module supports the following functions:
- Common matchers:
toBe
toEqual
toStrictEqual
toMatch
toMatchObject
toBeDefined
toBeUndefined
toBeNull
toBeNaN
toBeTruthy
toBeFalsy
toContain
toContainEqual
toHaveLength
toBeGreaterThan
toBeGreaterThanOrEqual
toBeLessThan
toBeLessThanOrEqual
toBeCloseTo
toBeInstanceOf
toThrow
toHaveProperty
toHaveLength
- Mock related matchers:
toHaveBeenCalled
toHaveBeenCalledTimes
toHaveBeenCalledWith
toHaveBeenLastCalledWith
toHaveBeenNthCalledWith
toHaveReturned
toHaveReturnedTimes
toHaveReturnedWith
toHaveLastReturnedWith
toHaveNthReturnedWith
- Asymmetric matchers:
expect.anything
expect.any
expect.arrayContaining
expect.not.arrayContaining
expect.closeTo
expect.stringContaining
expect.not.stringContaining
expect.stringMatching
expect.not.stringMatching
- Utilities:
expect.addEqualityTester
expect.extend
Only these functions are still not available:
- Matchers:
toMatchSnapShot
toMatchInlineSnapShot
toThrowErrorMatchingSnapShot
toThrowErrorMatchingInlineSnapShot
- Asymmetric matchers:
expect.objectContaining
expect.not.objectContaining
- Utilities:
expect.assertions
expect.hasAssertions
expect.addSnapshotSerializer
This module is largely inspired by x/expect module by Allain Lalonde.