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