deno.land / std@0.224.0 / expect / mod.ts

View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.// Copyright 2019 Allain Lalonde. All rights reserved. ISC License.// This module is browser compatible.
/** * 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 {@link https://github.com/allain/expect | x/expect} module by Allain Lalonde. * * @example * ```ts * import { expect } from "https://deno.land/std@$STD_VERSION/expect/mod.ts"; * * const x = 6 * 7; * expect(x).toEqual(42); * expect(x).not.toEqual(0); * * await expect(Promise.resolve(x)).resolves.toEqual(42); * ``` * * @module */export { expect } from "./expect.ts";export { fn } from "./fn.ts";
std

Version Info

Tagged at
6 months ago