@noma.to/qwik-mock 0.0.0-semantically-released

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +8 -0
  2. package/lib/index.qwik.cjs +6 -0
  3. package/lib/index.qwik.mjs +6 -0
  4. package/lib/lib/qwik-mock.qwik.cjs +14 -0
  5. package/lib/lib/qwik-mock.qwik.mjs +14 -0
  6. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.cjs +89 -0
  7. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.mjs +89 -0
  8. package/lib/node_modules/.pnpm/@vitest_expect@3.0.9/node_modules/@vitest/expect/dist/index.qwik.cjs +2190 -0
  9. package/lib/node_modules/.pnpm/@vitest_expect@3.0.9/node_modules/@vitest/expect/dist/index.qwik.mjs +2190 -0
  10. package/lib/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +1499 -0
  11. package/lib/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +1499 -0
  12. package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +44 -0
  13. package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +44 -0
  14. package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.qwik.cjs +767 -0
  15. package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.qwik.mjs +767 -0
  16. package/lib/node_modules/.pnpm/@vitest_snapshot@3.0.9/node_modules/@vitest/snapshot/dist/index.qwik.cjs +2149 -0
  17. package/lib/node_modules/.pnpm/@vitest_snapshot@3.0.9/node_modules/@vitest/snapshot/dist/index.qwik.mjs +2149 -0
  18. package/lib/node_modules/.pnpm/@vitest_spy@3.0.9/node_modules/@vitest/spy/dist/index.qwik.cjs +147 -0
  19. package/lib/node_modules/.pnpm/@vitest_spy@3.0.9/node_modules/@vitest/spy/dist/index.qwik.mjs +147 -0
  20. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs +165 -0
  21. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs +165 -0
  22. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/diff.qwik.cjs +1755 -0
  23. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/diff.qwik.mjs +1755 -0
  24. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/error.qwik.cjs +137 -0
  25. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/error.qwik.mjs +137 -0
  26. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.qwik.cjs +150 -0
  27. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.qwik.mjs +150 -0
  28. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.qwik.cjs +474 -0
  29. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.qwik.mjs +474 -0
  30. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.qwik.cjs +218 -0
  31. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.qwik.mjs +218 -0
  32. package/lib/node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.qwik.cjs +4237 -0
  33. package/lib/node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.qwik.mjs +4237 -0
  34. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/arguments.qwik.cjs +9 -0
  35. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/arguments.qwik.mjs +10 -0
  36. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/array.qwik.cjs +16 -0
  37. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/array.qwik.mjs +17 -0
  38. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/bigint.qwik.cjs +9 -0
  39. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/bigint.qwik.mjs +10 -0
  40. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/class.qwik.cjs +16 -0
  41. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/class.qwik.mjs +17 -0
  42. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/date.qwik.cjs +12 -0
  43. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/date.qwik.mjs +13 -0
  44. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/error.qwik.cjs +36 -0
  45. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/error.qwik.mjs +37 -0
  46. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/function.qwik.cjs +11 -0
  47. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/function.qwik.mjs +12 -0
  48. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/helpers.qwik.cjs +160 -0
  49. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/helpers.qwik.mjs +160 -0
  50. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/html.qwik.cjs +36 -0
  51. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/html.qwik.mjs +36 -0
  52. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/index.qwik.cjs +130 -0
  53. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/index.qwik.mjs +130 -0
  54. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/map.qwik.cjs +23 -0
  55. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/map.qwik.mjs +24 -0
  56. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/number.qwik.cjs +19 -0
  57. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/number.qwik.mjs +20 -0
  58. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/object.qwik.cjs +24 -0
  59. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/object.qwik.mjs +25 -0
  60. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/promise.qwik.cjs +17 -0
  61. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/promise.qwik.mjs +18 -0
  62. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/regexp.qwik.cjs +9 -0
  63. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/regexp.qwik.mjs +10 -0
  64. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/set.qwik.cjs +16 -0
  65. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/set.qwik.mjs +17 -0
  66. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/string.qwik.cjs +23 -0
  67. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/string.qwik.mjs +24 -0
  68. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/symbol.qwik.cjs +8 -0
  69. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/symbol.qwik.mjs +9 -0
  70. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/typedarray.qwik.cjs +34 -0
  71. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/typedarray.qwik.mjs +35 -0
  72. package/lib/node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.qwik.cjs +979 -0
  73. package/lib/node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.qwik.mjs +979 -0
  74. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.qwik.cjs +101 -0
  75. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.qwik.mjs +101 -0
  76. package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +4 -0
  77. package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +5 -0
  78. package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +80 -0
  79. package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +80 -0
  80. package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.cjs +104 -0
  81. package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.mjs +104 -0
  82. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +8 -0
  83. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +8 -0
  84. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +56 -0
  85. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +56 -0
  86. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.cjs +66 -0
  87. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.mjs +66 -0
  88. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.nSCvwQ7l.qwik.cjs +2983 -0
  89. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.nSCvwQ7l.qwik.mjs +2983 -0
  90. package/lib-types/index.d.ts +1 -0
  91. package/lib-types/lib/qwik-mock.d.ts +34 -0
  92. package/package.json +53 -0
@@ -0,0 +1,2190 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { diff, printDiffOrStringify } from "../../../../../@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/diff.qwik.mjs";
5
+ import s from "../../../../../tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.mjs";
6
+ import { isMockFunction } from "../../../../../@vitest_spy@3.0.9/node_modules/@vitest/spy/dist/index.qwik.mjs";
7
+ import { processError } from "../../../../../@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/error.qwik.mjs";
8
+ import { use, util as utils_exports } from "../../../../../chai@5.2.0/node_modules/chai/chai.qwik.mjs";
9
+ import { getType, isObject, assertTypes } from "../../../../../@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.qwik.mjs";
10
+ import { s as stringify } from "../../../../../@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs";
11
+ const MATCHERS_OBJECT = Symbol.for("matchers-object");
12
+ const JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object");
13
+ const GLOBAL_EXPECT = Symbol.for("expect-global");
14
+ const ASYMMETRIC_MATCHERS_OBJECT = Symbol.for(
15
+ "asymmetric-matchers-object"
16
+ );
17
+ const customMatchers = {
18
+ toSatisfy(actual, expected, message) {
19
+ const { printReceived: printReceived2, printExpected: printExpected2, matcherHint: matcherHint2 } = this.utils;
20
+ const pass = expected(actual);
21
+ return {
22
+ pass,
23
+ message: () => pass ? `${matcherHint2(".not.toSatisfy", "received", "")}
24
+
25
+ Expected value to not satisfy:
26
+ ${message || printExpected2(expected)}
27
+ Received:
28
+ ${printReceived2(actual)}` : `${matcherHint2(".toSatisfy", "received", "")}
29
+
30
+ Expected value to satisfy:
31
+ ${message || printExpected2(expected)}
32
+
33
+ Received:
34
+ ${printReceived2(actual)}`
35
+ };
36
+ },
37
+ toBeOneOf(actual, expected) {
38
+ const { equals: equals2, customTesters } = this;
39
+ const { printReceived: printReceived2, printExpected: printExpected2, matcherHint: matcherHint2 } = this.utils;
40
+ if (!Array.isArray(expected)) {
41
+ throw new TypeError(
42
+ `You must provide an array to ${matcherHint2(".toBeOneOf")}, not '${typeof expected}'.`
43
+ );
44
+ }
45
+ const pass = expected.length === 0 || expected.some(
46
+ (item) => equals2(item, actual, customTesters)
47
+ );
48
+ return {
49
+ pass,
50
+ message: () => pass ? `${matcherHint2(".not.toBeOneOf", "received", "")}
51
+
52
+ Expected value to not be one of:
53
+ ${printExpected2(expected)}
54
+ Received:
55
+ ${printReceived2(actual)}` : `${matcherHint2(".toBeOneOf", "received", "")}
56
+
57
+ Expected value to be one of:
58
+ ${printExpected2(expected)}
59
+
60
+ Received:
61
+ ${printReceived2(actual)}`
62
+ };
63
+ }
64
+ };
65
+ const EXPECTED_COLOR = s.green;
66
+ const RECEIVED_COLOR = s.red;
67
+ const INVERTED_COLOR = s.inverse;
68
+ const BOLD_WEIGHT = s.bold;
69
+ const DIM_COLOR = s.dim;
70
+ function matcherHint(matcherName, received = "received", expected = "expected", options = {}) {
71
+ const {
72
+ comment = "",
73
+ isDirectExpectCall = false,
74
+ // seems redundant with received === ''
75
+ isNot = false,
76
+ promise = "",
77
+ secondArgument = "",
78
+ expectedColor = EXPECTED_COLOR,
79
+ receivedColor = RECEIVED_COLOR,
80
+ secondArgumentColor = EXPECTED_COLOR
81
+ } = options;
82
+ let hint = "";
83
+ let dimString = "expect";
84
+ if (!isDirectExpectCall && received !== "") {
85
+ hint += DIM_COLOR(`${dimString}(`) + receivedColor(received);
86
+ dimString = ")";
87
+ }
88
+ if (promise !== "") {
89
+ hint += DIM_COLOR(`${dimString}.`) + promise;
90
+ dimString = "";
91
+ }
92
+ if (isNot) {
93
+ hint += `${DIM_COLOR(`${dimString}.`)}not`;
94
+ dimString = "";
95
+ }
96
+ if (matcherName.includes(".")) {
97
+ dimString += matcherName;
98
+ } else {
99
+ hint += DIM_COLOR(`${dimString}.`) + matcherName;
100
+ dimString = "";
101
+ }
102
+ if (expected === "") {
103
+ dimString += "()";
104
+ } else {
105
+ hint += DIM_COLOR(`${dimString}(`) + expectedColor(expected);
106
+ if (secondArgument) {
107
+ hint += DIM_COLOR(", ") + secondArgumentColor(secondArgument);
108
+ }
109
+ dimString = ")";
110
+ }
111
+ if (comment !== "") {
112
+ dimString += ` // ${comment}`;
113
+ }
114
+ if (dimString !== "") {
115
+ hint += DIM_COLOR(dimString);
116
+ }
117
+ return hint;
118
+ }
119
+ const SPACE_SYMBOL = "·";
120
+ function replaceTrailingSpaces(text) {
121
+ return text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
122
+ }
123
+ function printReceived(object) {
124
+ return RECEIVED_COLOR(replaceTrailingSpaces(stringify(object)));
125
+ }
126
+ function printExpected(value) {
127
+ return EXPECTED_COLOR(replaceTrailingSpaces(stringify(value)));
128
+ }
129
+ function getMatcherUtils() {
130
+ return {
131
+ EXPECTED_COLOR,
132
+ RECEIVED_COLOR,
133
+ INVERTED_COLOR,
134
+ BOLD_WEIGHT,
135
+ DIM_COLOR,
136
+ diff,
137
+ matcherHint,
138
+ printReceived,
139
+ printExpected,
140
+ printDiffOrStringify
141
+ };
142
+ }
143
+ function addCustomEqualityTesters(newTesters) {
144
+ if (!Array.isArray(newTesters)) {
145
+ throw new TypeError(
146
+ `expect.customEqualityTesters: Must be set to an array of Testers. Was given "${getType(
147
+ newTesters
148
+ )}"`
149
+ );
150
+ }
151
+ globalThis[JEST_MATCHERS_OBJECT].customEqualityTesters.push(
152
+ ...newTesters
153
+ );
154
+ }
155
+ function getCustomEqualityTesters() {
156
+ return globalThis[JEST_MATCHERS_OBJECT].customEqualityTesters;
157
+ }
158
+ function equals(a, b, customTesters, strictCheck) {
159
+ customTesters = customTesters || [];
160
+ return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
161
+ }
162
+ function isAsymmetric(obj) {
163
+ return !!obj && typeof obj === "object" && "asymmetricMatch" in obj && isA("Function", obj.asymmetricMatch);
164
+ }
165
+ function asymmetricMatch(a, b) {
166
+ const asymmetricA = isAsymmetric(a);
167
+ const asymmetricB = isAsymmetric(b);
168
+ if (asymmetricA && asymmetricB) {
169
+ return void 0;
170
+ }
171
+ if (asymmetricA) {
172
+ return a.asymmetricMatch(b);
173
+ }
174
+ if (asymmetricB) {
175
+ return b.asymmetricMatch(a);
176
+ }
177
+ }
178
+ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
179
+ let result = true;
180
+ const asymmetricResult = asymmetricMatch(a, b);
181
+ if (asymmetricResult !== void 0) {
182
+ return asymmetricResult;
183
+ }
184
+ const testerContext = { equals };
185
+ for (let i = 0; i < customTesters.length; i++) {
186
+ const customTesterResult = customTesters[i].call(
187
+ testerContext,
188
+ a,
189
+ b,
190
+ customTesters
191
+ );
192
+ if (customTesterResult !== void 0) {
193
+ return customTesterResult;
194
+ }
195
+ }
196
+ if (typeof URL === "function" && a instanceof URL && b instanceof URL) {
197
+ return a.href === b.href;
198
+ }
199
+ if (Object.is(a, b)) {
200
+ return true;
201
+ }
202
+ if (a === null || b === null) {
203
+ return a === b;
204
+ }
205
+ const className = Object.prototype.toString.call(a);
206
+ if (className !== Object.prototype.toString.call(b)) {
207
+ return false;
208
+ }
209
+ switch (className) {
210
+ case "[object Boolean]":
211
+ case "[object String]":
212
+ case "[object Number]":
213
+ if (typeof a !== typeof b) {
214
+ return false;
215
+ } else if (typeof a !== "object" && typeof b !== "object") {
216
+ return Object.is(a, b);
217
+ } else {
218
+ return Object.is(a.valueOf(), b.valueOf());
219
+ }
220
+ case "[object Date]": {
221
+ const numA = +a;
222
+ const numB = +b;
223
+ return numA === numB || Number.isNaN(numA) && Number.isNaN(numB);
224
+ }
225
+ // RegExps are compared by their source patterns and flags.
226
+ case "[object RegExp]":
227
+ return a.source === b.source && a.flags === b.flags;
228
+ }
229
+ if (typeof a !== "object" || typeof b !== "object") {
230
+ return false;
231
+ }
232
+ if (isDomNode(a) && isDomNode(b)) {
233
+ return a.isEqualNode(b);
234
+ }
235
+ let length = aStack.length;
236
+ while (length--) {
237
+ if (aStack[length] === a) {
238
+ return bStack[length] === b;
239
+ } else if (bStack[length] === b) {
240
+ return false;
241
+ }
242
+ }
243
+ aStack.push(a);
244
+ bStack.push(b);
245
+ if (className === "[object Array]" && a.length !== b.length) {
246
+ return false;
247
+ }
248
+ if (a instanceof Error && b instanceof Error) {
249
+ try {
250
+ return isErrorEqual(a, b, aStack, bStack, customTesters, hasKey2);
251
+ } finally {
252
+ aStack.pop();
253
+ bStack.pop();
254
+ }
255
+ }
256
+ const aKeys = keys(a, hasKey2);
257
+ let key;
258
+ let size = aKeys.length;
259
+ if (keys(b, hasKey2).length !== size) {
260
+ return false;
261
+ }
262
+ while (size--) {
263
+ key = aKeys[size];
264
+ result = hasKey2(b, key) && eq(a[key], b[key], aStack, bStack, customTesters, hasKey2);
265
+ if (!result) {
266
+ return false;
267
+ }
268
+ }
269
+ aStack.pop();
270
+ bStack.pop();
271
+ return result;
272
+ }
273
+ function isErrorEqual(a, b, aStack, bStack, customTesters, hasKey2) {
274
+ let result = Object.getPrototypeOf(a) === Object.getPrototypeOf(b) && a.name === b.name && a.message === b.message;
275
+ if (typeof b.cause !== "undefined") {
276
+ result && (result = eq(a.cause, b.cause, aStack, bStack, customTesters, hasKey2));
277
+ }
278
+ if (a instanceof AggregateError && b instanceof AggregateError) {
279
+ result && (result = eq(a.errors, b.errors, aStack, bStack, customTesters, hasKey2));
280
+ }
281
+ result && (result = eq({ ...a }, { ...b }, aStack, bStack, customTesters, hasKey2));
282
+ return result;
283
+ }
284
+ function keys(obj, hasKey2) {
285
+ const keys2 = [];
286
+ for (const key in obj) {
287
+ if (hasKey2(obj, key)) {
288
+ keys2.push(key);
289
+ }
290
+ }
291
+ return keys2.concat(
292
+ Object.getOwnPropertySymbols(obj).filter(
293
+ (symbol) => Object.getOwnPropertyDescriptor(obj, symbol).enumerable
294
+ )
295
+ );
296
+ }
297
+ function hasDefinedKey(obj, key) {
298
+ return hasKey(obj, key) && obj[key] !== void 0;
299
+ }
300
+ function hasKey(obj, key) {
301
+ return Object.prototype.hasOwnProperty.call(obj, key);
302
+ }
303
+ function isA(typeName, value) {
304
+ return Object.prototype.toString.apply(value) === `[object ${typeName}]`;
305
+ }
306
+ function isDomNode(obj) {
307
+ return obj !== null && typeof obj === "object" && "nodeType" in obj && typeof obj.nodeType === "number" && "nodeName" in obj && typeof obj.nodeName === "string" && "isEqualNode" in obj && typeof obj.isEqualNode === "function";
308
+ }
309
+ const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
310
+ const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
311
+ const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
312
+ const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
313
+ const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
314
+ function isImmutableUnorderedKeyed(maybeKeyed) {
315
+ return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL] && !maybeKeyed[IS_ORDERED_SENTINEL]);
316
+ }
317
+ function isImmutableUnorderedSet(maybeSet) {
318
+ return !!(maybeSet && maybeSet[IS_SET_SENTINEL] && !maybeSet[IS_ORDERED_SENTINEL]);
319
+ }
320
+ function isObjectLiteral(source) {
321
+ return source != null && typeof source === "object" && !Array.isArray(source);
322
+ }
323
+ function isImmutableList(source) {
324
+ return Boolean(source && isObjectLiteral(source) && source[IS_LIST_SENTINEL]);
325
+ }
326
+ function isImmutableOrderedKeyed(source) {
327
+ return Boolean(
328
+ source && isObjectLiteral(source) && source[IS_KEYED_SENTINEL] && source[IS_ORDERED_SENTINEL]
329
+ );
330
+ }
331
+ function isImmutableOrderedSet(source) {
332
+ return Boolean(
333
+ source && isObjectLiteral(source) && source[IS_SET_SENTINEL] && source[IS_ORDERED_SENTINEL]
334
+ );
335
+ }
336
+ function isImmutableRecord(source) {
337
+ return Boolean(source && isObjectLiteral(source) && source[IS_RECORD_SYMBOL]);
338
+ }
339
+ const IteratorSymbol = Symbol.iterator;
340
+ function hasIterator(object) {
341
+ return !!(object != null && object[IteratorSymbol]);
342
+ }
343
+ function iterableEquality(a, b, customTesters = [], aStack = [], bStack = []) {
344
+ if (typeof a !== "object" || typeof b !== "object" || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) {
345
+ return void 0;
346
+ }
347
+ if (a.constructor !== b.constructor) {
348
+ return false;
349
+ }
350
+ let length = aStack.length;
351
+ while (length--) {
352
+ if (aStack[length] === a) {
353
+ return bStack[length] === b;
354
+ }
355
+ }
356
+ aStack.push(a);
357
+ bStack.push(b);
358
+ const filteredCustomTesters = [
359
+ ...customTesters.filter((t) => t !== iterableEquality),
360
+ iterableEqualityWithStack
361
+ ];
362
+ function iterableEqualityWithStack(a2, b2) {
363
+ return iterableEquality(a2, b2, [...customTesters], [...aStack], [...bStack]);
364
+ }
365
+ if (a.size !== void 0) {
366
+ if (a.size !== b.size) {
367
+ return false;
368
+ } else if (isA("Set", a) || isImmutableUnorderedSet(a)) {
369
+ let allFound = true;
370
+ for (const aValue of a) {
371
+ if (!b.has(aValue)) {
372
+ let has = false;
373
+ for (const bValue of b) {
374
+ const isEqual = equals(aValue, bValue, filteredCustomTesters);
375
+ if (isEqual === true) {
376
+ has = true;
377
+ }
378
+ }
379
+ if (has === false) {
380
+ allFound = false;
381
+ break;
382
+ }
383
+ }
384
+ }
385
+ aStack.pop();
386
+ bStack.pop();
387
+ return allFound;
388
+ } else if (isA("Map", a) || isImmutableUnorderedKeyed(a)) {
389
+ let allFound = true;
390
+ for (const aEntry of a) {
391
+ if (!b.has(aEntry[0]) || !equals(aEntry[1], b.get(aEntry[0]), filteredCustomTesters)) {
392
+ let has = false;
393
+ for (const bEntry of b) {
394
+ const matchedKey = equals(
395
+ aEntry[0],
396
+ bEntry[0],
397
+ filteredCustomTesters
398
+ );
399
+ let matchedValue = false;
400
+ if (matchedKey === true) {
401
+ matchedValue = equals(
402
+ aEntry[1],
403
+ bEntry[1],
404
+ filteredCustomTesters
405
+ );
406
+ }
407
+ if (matchedValue === true) {
408
+ has = true;
409
+ }
410
+ }
411
+ if (has === false) {
412
+ allFound = false;
413
+ break;
414
+ }
415
+ }
416
+ }
417
+ aStack.pop();
418
+ bStack.pop();
419
+ return allFound;
420
+ }
421
+ }
422
+ const bIterator = b[IteratorSymbol]();
423
+ for (const aValue of a) {
424
+ const nextB = bIterator.next();
425
+ if (nextB.done || !equals(aValue, nextB.value, filteredCustomTesters)) {
426
+ return false;
427
+ }
428
+ }
429
+ if (!bIterator.next().done) {
430
+ return false;
431
+ }
432
+ if (!isImmutableList(a) && !isImmutableOrderedKeyed(a) && !isImmutableOrderedSet(a) && !isImmutableRecord(a)) {
433
+ const aEntries = Object.entries(a);
434
+ const bEntries = Object.entries(b);
435
+ if (!equals(aEntries, bEntries)) {
436
+ return false;
437
+ }
438
+ }
439
+ aStack.pop();
440
+ bStack.pop();
441
+ return true;
442
+ }
443
+ function hasPropertyInObject(object, key) {
444
+ const shouldTerminate = !object || typeof object !== "object" || object === Object.prototype;
445
+ if (shouldTerminate) {
446
+ return false;
447
+ }
448
+ return Object.prototype.hasOwnProperty.call(object, key) || hasPropertyInObject(Object.getPrototypeOf(object), key);
449
+ }
450
+ function isObjectWithKeys(a) {
451
+ return isObject(a) && !(a instanceof Error) && !Array.isArray(a) && !(a instanceof Date);
452
+ }
453
+ function subsetEquality(object, subset, customTesters = []) {
454
+ const filteredCustomTesters = customTesters.filter(
455
+ (t) => t !== subsetEquality
456
+ );
457
+ const subsetEqualityWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => (object2, subset2) => {
458
+ if (!isObjectWithKeys(subset2)) {
459
+ return void 0;
460
+ }
461
+ return Object.keys(subset2).every((key) => {
462
+ if (subset2[key] != null && typeof subset2[key] === "object") {
463
+ if (seenReferences.has(subset2[key])) {
464
+ return equals(object2[key], subset2[key], filteredCustomTesters);
465
+ }
466
+ seenReferences.set(subset2[key], true);
467
+ }
468
+ const result = object2 != null && hasPropertyInObject(object2, key) && equals(object2[key], subset2[key], [
469
+ ...filteredCustomTesters,
470
+ subsetEqualityWithContext(seenReferences)
471
+ ]);
472
+ seenReferences.delete(subset2[key]);
473
+ return result;
474
+ });
475
+ };
476
+ return subsetEqualityWithContext()(object, subset);
477
+ }
478
+ function typeEquality(a, b) {
479
+ if (a == null || b == null || a.constructor === b.constructor) {
480
+ return void 0;
481
+ }
482
+ return false;
483
+ }
484
+ function arrayBufferEquality(a, b) {
485
+ let dataViewA = a;
486
+ let dataViewB = b;
487
+ if (!(a instanceof DataView && b instanceof DataView)) {
488
+ if (!(a instanceof ArrayBuffer) || !(b instanceof ArrayBuffer)) {
489
+ return void 0;
490
+ }
491
+ try {
492
+ dataViewA = new DataView(a);
493
+ dataViewB = new DataView(b);
494
+ } catch {
495
+ return void 0;
496
+ }
497
+ }
498
+ if (dataViewA.byteLength !== dataViewB.byteLength) {
499
+ return false;
500
+ }
501
+ for (let i = 0; i < dataViewA.byteLength; i++) {
502
+ if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) {
503
+ return false;
504
+ }
505
+ }
506
+ return true;
507
+ }
508
+ function sparseArrayEquality(a, b, customTesters = []) {
509
+ if (!Array.isArray(a) || !Array.isArray(b)) {
510
+ return void 0;
511
+ }
512
+ const aKeys = Object.keys(a);
513
+ const bKeys = Object.keys(b);
514
+ const filteredCustomTesters = customTesters.filter(
515
+ (t) => t !== sparseArrayEquality
516
+ );
517
+ return equals(a, b, filteredCustomTesters, true) && equals(aKeys, bKeys);
518
+ }
519
+ function generateToBeMessage(deepEqualityName, expected = "#{this}", actual = "#{exp}") {
520
+ const toBeMessage = `expected ${expected} to be ${actual} // Object.is equality`;
521
+ if (["toStrictEqual", "toEqual"].includes(deepEqualityName)) {
522
+ return `${toBeMessage}
523
+
524
+ If it should pass with deep equality, replace "toBe" with "${deepEqualityName}"
525
+
526
+ Expected: ${expected}
527
+ Received: serializes to the same string
528
+ `;
529
+ }
530
+ return toBeMessage;
531
+ }
532
+ function pluralize(word, count) {
533
+ return `${count} ${word}${count === 1 ? "" : "s"}`;
534
+ }
535
+ function getObjectKeys(object) {
536
+ return [
537
+ ...Object.keys(object),
538
+ ...Object.getOwnPropertySymbols(object).filter(
539
+ (s2) => {
540
+ var _a;
541
+ return (_a = Object.getOwnPropertyDescriptor(object, s2)) == null ? void 0 : _a.enumerable;
542
+ }
543
+ )
544
+ ];
545
+ }
546
+ function getObjectSubset(object, subset, customTesters) {
547
+ let stripped = 0;
548
+ const getObjectSubsetWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => (object2, subset2) => {
549
+ if (Array.isArray(object2)) {
550
+ if (Array.isArray(subset2) && subset2.length === object2.length) {
551
+ return subset2.map(
552
+ (sub, i) => getObjectSubsetWithContext(seenReferences)(object2[i], sub)
553
+ );
554
+ }
555
+ } else if (object2 instanceof Date) {
556
+ return object2;
557
+ } else if (isObject(object2) && isObject(subset2)) {
558
+ if (equals(object2, subset2, [
559
+ ...customTesters,
560
+ iterableEquality,
561
+ subsetEquality
562
+ ])) {
563
+ return subset2;
564
+ }
565
+ const trimmed = {};
566
+ seenReferences.set(object2, trimmed);
567
+ if (typeof object2.constructor === "function" && typeof object2.constructor.name === "string") {
568
+ Object.defineProperty(trimmed, "constructor", {
569
+ enumerable: false,
570
+ value: object2.constructor
571
+ });
572
+ }
573
+ for (const key of getObjectKeys(object2)) {
574
+ if (hasPropertyInObject(subset2, key)) {
575
+ trimmed[key] = seenReferences.has(object2[key]) ? seenReferences.get(object2[key]) : getObjectSubsetWithContext(seenReferences)(
576
+ object2[key],
577
+ subset2[key]
578
+ );
579
+ } else {
580
+ if (!seenReferences.has(object2[key])) {
581
+ stripped += 1;
582
+ if (isObject(object2[key])) {
583
+ stripped += getObjectKeys(object2[key]).length;
584
+ }
585
+ getObjectSubsetWithContext(seenReferences)(
586
+ object2[key],
587
+ subset2[key]
588
+ );
589
+ }
590
+ }
591
+ }
592
+ if (getObjectKeys(trimmed).length > 0) {
593
+ return trimmed;
594
+ }
595
+ }
596
+ return object2;
597
+ };
598
+ return { subset: getObjectSubsetWithContext()(object, subset), stripped };
599
+ }
600
+ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
601
+ const globalState = /* @__PURE__ */ new WeakMap();
602
+ const matchers = /* @__PURE__ */ Object.create(null);
603
+ const customEqualityTesters = [];
604
+ const asymmetricMatchers = /* @__PURE__ */ Object.create(null);
605
+ Object.defineProperty(globalThis, MATCHERS_OBJECT, {
606
+ get: () => globalState
607
+ });
608
+ Object.defineProperty(globalThis, JEST_MATCHERS_OBJECT, {
609
+ configurable: true,
610
+ get: () => ({
611
+ state: globalState.get(globalThis[GLOBAL_EXPECT]),
612
+ matchers,
613
+ customEqualityTesters
614
+ })
615
+ });
616
+ Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, {
617
+ get: () => asymmetricMatchers
618
+ });
619
+ }
620
+ function getState(expect) {
621
+ return globalThis[MATCHERS_OBJECT].get(expect);
622
+ }
623
+ function setState(state, expect) {
624
+ const map = globalThis[MATCHERS_OBJECT];
625
+ const current = map.get(expect) || {};
626
+ const results = Object.defineProperties(current, {
627
+ ...Object.getOwnPropertyDescriptors(current),
628
+ ...Object.getOwnPropertyDescriptors(state)
629
+ });
630
+ map.set(expect, results);
631
+ }
632
+ class AsymmetricMatcher {
633
+ constructor(sample, inverse = false) {
634
+ // should have "jest" to be compatible with its ecosystem
635
+ __publicField(this, "$$typeof", Symbol.for("jest.asymmetricMatcher"));
636
+ this.sample = sample;
637
+ this.inverse = inverse;
638
+ }
639
+ getMatcherContext(expect) {
640
+ return {
641
+ ...getState(expect || globalThis[GLOBAL_EXPECT]),
642
+ equals,
643
+ isNot: this.inverse,
644
+ customTesters: getCustomEqualityTesters(),
645
+ utils: {
646
+ ...getMatcherUtils(),
647
+ diff,
648
+ stringify,
649
+ iterableEquality,
650
+ subsetEquality
651
+ }
652
+ };
653
+ }
654
+ }
655
+ AsymmetricMatcher.prototype[Symbol.for("chai/inspect")] = function(options) {
656
+ const result = stringify(this, options.depth, { min: true });
657
+ if (result.length <= options.truncate) {
658
+ return result;
659
+ }
660
+ return `${this.toString()}{…}`;
661
+ };
662
+ class StringContaining extends AsymmetricMatcher {
663
+ constructor(sample, inverse = false) {
664
+ if (!isA("String", sample)) {
665
+ throw new Error("Expected is not a string");
666
+ }
667
+ super(sample, inverse);
668
+ }
669
+ asymmetricMatch(other) {
670
+ const result = isA("String", other) && other.includes(this.sample);
671
+ return this.inverse ? !result : result;
672
+ }
673
+ toString() {
674
+ return `String${this.inverse ? "Not" : ""}Containing`;
675
+ }
676
+ getExpectedType() {
677
+ return "string";
678
+ }
679
+ }
680
+ class Anything extends AsymmetricMatcher {
681
+ asymmetricMatch(other) {
682
+ return other != null;
683
+ }
684
+ toString() {
685
+ return "Anything";
686
+ }
687
+ toAsymmetricMatcher() {
688
+ return "Anything";
689
+ }
690
+ }
691
+ class ObjectContaining extends AsymmetricMatcher {
692
+ constructor(sample, inverse = false) {
693
+ super(sample, inverse);
694
+ }
695
+ getPrototype(obj) {
696
+ if (Object.getPrototypeOf) {
697
+ return Object.getPrototypeOf(obj);
698
+ }
699
+ if (obj.constructor.prototype === obj) {
700
+ return null;
701
+ }
702
+ return obj.constructor.prototype;
703
+ }
704
+ hasProperty(obj, property) {
705
+ if (!obj) {
706
+ return false;
707
+ }
708
+ if (Object.prototype.hasOwnProperty.call(obj, property)) {
709
+ return true;
710
+ }
711
+ return this.hasProperty(this.getPrototype(obj), property);
712
+ }
713
+ asymmetricMatch(other) {
714
+ if (typeof this.sample !== "object") {
715
+ throw new TypeError(
716
+ `You must provide an object to ${this.toString()}, not '${typeof this.sample}'.`
717
+ );
718
+ }
719
+ let result = true;
720
+ const matcherContext = this.getMatcherContext();
721
+ for (const property in this.sample) {
722
+ if (!this.hasProperty(other, property) || !equals(
723
+ this.sample[property],
724
+ other[property],
725
+ matcherContext.customTesters
726
+ )) {
727
+ result = false;
728
+ break;
729
+ }
730
+ }
731
+ return this.inverse ? !result : result;
732
+ }
733
+ toString() {
734
+ return `Object${this.inverse ? "Not" : ""}Containing`;
735
+ }
736
+ getExpectedType() {
737
+ return "object";
738
+ }
739
+ }
740
+ class ArrayContaining extends AsymmetricMatcher {
741
+ constructor(sample, inverse = false) {
742
+ super(sample, inverse);
743
+ }
744
+ asymmetricMatch(other) {
745
+ if (!Array.isArray(this.sample)) {
746
+ throw new TypeError(
747
+ `You must provide an array to ${this.toString()}, not '${typeof this.sample}'.`
748
+ );
749
+ }
750
+ const matcherContext = this.getMatcherContext();
751
+ const result = this.sample.length === 0 || Array.isArray(other) && this.sample.every(
752
+ (item) => other.some(
753
+ (another) => equals(item, another, matcherContext.customTesters)
754
+ )
755
+ );
756
+ return this.inverse ? !result : result;
757
+ }
758
+ toString() {
759
+ return `Array${this.inverse ? "Not" : ""}Containing`;
760
+ }
761
+ getExpectedType() {
762
+ return "array";
763
+ }
764
+ }
765
+ class Any extends AsymmetricMatcher {
766
+ constructor(sample) {
767
+ if (typeof sample === "undefined") {
768
+ throw new TypeError(
769
+ "any() expects to be passed a constructor function. Please pass one or use anything() to match any object."
770
+ );
771
+ }
772
+ super(sample);
773
+ }
774
+ fnNameFor(func) {
775
+ if (func.name) {
776
+ return func.name;
777
+ }
778
+ const functionToString = Function.prototype.toString;
779
+ const matches = functionToString.call(func).match(/^(?:async)?\s*function\s*(?:\*\s*)?([\w$]+)\s*\(/);
780
+ return matches ? matches[1] : "<anonymous>";
781
+ }
782
+ asymmetricMatch(other) {
783
+ if (this.sample === String) {
784
+ return typeof other == "string" || other instanceof String;
785
+ }
786
+ if (this.sample === Number) {
787
+ return typeof other == "number" || other instanceof Number;
788
+ }
789
+ if (this.sample === Function) {
790
+ return typeof other == "function" || typeof other === "function";
791
+ }
792
+ if (this.sample === Boolean) {
793
+ return typeof other == "boolean" || other instanceof Boolean;
794
+ }
795
+ if (this.sample === BigInt) {
796
+ return typeof other == "bigint" || other instanceof BigInt;
797
+ }
798
+ if (this.sample === Symbol) {
799
+ return typeof other == "symbol" || other instanceof Symbol;
800
+ }
801
+ if (this.sample === Object) {
802
+ return typeof other == "object";
803
+ }
804
+ return other instanceof this.sample;
805
+ }
806
+ toString() {
807
+ return "Any";
808
+ }
809
+ getExpectedType() {
810
+ if (this.sample === String) {
811
+ return "string";
812
+ }
813
+ if (this.sample === Number) {
814
+ return "number";
815
+ }
816
+ if (this.sample === Function) {
817
+ return "function";
818
+ }
819
+ if (this.sample === Object) {
820
+ return "object";
821
+ }
822
+ if (this.sample === Boolean) {
823
+ return "boolean";
824
+ }
825
+ return this.fnNameFor(this.sample);
826
+ }
827
+ toAsymmetricMatcher() {
828
+ return `Any<${this.fnNameFor(this.sample)}>`;
829
+ }
830
+ }
831
+ class StringMatching extends AsymmetricMatcher {
832
+ constructor(sample, inverse = false) {
833
+ if (!isA("String", sample) && !isA("RegExp", sample)) {
834
+ throw new Error("Expected is not a String or a RegExp");
835
+ }
836
+ super(new RegExp(sample), inverse);
837
+ }
838
+ asymmetricMatch(other) {
839
+ const result = isA("String", other) && this.sample.test(other);
840
+ return this.inverse ? !result : result;
841
+ }
842
+ toString() {
843
+ return `String${this.inverse ? "Not" : ""}Matching`;
844
+ }
845
+ getExpectedType() {
846
+ return "string";
847
+ }
848
+ }
849
+ class CloseTo extends AsymmetricMatcher {
850
+ constructor(sample, precision = 2, inverse = false) {
851
+ if (!isA("Number", sample)) {
852
+ throw new Error("Expected is not a Number");
853
+ }
854
+ if (!isA("Number", precision)) {
855
+ throw new Error("Precision is not a Number");
856
+ }
857
+ super(sample);
858
+ __publicField(this, "precision");
859
+ this.inverse = inverse;
860
+ this.precision = precision;
861
+ }
862
+ asymmetricMatch(other) {
863
+ if (!isA("Number", other)) {
864
+ return false;
865
+ }
866
+ let result = false;
867
+ if (other === Number.POSITIVE_INFINITY && this.sample === Number.POSITIVE_INFINITY) {
868
+ result = true;
869
+ } else if (other === Number.NEGATIVE_INFINITY && this.sample === Number.NEGATIVE_INFINITY) {
870
+ result = true;
871
+ } else {
872
+ result = Math.abs(this.sample - other) < 10 ** -this.precision / 2;
873
+ }
874
+ return this.inverse ? !result : result;
875
+ }
876
+ toString() {
877
+ return `Number${this.inverse ? "Not" : ""}CloseTo`;
878
+ }
879
+ getExpectedType() {
880
+ return "number";
881
+ }
882
+ toAsymmetricMatcher() {
883
+ return [
884
+ this.toString(),
885
+ this.sample,
886
+ `(${pluralize("digit", this.precision)})`
887
+ ].join(" ");
888
+ }
889
+ }
890
+ const JestAsymmetricMatchers = (chai, utils) => {
891
+ utils.addMethod(chai.expect, "anything", () => new Anything());
892
+ utils.addMethod(chai.expect, "any", (expected) => new Any(expected));
893
+ utils.addMethod(
894
+ chai.expect,
895
+ "stringContaining",
896
+ (expected) => new StringContaining(expected)
897
+ );
898
+ utils.addMethod(
899
+ chai.expect,
900
+ "objectContaining",
901
+ (expected) => new ObjectContaining(expected)
902
+ );
903
+ utils.addMethod(
904
+ chai.expect,
905
+ "arrayContaining",
906
+ (expected) => new ArrayContaining(expected)
907
+ );
908
+ utils.addMethod(
909
+ chai.expect,
910
+ "stringMatching",
911
+ (expected) => new StringMatching(expected)
912
+ );
913
+ utils.addMethod(
914
+ chai.expect,
915
+ "closeTo",
916
+ (expected, precision) => new CloseTo(expected, precision)
917
+ );
918
+ chai.expect.not = {
919
+ stringContaining: (expected) => new StringContaining(expected, true),
920
+ objectContaining: (expected) => new ObjectContaining(expected, true),
921
+ arrayContaining: (expected) => new ArrayContaining(expected, true),
922
+ stringMatching: (expected) => new StringMatching(expected, true),
923
+ closeTo: (expected, precision) => new CloseTo(expected, precision, true)
924
+ };
925
+ };
926
+ function createAssertionMessage(util, assertion, hasArgs) {
927
+ const not = util.flag(assertion, "negate") ? "not." : "";
928
+ const name = `${util.flag(assertion, "_name")}(${hasArgs ? "expected" : ""})`;
929
+ const promiseName = util.flag(assertion, "promise");
930
+ const promise = promiseName ? `.${promiseName}` : "";
931
+ return `expect(actual)${promise}.${not}${name}`;
932
+ }
933
+ function recordAsyncExpect(_test, promise, assertion, error) {
934
+ const test = _test;
935
+ if (test && promise instanceof Promise) {
936
+ promise = promise.finally(() => {
937
+ if (!test.promises) {
938
+ return;
939
+ }
940
+ const index = test.promises.indexOf(promise);
941
+ if (index !== -1) {
942
+ test.promises.splice(index, 1);
943
+ }
944
+ });
945
+ if (!test.promises) {
946
+ test.promises = [];
947
+ }
948
+ test.promises.push(promise);
949
+ let resolved = false;
950
+ test.onFinished ?? (test.onFinished = []);
951
+ test.onFinished.push(() => {
952
+ var _a;
953
+ if (!resolved) {
954
+ const processor = ((_a = globalThis.__vitest_worker__) == null ? void 0 : _a.onFilterStackTrace) || ((s2) => s2 || "");
955
+ const stack = processor(error.stack);
956
+ console.warn([
957
+ `Promise returned by \`${assertion}\` was not awaited. `,
958
+ "Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. ",
959
+ "Please remember to await the assertion.\n",
960
+ stack
961
+ ].join(""));
962
+ }
963
+ });
964
+ return {
965
+ then(onFulfilled, onRejected) {
966
+ resolved = true;
967
+ return promise.then(onFulfilled, onRejected);
968
+ },
969
+ catch(onRejected) {
970
+ return promise.catch(onRejected);
971
+ },
972
+ finally(onFinally) {
973
+ return promise.finally(onFinally);
974
+ },
975
+ [Symbol.toStringTag]: "Promise"
976
+ };
977
+ }
978
+ return promise;
979
+ }
980
+ function wrapAssertion(utils, name, fn) {
981
+ return function(...args) {
982
+ var _a;
983
+ if (name !== "withTest") {
984
+ utils.flag(this, "_name", name);
985
+ }
986
+ if (!utils.flag(this, "soft")) {
987
+ return fn.apply(this, args);
988
+ }
989
+ const test = utils.flag(this, "vitest-test");
990
+ if (!test) {
991
+ throw new Error("expect.soft() can only be used inside a test");
992
+ }
993
+ try {
994
+ return fn.apply(this, args);
995
+ } catch (err) {
996
+ test.result || (test.result = { state: "fail" });
997
+ test.result.state = "fail";
998
+ (_a = test.result).errors || (_a.errors = []);
999
+ test.result.errors.push(processError(err));
1000
+ }
1001
+ };
1002
+ }
1003
+ const JestChaiExpect = (chai, utils) => {
1004
+ const { AssertionError } = chai;
1005
+ const customTesters = getCustomEqualityTesters();
1006
+ function def(name, fn) {
1007
+ const addMethod = (n) => {
1008
+ const softWrapper = wrapAssertion(utils, n, fn);
1009
+ utils.addMethod(chai.Assertion.prototype, n, softWrapper);
1010
+ utils.addMethod(
1011
+ globalThis[JEST_MATCHERS_OBJECT].matchers,
1012
+ n,
1013
+ softWrapper
1014
+ );
1015
+ };
1016
+ if (Array.isArray(name)) {
1017
+ name.forEach((n) => addMethod(n));
1018
+ } else {
1019
+ addMethod(name);
1020
+ }
1021
+ }
1022
+ ["throw", "throws", "Throw"].forEach((m) => {
1023
+ utils.overwriteMethod(chai.Assertion.prototype, m, (_super) => {
1024
+ return function(...args) {
1025
+ const promise = utils.flag(this, "promise");
1026
+ const object = utils.flag(this, "object");
1027
+ const isNot = utils.flag(this, "negate");
1028
+ if (promise === "rejects") {
1029
+ utils.flag(this, "object", () => {
1030
+ throw object;
1031
+ });
1032
+ } else if (promise === "resolves" && typeof object !== "function") {
1033
+ if (!isNot) {
1034
+ const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
1035
+ const error = {
1036
+ showDiff: false
1037
+ };
1038
+ throw new AssertionError(message, error, utils.flag(this, "ssfi"));
1039
+ } else {
1040
+ return;
1041
+ }
1042
+ }
1043
+ _super.apply(this, args);
1044
+ };
1045
+ });
1046
+ });
1047
+ def("withTest", function(test) {
1048
+ utils.flag(this, "vitest-test", test);
1049
+ return this;
1050
+ });
1051
+ def("toEqual", function(expected) {
1052
+ const actual = utils.flag(this, "object");
1053
+ const equal = equals(actual, expected, [
1054
+ ...customTesters,
1055
+ iterableEquality
1056
+ ]);
1057
+ return this.assert(
1058
+ equal,
1059
+ "expected #{this} to deeply equal #{exp}",
1060
+ "expected #{this} to not deeply equal #{exp}",
1061
+ expected,
1062
+ actual
1063
+ );
1064
+ });
1065
+ def("toStrictEqual", function(expected) {
1066
+ const obj = utils.flag(this, "object");
1067
+ const equal = equals(
1068
+ obj,
1069
+ expected,
1070
+ [
1071
+ ...customTesters,
1072
+ iterableEquality,
1073
+ typeEquality,
1074
+ sparseArrayEquality,
1075
+ arrayBufferEquality
1076
+ ],
1077
+ true
1078
+ );
1079
+ return this.assert(
1080
+ equal,
1081
+ "expected #{this} to strictly equal #{exp}",
1082
+ "expected #{this} to not strictly equal #{exp}",
1083
+ expected,
1084
+ obj
1085
+ );
1086
+ });
1087
+ def("toBe", function(expected) {
1088
+ const actual = this._obj;
1089
+ const pass = Object.is(actual, expected);
1090
+ let deepEqualityName = "";
1091
+ if (!pass) {
1092
+ const toStrictEqualPass = equals(
1093
+ actual,
1094
+ expected,
1095
+ [
1096
+ ...customTesters,
1097
+ iterableEquality,
1098
+ typeEquality,
1099
+ sparseArrayEquality,
1100
+ arrayBufferEquality
1101
+ ],
1102
+ true
1103
+ );
1104
+ if (toStrictEqualPass) {
1105
+ deepEqualityName = "toStrictEqual";
1106
+ } else {
1107
+ const toEqualPass = equals(actual, expected, [
1108
+ ...customTesters,
1109
+ iterableEquality
1110
+ ]);
1111
+ if (toEqualPass) {
1112
+ deepEqualityName = "toEqual";
1113
+ }
1114
+ }
1115
+ }
1116
+ return this.assert(
1117
+ pass,
1118
+ generateToBeMessage(deepEqualityName),
1119
+ "expected #{this} not to be #{exp} // Object.is equality",
1120
+ expected,
1121
+ actual
1122
+ );
1123
+ });
1124
+ def("toMatchObject", function(expected) {
1125
+ const actual = this._obj;
1126
+ const pass = equals(actual, expected, [
1127
+ ...customTesters,
1128
+ iterableEquality,
1129
+ subsetEquality
1130
+ ]);
1131
+ const isNot = utils.flag(this, "negate");
1132
+ const { subset: actualSubset, stripped } = getObjectSubset(
1133
+ actual,
1134
+ expected,
1135
+ customTesters
1136
+ );
1137
+ if (pass && isNot || !pass && !isNot) {
1138
+ const msg = utils.getMessage(this, [
1139
+ pass,
1140
+ "expected #{this} to match object #{exp}",
1141
+ "expected #{this} to not match object #{exp}",
1142
+ expected,
1143
+ actualSubset,
1144
+ false
1145
+ ]);
1146
+ const message = stripped === 0 ? msg : `${msg}
1147
+ (${stripped} matching ${stripped === 1 ? "property" : "properties"} omitted from actual)`;
1148
+ throw new AssertionError(message, {
1149
+ showDiff: true,
1150
+ expected,
1151
+ actual: actualSubset
1152
+ });
1153
+ }
1154
+ });
1155
+ def("toMatch", function(expected) {
1156
+ const actual = this._obj;
1157
+ if (typeof actual !== "string") {
1158
+ throw new TypeError(
1159
+ `.toMatch() expects to receive a string, but got ${typeof actual}`
1160
+ );
1161
+ }
1162
+ return this.assert(
1163
+ typeof expected === "string" ? actual.includes(expected) : actual.match(expected),
1164
+ `expected #{this} to match #{exp}`,
1165
+ `expected #{this} not to match #{exp}`,
1166
+ expected,
1167
+ actual
1168
+ );
1169
+ });
1170
+ def("toContain", function(item) {
1171
+ const actual = this._obj;
1172
+ if (typeof Node !== "undefined" && actual instanceof Node) {
1173
+ if (!(item instanceof Node)) {
1174
+ throw new TypeError(
1175
+ `toContain() expected a DOM node as the argument, but got ${typeof item}`
1176
+ );
1177
+ }
1178
+ return this.assert(
1179
+ actual.contains(item),
1180
+ "expected #{this} to contain element #{exp}",
1181
+ "expected #{this} not to contain element #{exp}",
1182
+ item,
1183
+ actual
1184
+ );
1185
+ }
1186
+ if (typeof DOMTokenList !== "undefined" && actual instanceof DOMTokenList) {
1187
+ assertTypes(item, "class name", ["string"]);
1188
+ const isNot = utils.flag(this, "negate");
1189
+ const expectedClassList = isNot ? actual.value.replace(item, "").trim() : `${actual.value} ${item}`;
1190
+ return this.assert(
1191
+ actual.contains(item),
1192
+ `expected "${actual.value}" to contain "${item}"`,
1193
+ `expected "${actual.value}" not to contain "${item}"`,
1194
+ expectedClassList,
1195
+ actual.value
1196
+ );
1197
+ }
1198
+ if (typeof actual === "string" && typeof item === "string") {
1199
+ return this.assert(
1200
+ actual.includes(item),
1201
+ `expected #{this} to contain #{exp}`,
1202
+ `expected #{this} not to contain #{exp}`,
1203
+ item,
1204
+ actual
1205
+ );
1206
+ }
1207
+ if (actual != null && typeof actual !== "string") {
1208
+ utils.flag(this, "object", Array.from(actual));
1209
+ }
1210
+ return this.contain(item);
1211
+ });
1212
+ def("toContainEqual", function(expected) {
1213
+ const obj = utils.flag(this, "object");
1214
+ const index = Array.from(obj).findIndex((item) => {
1215
+ return equals(item, expected, customTesters);
1216
+ });
1217
+ this.assert(
1218
+ index !== -1,
1219
+ "expected #{this} to deep equally contain #{exp}",
1220
+ "expected #{this} to not deep equally contain #{exp}",
1221
+ expected
1222
+ );
1223
+ });
1224
+ def("toBeTruthy", function() {
1225
+ const obj = utils.flag(this, "object");
1226
+ this.assert(
1227
+ Boolean(obj),
1228
+ "expected #{this} to be truthy",
1229
+ "expected #{this} to not be truthy",
1230
+ true,
1231
+ obj
1232
+ );
1233
+ });
1234
+ def("toBeFalsy", function() {
1235
+ const obj = utils.flag(this, "object");
1236
+ this.assert(
1237
+ !obj,
1238
+ "expected #{this} to be falsy",
1239
+ "expected #{this} to not be falsy",
1240
+ false,
1241
+ obj
1242
+ );
1243
+ });
1244
+ def("toBeGreaterThan", function(expected) {
1245
+ const actual = this._obj;
1246
+ assertTypes(actual, "actual", ["number", "bigint"]);
1247
+ assertTypes(expected, "expected", ["number", "bigint"]);
1248
+ return this.assert(
1249
+ actual > expected,
1250
+ `expected ${actual} to be greater than ${expected}`,
1251
+ `expected ${actual} to be not greater than ${expected}`,
1252
+ expected,
1253
+ actual,
1254
+ false
1255
+ );
1256
+ });
1257
+ def("toBeGreaterThanOrEqual", function(expected) {
1258
+ const actual = this._obj;
1259
+ assertTypes(actual, "actual", ["number", "bigint"]);
1260
+ assertTypes(expected, "expected", ["number", "bigint"]);
1261
+ return this.assert(
1262
+ actual >= expected,
1263
+ `expected ${actual} to be greater than or equal to ${expected}`,
1264
+ `expected ${actual} to be not greater than or equal to ${expected}`,
1265
+ expected,
1266
+ actual,
1267
+ false
1268
+ );
1269
+ });
1270
+ def("toBeLessThan", function(expected) {
1271
+ const actual = this._obj;
1272
+ assertTypes(actual, "actual", ["number", "bigint"]);
1273
+ assertTypes(expected, "expected", ["number", "bigint"]);
1274
+ return this.assert(
1275
+ actual < expected,
1276
+ `expected ${actual} to be less than ${expected}`,
1277
+ `expected ${actual} to be not less than ${expected}`,
1278
+ expected,
1279
+ actual,
1280
+ false
1281
+ );
1282
+ });
1283
+ def("toBeLessThanOrEqual", function(expected) {
1284
+ const actual = this._obj;
1285
+ assertTypes(actual, "actual", ["number", "bigint"]);
1286
+ assertTypes(expected, "expected", ["number", "bigint"]);
1287
+ return this.assert(
1288
+ actual <= expected,
1289
+ `expected ${actual} to be less than or equal to ${expected}`,
1290
+ `expected ${actual} to be not less than or equal to ${expected}`,
1291
+ expected,
1292
+ actual,
1293
+ false
1294
+ );
1295
+ });
1296
+ def("toBeNaN", function() {
1297
+ const obj = utils.flag(this, "object");
1298
+ this.assert(
1299
+ Number.isNaN(obj),
1300
+ "expected #{this} to be NaN",
1301
+ "expected #{this} not to be NaN",
1302
+ Number.NaN,
1303
+ obj
1304
+ );
1305
+ });
1306
+ def("toBeUndefined", function() {
1307
+ const obj = utils.flag(this, "object");
1308
+ this.assert(
1309
+ void 0 === obj,
1310
+ "expected #{this} to be undefined",
1311
+ "expected #{this} not to be undefined",
1312
+ void 0,
1313
+ obj
1314
+ );
1315
+ });
1316
+ def("toBeNull", function() {
1317
+ const obj = utils.flag(this, "object");
1318
+ this.assert(
1319
+ obj === null,
1320
+ "expected #{this} to be null",
1321
+ "expected #{this} not to be null",
1322
+ null,
1323
+ obj
1324
+ );
1325
+ });
1326
+ def("toBeDefined", function() {
1327
+ const obj = utils.flag(this, "object");
1328
+ this.assert(
1329
+ typeof obj !== "undefined",
1330
+ "expected #{this} to be defined",
1331
+ "expected #{this} to be undefined",
1332
+ obj
1333
+ );
1334
+ });
1335
+ def(
1336
+ "toBeTypeOf",
1337
+ function(expected) {
1338
+ const actual = typeof this._obj;
1339
+ const equal = expected === actual;
1340
+ return this.assert(
1341
+ equal,
1342
+ "expected #{this} to be type of #{exp}",
1343
+ "expected #{this} not to be type of #{exp}",
1344
+ expected,
1345
+ actual
1346
+ );
1347
+ }
1348
+ );
1349
+ def("toBeInstanceOf", function(obj) {
1350
+ return this.instanceOf(obj);
1351
+ });
1352
+ def("toHaveLength", function(length) {
1353
+ return this.have.length(length);
1354
+ });
1355
+ def(
1356
+ "toHaveProperty",
1357
+ function(...args) {
1358
+ if (Array.isArray(args[0])) {
1359
+ args[0] = args[0].map((key) => String(key).replace(/([.[\]])/g, "\\$1")).join(".");
1360
+ }
1361
+ const actual = this._obj;
1362
+ const [propertyName, expected] = args;
1363
+ const getValue = () => {
1364
+ const hasOwn = Object.prototype.hasOwnProperty.call(
1365
+ actual,
1366
+ propertyName
1367
+ );
1368
+ if (hasOwn) {
1369
+ return { value: actual[propertyName], exists: true };
1370
+ }
1371
+ return utils.getPathInfo(actual, propertyName);
1372
+ };
1373
+ const { value, exists } = getValue();
1374
+ const pass = exists && (args.length === 1 || equals(expected, value, customTesters));
1375
+ const valueString = args.length === 1 ? "" : ` with value ${utils.objDisplay(expected)}`;
1376
+ return this.assert(
1377
+ pass,
1378
+ `expected #{this} to have property "${propertyName}"${valueString}`,
1379
+ `expected #{this} to not have property "${propertyName}"${valueString}`,
1380
+ expected,
1381
+ exists ? value : void 0
1382
+ );
1383
+ }
1384
+ );
1385
+ def("toBeCloseTo", function(received, precision = 2) {
1386
+ const expected = this._obj;
1387
+ let pass = false;
1388
+ let expectedDiff = 0;
1389
+ let receivedDiff = 0;
1390
+ if (received === Number.POSITIVE_INFINITY && expected === Number.POSITIVE_INFINITY) {
1391
+ pass = true;
1392
+ } else if (received === Number.NEGATIVE_INFINITY && expected === Number.NEGATIVE_INFINITY) {
1393
+ pass = true;
1394
+ } else {
1395
+ expectedDiff = 10 ** -precision / 2;
1396
+ receivedDiff = Math.abs(expected - received);
1397
+ pass = receivedDiff < expectedDiff;
1398
+ }
1399
+ return this.assert(
1400
+ pass,
1401
+ `expected #{this} to be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`,
1402
+ `expected #{this} to not be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`,
1403
+ received,
1404
+ expected,
1405
+ false
1406
+ );
1407
+ });
1408
+ function assertIsMock(assertion) {
1409
+ if (!isMockFunction(assertion._obj)) {
1410
+ throw new TypeError(
1411
+ `${utils.inspect(assertion._obj)} is not a spy or a call to a spy!`
1412
+ );
1413
+ }
1414
+ }
1415
+ function getSpy(assertion) {
1416
+ assertIsMock(assertion);
1417
+ return assertion._obj;
1418
+ }
1419
+ def(["toHaveBeenCalledTimes", "toBeCalledTimes"], function(number) {
1420
+ const spy = getSpy(this);
1421
+ const spyName = spy.getMockName();
1422
+ const callCount = spy.mock.calls.length;
1423
+ return this.assert(
1424
+ callCount === number,
1425
+ `expected "${spyName}" to be called #{exp} times, but got ${callCount} times`,
1426
+ `expected "${spyName}" to not be called #{exp} times`,
1427
+ number,
1428
+ callCount,
1429
+ false
1430
+ );
1431
+ });
1432
+ def("toHaveBeenCalledOnce", function() {
1433
+ const spy = getSpy(this);
1434
+ const spyName = spy.getMockName();
1435
+ const callCount = spy.mock.calls.length;
1436
+ return this.assert(
1437
+ callCount === 1,
1438
+ `expected "${spyName}" to be called once, but got ${callCount} times`,
1439
+ `expected "${spyName}" to not be called once`,
1440
+ 1,
1441
+ callCount,
1442
+ false
1443
+ );
1444
+ });
1445
+ def(["toHaveBeenCalled", "toBeCalled"], function() {
1446
+ const spy = getSpy(this);
1447
+ const spyName = spy.getMockName();
1448
+ const callCount = spy.mock.calls.length;
1449
+ const called = callCount > 0;
1450
+ const isNot = utils.flag(this, "negate");
1451
+ let msg = utils.getMessage(this, [
1452
+ called,
1453
+ `expected "${spyName}" to be called at least once`,
1454
+ `expected "${spyName}" to not be called at all, but actually been called ${callCount} times`,
1455
+ true,
1456
+ called
1457
+ ]);
1458
+ if (called && isNot) {
1459
+ msg = formatCalls(spy, msg);
1460
+ }
1461
+ if (called && isNot || !called && !isNot) {
1462
+ throw new AssertionError(msg);
1463
+ }
1464
+ });
1465
+ function equalsArgumentArray(a, b) {
1466
+ return a.length === b.length && a.every(
1467
+ (aItem, i) => equals(aItem, b[i], [...customTesters, iterableEquality])
1468
+ );
1469
+ }
1470
+ def(["toHaveBeenCalledWith", "toBeCalledWith"], function(...args) {
1471
+ const spy = getSpy(this);
1472
+ const spyName = spy.getMockName();
1473
+ const pass = spy.mock.calls.some((callArg) => equalsArgumentArray(callArg, args));
1474
+ const isNot = utils.flag(this, "negate");
1475
+ const msg = utils.getMessage(this, [
1476
+ pass,
1477
+ `expected "${spyName}" to be called with arguments: #{exp}`,
1478
+ `expected "${spyName}" to not be called with arguments: #{exp}`,
1479
+ args
1480
+ ]);
1481
+ if (pass && isNot || !pass && !isNot) {
1482
+ throw new AssertionError(formatCalls(spy, msg, args));
1483
+ }
1484
+ });
1485
+ def("toHaveBeenCalledExactlyOnceWith", function(...args) {
1486
+ const spy = getSpy(this);
1487
+ const spyName = spy.getMockName();
1488
+ const callCount = spy.mock.calls.length;
1489
+ const hasCallWithArgs = spy.mock.calls.some((callArg) => equalsArgumentArray(callArg, args));
1490
+ const pass = hasCallWithArgs && callCount === 1;
1491
+ const isNot = utils.flag(this, "negate");
1492
+ const msg = utils.getMessage(this, [
1493
+ pass,
1494
+ `expected "${spyName}" to be called once with arguments: #{exp}`,
1495
+ `expected "${spyName}" to not be called once with arguments: #{exp}`,
1496
+ args
1497
+ ]);
1498
+ if (pass && isNot || !pass && !isNot) {
1499
+ throw new AssertionError(formatCalls(spy, msg, args));
1500
+ }
1501
+ });
1502
+ def(
1503
+ ["toHaveBeenNthCalledWith", "nthCalledWith"],
1504
+ function(times, ...args) {
1505
+ const spy = getSpy(this);
1506
+ const spyName = spy.getMockName();
1507
+ const nthCall = spy.mock.calls[times - 1];
1508
+ const callCount = spy.mock.calls.length;
1509
+ const isCalled = times <= callCount;
1510
+ this.assert(
1511
+ nthCall && equalsArgumentArray(nthCall, args),
1512
+ `expected ${ordinalOf(
1513
+ times
1514
+ )} "${spyName}" call to have been called with #{exp}${isCalled ? `` : `, but called only ${callCount} times`}`,
1515
+ `expected ${ordinalOf(
1516
+ times
1517
+ )} "${spyName}" call to not have been called with #{exp}`,
1518
+ args,
1519
+ nthCall,
1520
+ isCalled
1521
+ );
1522
+ }
1523
+ );
1524
+ def(
1525
+ ["toHaveBeenLastCalledWith", "lastCalledWith"],
1526
+ function(...args) {
1527
+ const spy = getSpy(this);
1528
+ const spyName = spy.getMockName();
1529
+ const lastCall = spy.mock.calls[spy.mock.calls.length - 1];
1530
+ this.assert(
1531
+ lastCall && equalsArgumentArray(lastCall, args),
1532
+ `expected last "${spyName}" call to have been called with #{exp}`,
1533
+ `expected last "${spyName}" call to not have been called with #{exp}`,
1534
+ args,
1535
+ lastCall
1536
+ );
1537
+ }
1538
+ );
1539
+ function isSpyCalledBeforeAnotherSpy(beforeSpy, afterSpy, failIfNoFirstInvocation) {
1540
+ const beforeInvocationCallOrder = beforeSpy.mock.invocationCallOrder;
1541
+ const afterInvocationCallOrder = afterSpy.mock.invocationCallOrder;
1542
+ if (beforeInvocationCallOrder.length === 0) {
1543
+ return !failIfNoFirstInvocation;
1544
+ }
1545
+ if (afterInvocationCallOrder.length === 0) {
1546
+ return false;
1547
+ }
1548
+ return beforeInvocationCallOrder[0] < afterInvocationCallOrder[0];
1549
+ }
1550
+ def(
1551
+ ["toHaveBeenCalledBefore"],
1552
+ function(resultSpy, failIfNoFirstInvocation = true) {
1553
+ const expectSpy = getSpy(this);
1554
+ if (!isMockFunction(resultSpy)) {
1555
+ throw new TypeError(
1556
+ `${utils.inspect(resultSpy)} is not a spy or a call to a spy`
1557
+ );
1558
+ }
1559
+ this.assert(
1560
+ isSpyCalledBeforeAnotherSpy(
1561
+ expectSpy,
1562
+ resultSpy,
1563
+ failIfNoFirstInvocation
1564
+ ),
1565
+ `expected "${expectSpy.getMockName()}" to have been called before "${resultSpy.getMockName()}"`,
1566
+ `expected "${expectSpy.getMockName()}" to not have been called before "${resultSpy.getMockName()}"`,
1567
+ resultSpy,
1568
+ expectSpy
1569
+ );
1570
+ }
1571
+ );
1572
+ def(
1573
+ ["toHaveBeenCalledAfter"],
1574
+ function(resultSpy, failIfNoFirstInvocation = true) {
1575
+ const expectSpy = getSpy(this);
1576
+ if (!isMockFunction(resultSpy)) {
1577
+ throw new TypeError(
1578
+ `${utils.inspect(resultSpy)} is not a spy or a call to a spy`
1579
+ );
1580
+ }
1581
+ this.assert(
1582
+ isSpyCalledBeforeAnotherSpy(
1583
+ resultSpy,
1584
+ expectSpy,
1585
+ failIfNoFirstInvocation
1586
+ ),
1587
+ `expected "${expectSpy.getMockName()}" to have been called after "${resultSpy.getMockName()}"`,
1588
+ `expected "${expectSpy.getMockName()}" to not have been called after "${resultSpy.getMockName()}"`,
1589
+ resultSpy,
1590
+ expectSpy
1591
+ );
1592
+ }
1593
+ );
1594
+ def(
1595
+ ["toThrow", "toThrowError"],
1596
+ function(expected) {
1597
+ if (typeof expected === "string" || typeof expected === "undefined" || expected instanceof RegExp) {
1598
+ return this.throws(expected === "" ? /^$/ : expected);
1599
+ }
1600
+ const obj = this._obj;
1601
+ const promise = utils.flag(this, "promise");
1602
+ const isNot = utils.flag(this, "negate");
1603
+ let thrown = null;
1604
+ if (promise === "rejects") {
1605
+ thrown = obj;
1606
+ } else if (promise === "resolves" && typeof obj !== "function") {
1607
+ if (!isNot) {
1608
+ const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
1609
+ const error = {
1610
+ showDiff: false
1611
+ };
1612
+ throw new AssertionError(message, error, utils.flag(this, "ssfi"));
1613
+ } else {
1614
+ return;
1615
+ }
1616
+ } else {
1617
+ let isThrow = false;
1618
+ try {
1619
+ obj();
1620
+ } catch (err) {
1621
+ isThrow = true;
1622
+ thrown = err;
1623
+ }
1624
+ if (!isThrow && !isNot) {
1625
+ const message = utils.flag(this, "message") || "expected function to throw an error, but it didn't";
1626
+ const error = {
1627
+ showDiff: false
1628
+ };
1629
+ throw new AssertionError(message, error, utils.flag(this, "ssfi"));
1630
+ }
1631
+ }
1632
+ if (typeof expected === "function") {
1633
+ const name = expected.name || expected.prototype.constructor.name;
1634
+ return this.assert(
1635
+ thrown && thrown instanceof expected,
1636
+ `expected error to be instance of ${name}`,
1637
+ `expected error not to be instance of ${name}`,
1638
+ expected,
1639
+ thrown
1640
+ );
1641
+ }
1642
+ if (expected instanceof Error) {
1643
+ const equal = equals(thrown, expected, [
1644
+ ...customTesters,
1645
+ iterableEquality
1646
+ ]);
1647
+ return this.assert(
1648
+ equal,
1649
+ "expected a thrown error to be #{exp}",
1650
+ "expected a thrown error not to be #{exp}",
1651
+ expected,
1652
+ thrown
1653
+ );
1654
+ }
1655
+ if (typeof expected === "object" && "asymmetricMatch" in expected && typeof expected.asymmetricMatch === "function") {
1656
+ const matcher = expected;
1657
+ return this.assert(
1658
+ thrown && matcher.asymmetricMatch(thrown),
1659
+ "expected error to match asymmetric matcher",
1660
+ "expected error not to match asymmetric matcher",
1661
+ matcher,
1662
+ thrown
1663
+ );
1664
+ }
1665
+ throw new Error(
1666
+ `"toThrow" expects string, RegExp, function, Error instance or asymmetric matcher, got "${typeof expected}"`
1667
+ );
1668
+ }
1669
+ );
1670
+ [
1671
+ {
1672
+ name: "toHaveResolved",
1673
+ condition: (spy) => spy.mock.settledResults.length > 0 && spy.mock.settledResults.some(({ type }) => type === "fulfilled"),
1674
+ action: "resolved"
1675
+ },
1676
+ {
1677
+ name: ["toHaveReturned", "toReturn"],
1678
+ condition: (spy) => spy.mock.calls.length > 0 && spy.mock.results.some(({ type }) => type !== "throw"),
1679
+ action: "called"
1680
+ }
1681
+ ].forEach(({ name, condition, action }) => {
1682
+ def(name, function() {
1683
+ const spy = getSpy(this);
1684
+ const spyName = spy.getMockName();
1685
+ const pass = condition(spy);
1686
+ this.assert(
1687
+ pass,
1688
+ `expected "${spyName}" to be successfully ${action} at least once`,
1689
+ `expected "${spyName}" to not be successfully ${action}`,
1690
+ pass,
1691
+ !pass,
1692
+ false
1693
+ );
1694
+ });
1695
+ });
1696
+ [
1697
+ {
1698
+ name: "toHaveResolvedTimes",
1699
+ condition: (spy, times) => spy.mock.settledResults.reduce(
1700
+ (s2, { type }) => type === "fulfilled" ? ++s2 : s2,
1701
+ 0
1702
+ ) === times,
1703
+ action: "resolved"
1704
+ },
1705
+ {
1706
+ name: ["toHaveReturnedTimes", "toReturnTimes"],
1707
+ condition: (spy, times) => spy.mock.results.reduce(
1708
+ (s2, { type }) => type === "throw" ? s2 : ++s2,
1709
+ 0
1710
+ ) === times,
1711
+ action: "called"
1712
+ }
1713
+ ].forEach(({ name, condition, action }) => {
1714
+ def(name, function(times) {
1715
+ const spy = getSpy(this);
1716
+ const spyName = spy.getMockName();
1717
+ const pass = condition(spy, times);
1718
+ this.assert(
1719
+ pass,
1720
+ `expected "${spyName}" to be successfully ${action} ${times} times`,
1721
+ `expected "${spyName}" to not be successfully ${action} ${times} times`,
1722
+ `expected resolved times: ${times}`,
1723
+ `received resolved times: ${pass}`,
1724
+ false
1725
+ );
1726
+ });
1727
+ });
1728
+ [
1729
+ {
1730
+ name: "toHaveResolvedWith",
1731
+ condition: (spy, value) => spy.mock.settledResults.some(
1732
+ ({ type, value: result }) => type === "fulfilled" && equals(value, result)
1733
+ ),
1734
+ action: "resolve"
1735
+ },
1736
+ {
1737
+ name: ["toHaveReturnedWith", "toReturnWith"],
1738
+ condition: (spy, value) => spy.mock.results.some(
1739
+ ({ type, value: result }) => type === "return" && equals(value, result)
1740
+ ),
1741
+ action: "return"
1742
+ }
1743
+ ].forEach(({ name, condition, action }) => {
1744
+ def(name, function(value) {
1745
+ const spy = getSpy(this);
1746
+ const pass = condition(spy, value);
1747
+ const isNot = utils.flag(this, "negate");
1748
+ if (pass && isNot || !pass && !isNot) {
1749
+ const spyName = spy.getMockName();
1750
+ const msg = utils.getMessage(this, [
1751
+ pass,
1752
+ `expected "${spyName}" to ${action} with: #{exp} at least once`,
1753
+ `expected "${spyName}" to not ${action} with: #{exp}`,
1754
+ value
1755
+ ]);
1756
+ const results = action === "return" ? spy.mock.results : spy.mock.settledResults;
1757
+ throw new AssertionError(formatReturns(spy, results, msg, value));
1758
+ }
1759
+ });
1760
+ });
1761
+ [
1762
+ {
1763
+ name: "toHaveLastResolvedWith",
1764
+ condition: (spy, value) => {
1765
+ const result = spy.mock.settledResults[spy.mock.settledResults.length - 1];
1766
+ return result && result.type === "fulfilled" && equals(result.value, value);
1767
+ },
1768
+ action: "resolve"
1769
+ },
1770
+ {
1771
+ name: ["toHaveLastReturnedWith", "lastReturnedWith"],
1772
+ condition: (spy, value) => {
1773
+ const result = spy.mock.results[spy.mock.results.length - 1];
1774
+ return result && result.type === "return" && equals(result.value, value);
1775
+ },
1776
+ action: "return"
1777
+ }
1778
+ ].forEach(({ name, condition, action }) => {
1779
+ def(name, function(value) {
1780
+ const spy = getSpy(this);
1781
+ const results = action === "return" ? spy.mock.results : spy.mock.settledResults;
1782
+ const result = results[results.length - 1];
1783
+ const spyName = spy.getMockName();
1784
+ this.assert(
1785
+ condition(spy, value),
1786
+ `expected last "${spyName}" call to ${action} #{exp}`,
1787
+ `expected last "${spyName}" call to not ${action} #{exp}`,
1788
+ value,
1789
+ result == null ? void 0 : result.value
1790
+ );
1791
+ });
1792
+ });
1793
+ [
1794
+ {
1795
+ name: "toHaveNthResolvedWith",
1796
+ condition: (spy, index, value) => {
1797
+ const result = spy.mock.settledResults[index - 1];
1798
+ return result && result.type === "fulfilled" && equals(result.value, value);
1799
+ },
1800
+ action: "resolve"
1801
+ },
1802
+ {
1803
+ name: ["toHaveNthReturnedWith", "nthReturnedWith"],
1804
+ condition: (spy, index, value) => {
1805
+ const result = spy.mock.results[index - 1];
1806
+ return result && result.type === "return" && equals(result.value, value);
1807
+ },
1808
+ action: "return"
1809
+ }
1810
+ ].forEach(({ name, condition, action }) => {
1811
+ def(name, function(nthCall, value) {
1812
+ const spy = getSpy(this);
1813
+ const spyName = spy.getMockName();
1814
+ const results = action === "return" ? spy.mock.results : spy.mock.settledResults;
1815
+ const result = results[nthCall - 1];
1816
+ const ordinalCall = `${ordinalOf(nthCall)} call`;
1817
+ this.assert(
1818
+ condition(spy, nthCall, value),
1819
+ `expected ${ordinalCall} "${spyName}" call to ${action} #{exp}`,
1820
+ `expected ${ordinalCall} "${spyName}" call to not ${action} #{exp}`,
1821
+ value,
1822
+ result == null ? void 0 : result.value
1823
+ );
1824
+ });
1825
+ });
1826
+ def("withContext", function(context) {
1827
+ for (const key in context) {
1828
+ utils.flag(this, key, context[key]);
1829
+ }
1830
+ return this;
1831
+ });
1832
+ utils.addProperty(
1833
+ chai.Assertion.prototype,
1834
+ "resolves",
1835
+ function __VITEST_RESOLVES__() {
1836
+ const error = new Error("resolves");
1837
+ utils.flag(this, "promise", "resolves");
1838
+ utils.flag(this, "error", error);
1839
+ const test = utils.flag(this, "vitest-test");
1840
+ const obj = utils.flag(this, "object");
1841
+ if (utils.flag(this, "poll")) {
1842
+ throw new SyntaxError(
1843
+ `expect.poll() is not supported in combination with .resolves`
1844
+ );
1845
+ }
1846
+ if (typeof (obj == null ? void 0 : obj.then) !== "function") {
1847
+ throw new TypeError(
1848
+ `You must provide a Promise to expect() when using .resolves, not '${typeof obj}'.`
1849
+ );
1850
+ }
1851
+ const proxy = new Proxy(this, {
1852
+ get: (target, key, receiver) => {
1853
+ const result = Reflect.get(target, key, receiver);
1854
+ if (typeof result !== "function") {
1855
+ return result instanceof chai.Assertion ? proxy : result;
1856
+ }
1857
+ return (...args) => {
1858
+ utils.flag(this, "_name", key);
1859
+ const promise = obj.then(
1860
+ (value) => {
1861
+ utils.flag(this, "object", value);
1862
+ return result.call(this, ...args);
1863
+ },
1864
+ (err) => {
1865
+ const _error = new AssertionError(
1866
+ `promise rejected "${utils.inspect(
1867
+ err
1868
+ )}" instead of resolving`,
1869
+ { showDiff: false }
1870
+ );
1871
+ _error.cause = err;
1872
+ _error.stack = error.stack.replace(
1873
+ error.message,
1874
+ _error.message
1875
+ );
1876
+ throw _error;
1877
+ }
1878
+ );
1879
+ return recordAsyncExpect(
1880
+ test,
1881
+ promise,
1882
+ createAssertionMessage(utils, this, !!args.length),
1883
+ error
1884
+ );
1885
+ };
1886
+ }
1887
+ });
1888
+ return proxy;
1889
+ }
1890
+ );
1891
+ utils.addProperty(
1892
+ chai.Assertion.prototype,
1893
+ "rejects",
1894
+ function __VITEST_REJECTS__() {
1895
+ const error = new Error("rejects");
1896
+ utils.flag(this, "promise", "rejects");
1897
+ utils.flag(this, "error", error);
1898
+ const test = utils.flag(this, "vitest-test");
1899
+ const obj = utils.flag(this, "object");
1900
+ const wrapper = typeof obj === "function" ? obj() : obj;
1901
+ if (utils.flag(this, "poll")) {
1902
+ throw new SyntaxError(
1903
+ `expect.poll() is not supported in combination with .rejects`
1904
+ );
1905
+ }
1906
+ if (typeof (wrapper == null ? void 0 : wrapper.then) !== "function") {
1907
+ throw new TypeError(
1908
+ `You must provide a Promise to expect() when using .rejects, not '${typeof wrapper}'.`
1909
+ );
1910
+ }
1911
+ const proxy = new Proxy(this, {
1912
+ get: (target, key, receiver) => {
1913
+ const result = Reflect.get(target, key, receiver);
1914
+ if (typeof result !== "function") {
1915
+ return result instanceof chai.Assertion ? proxy : result;
1916
+ }
1917
+ return (...args) => {
1918
+ utils.flag(this, "_name", key);
1919
+ const promise = wrapper.then(
1920
+ (value) => {
1921
+ const _error = new AssertionError(
1922
+ `promise resolved "${utils.inspect(
1923
+ value
1924
+ )}" instead of rejecting`,
1925
+ {
1926
+ showDiff: true,
1927
+ expected: new Error("rejected promise"),
1928
+ actual: value
1929
+ }
1930
+ );
1931
+ _error.stack = error.stack.replace(
1932
+ error.message,
1933
+ _error.message
1934
+ );
1935
+ throw _error;
1936
+ },
1937
+ (err) => {
1938
+ utils.flag(this, "object", err);
1939
+ return result.call(this, ...args);
1940
+ }
1941
+ );
1942
+ return recordAsyncExpect(
1943
+ test,
1944
+ promise,
1945
+ createAssertionMessage(utils, this, !!args.length),
1946
+ error
1947
+ );
1948
+ };
1949
+ }
1950
+ });
1951
+ return proxy;
1952
+ }
1953
+ );
1954
+ };
1955
+ function ordinalOf(i) {
1956
+ const j = i % 10;
1957
+ const k = i % 100;
1958
+ if (j === 1 && k !== 11) {
1959
+ return `${i}st`;
1960
+ }
1961
+ if (j === 2 && k !== 12) {
1962
+ return `${i}nd`;
1963
+ }
1964
+ if (j === 3 && k !== 13) {
1965
+ return `${i}rd`;
1966
+ }
1967
+ return `${i}th`;
1968
+ }
1969
+ function formatCalls(spy, msg, showActualCall) {
1970
+ if (spy.mock.calls) {
1971
+ msg += s.gray(
1972
+ `
1973
+
1974
+ Received:
1975
+
1976
+ ${spy.mock.calls.map((callArg, i) => {
1977
+ let methodCall = s.bold(
1978
+ ` ${ordinalOf(i + 1)} ${spy.getMockName()} call:
1979
+
1980
+ `
1981
+ );
1982
+ if (showActualCall) {
1983
+ methodCall += diff(showActualCall, callArg, {
1984
+ omitAnnotationLines: true
1985
+ });
1986
+ } else {
1987
+ methodCall += stringify(callArg).split("\n").map((line) => ` ${line}`).join("\n");
1988
+ }
1989
+ methodCall += "\n";
1990
+ return methodCall;
1991
+ }).join("\n")}`
1992
+ );
1993
+ }
1994
+ msg += s.gray(
1995
+ `
1996
+
1997
+ Number of calls: ${s.bold(spy.mock.calls.length)}
1998
+ `
1999
+ );
2000
+ return msg;
2001
+ }
2002
+ function formatReturns(spy, results, msg, showActualReturn) {
2003
+ msg += s.gray(
2004
+ `
2005
+
2006
+ Received:
2007
+
2008
+ ${results.map((callReturn, i) => {
2009
+ let methodCall = s.bold(
2010
+ ` ${ordinalOf(i + 1)} ${spy.getMockName()} call return:
2011
+
2012
+ `
2013
+ );
2014
+ if (showActualReturn) {
2015
+ methodCall += diff(showActualReturn, callReturn.value, {
2016
+ omitAnnotationLines: true
2017
+ });
2018
+ } else {
2019
+ methodCall += stringify(callReturn).split("\n").map((line) => ` ${line}`).join("\n");
2020
+ }
2021
+ methodCall += "\n";
2022
+ return methodCall;
2023
+ }).join("\n")}`
2024
+ );
2025
+ msg += s.gray(
2026
+ `
2027
+
2028
+ Number of calls: ${s.bold(spy.mock.calls.length)}
2029
+ `
2030
+ );
2031
+ return msg;
2032
+ }
2033
+ function getMatcherState(assertion, expect) {
2034
+ const obj = assertion._obj;
2035
+ const isNot = utils_exports.flag(assertion, "negate");
2036
+ const promise = utils_exports.flag(assertion, "promise") || "";
2037
+ const jestUtils = {
2038
+ ...getMatcherUtils(),
2039
+ diff,
2040
+ stringify,
2041
+ iterableEquality,
2042
+ subsetEquality
2043
+ };
2044
+ const matcherState = {
2045
+ ...getState(expect),
2046
+ customTesters: getCustomEqualityTesters(),
2047
+ isNot,
2048
+ utils: jestUtils,
2049
+ promise,
2050
+ equals,
2051
+ // needed for built-in jest-snapshots, but we don't use it
2052
+ suppressedErrors: [],
2053
+ soft: utils_exports.flag(assertion, "soft"),
2054
+ poll: utils_exports.flag(assertion, "poll")
2055
+ };
2056
+ return {
2057
+ state: matcherState,
2058
+ isNot,
2059
+ obj
2060
+ };
2061
+ }
2062
+ class JestExtendError extends Error {
2063
+ constructor(message, actual, expected) {
2064
+ super(message);
2065
+ this.actual = actual;
2066
+ this.expected = expected;
2067
+ }
2068
+ }
2069
+ function JestExtendPlugin(c, expect, matchers) {
2070
+ return (_, utils) => {
2071
+ Object.entries(matchers).forEach(
2072
+ ([expectAssertionName, expectAssertion]) => {
2073
+ function expectWrapper(...args) {
2074
+ const { state, isNot, obj } = getMatcherState(this, expect);
2075
+ const result = expectAssertion.call(state, obj, ...args);
2076
+ if (result && typeof result === "object" && result instanceof Promise) {
2077
+ return result.then(({ pass: pass2, message: message2, actual: actual2, expected: expected2 }) => {
2078
+ if (pass2 && isNot || !pass2 && !isNot) {
2079
+ throw new JestExtendError(message2(), actual2, expected2);
2080
+ }
2081
+ });
2082
+ }
2083
+ const { pass, message, actual, expected } = result;
2084
+ if (pass && isNot || !pass && !isNot) {
2085
+ throw new JestExtendError(message(), actual, expected);
2086
+ }
2087
+ }
2088
+ const softWrapper = wrapAssertion(utils, expectAssertionName, expectWrapper);
2089
+ utils.addMethod(
2090
+ globalThis[JEST_MATCHERS_OBJECT].matchers,
2091
+ expectAssertionName,
2092
+ softWrapper
2093
+ );
2094
+ utils.addMethod(
2095
+ c.Assertion.prototype,
2096
+ expectAssertionName,
2097
+ softWrapper
2098
+ );
2099
+ class CustomMatcher extends AsymmetricMatcher {
2100
+ constructor(inverse = false, ...sample) {
2101
+ super(sample, inverse);
2102
+ }
2103
+ asymmetricMatch(other) {
2104
+ const { pass } = expectAssertion.call(
2105
+ this.getMatcherContext(expect),
2106
+ other,
2107
+ ...this.sample
2108
+ );
2109
+ return this.inverse ? !pass : pass;
2110
+ }
2111
+ toString() {
2112
+ return `${this.inverse ? "not." : ""}${expectAssertionName}`;
2113
+ }
2114
+ getExpectedType() {
2115
+ return "any";
2116
+ }
2117
+ toAsymmetricMatcher() {
2118
+ return `${this.toString()}<${this.sample.map((item) => stringify(item)).join(", ")}>`;
2119
+ }
2120
+ }
2121
+ const customMatcher = (...sample) => new CustomMatcher(false, ...sample);
2122
+ Object.defineProperty(expect, expectAssertionName, {
2123
+ configurable: true,
2124
+ enumerable: true,
2125
+ value: customMatcher,
2126
+ writable: true
2127
+ });
2128
+ Object.defineProperty(expect.not, expectAssertionName, {
2129
+ configurable: true,
2130
+ enumerable: true,
2131
+ value: (...sample) => new CustomMatcher(true, ...sample),
2132
+ writable: true
2133
+ });
2134
+ Object.defineProperty(
2135
+ globalThis[ASYMMETRIC_MATCHERS_OBJECT],
2136
+ expectAssertionName,
2137
+ {
2138
+ configurable: true,
2139
+ enumerable: true,
2140
+ value: customMatcher,
2141
+ writable: true
2142
+ }
2143
+ );
2144
+ }
2145
+ );
2146
+ };
2147
+ }
2148
+ const JestExtend = (chai, utils) => {
2149
+ utils.addMethod(
2150
+ chai.expect,
2151
+ "extend",
2152
+ (expect, expects) => {
2153
+ use(JestExtendPlugin(chai, expect, expects));
2154
+ }
2155
+ );
2156
+ };
2157
+ export {
2158
+ ASYMMETRIC_MATCHERS_OBJECT,
2159
+ Any,
2160
+ Anything,
2161
+ ArrayContaining,
2162
+ AsymmetricMatcher,
2163
+ GLOBAL_EXPECT,
2164
+ JEST_MATCHERS_OBJECT,
2165
+ JestAsymmetricMatchers,
2166
+ JestChaiExpect,
2167
+ JestExtend,
2168
+ MATCHERS_OBJECT,
2169
+ ObjectContaining,
2170
+ StringContaining,
2171
+ StringMatching,
2172
+ addCustomEqualityTesters,
2173
+ arrayBufferEquality,
2174
+ customMatchers,
2175
+ equals,
2176
+ generateToBeMessage,
2177
+ getObjectKeys,
2178
+ getObjectSubset,
2179
+ getState,
2180
+ isA,
2181
+ isAsymmetric,
2182
+ isImmutableUnorderedKeyed,
2183
+ isImmutableUnorderedSet,
2184
+ iterableEquality,
2185
+ pluralize,
2186
+ setState,
2187
+ sparseArrayEquality,
2188
+ subsetEquality,
2189
+ typeEquality
2190
+ };