@provino/dialect-vitest 0.0.0-stage → 0.1.0-rc.1
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.
- package/LICENSE +21 -0
- package/README.md +8 -2
- package/THIRD_PARTY_NOTICES.md +266 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +389 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.js +11 -0
- package/dist/runtime/index.d.ts +41 -0
- package/dist/runtime/index.js +1618 -0
- package/dist/title-truncate.js +10 -0
- package/package.json +49 -3
|
@@ -0,0 +1,1618 @@
|
|
|
1
|
+
import { t as VITEST_EACH_TITLE_TRUNCATE } from "../title-truncate.js";
|
|
2
|
+
|
|
3
|
+
// src/each/vendor/pretty-format/collections.ts
|
|
4
|
+
function getKeysOfEnumerableProperties$1(object, compareKeys) {
|
|
5
|
+
const rawKeys = Object.keys(object);
|
|
6
|
+
const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys);
|
|
7
|
+
if (Object.getOwnPropertySymbols) {
|
|
8
|
+
for (const symbol of Object.getOwnPropertySymbols(object)) if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) keys.push(symbol);
|
|
9
|
+
}
|
|
10
|
+
return keys;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Return entries (for example, of a map)
|
|
14
|
+
* with spacing, indentation, and comma
|
|
15
|
+
* without surrounding punctuation (for example, braces)
|
|
16
|
+
*/
|
|
17
|
+
function printIteratorEntries$1(iterator, config, indentation, depth, refs, printer, separator = ": ", length) {
|
|
18
|
+
let result = "";
|
|
19
|
+
let width = 0;
|
|
20
|
+
let current = iterator.next();
|
|
21
|
+
if (!current.done) {
|
|
22
|
+
result += config.spacingOuter;
|
|
23
|
+
const indentationNext = indentation + config.indent;
|
|
24
|
+
while (!current.done) {
|
|
25
|
+
result += indentationNext;
|
|
26
|
+
if (width++ === config.maxWidth) {
|
|
27
|
+
result += typeof length === "number" ? `…(${length - width + 1})` : "…";
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
const name = printer(current.value[0], config, indentationNext, depth, refs);
|
|
31
|
+
const value = printer(current.value[1], config, indentationNext, depth, refs);
|
|
32
|
+
result += name + separator + value;
|
|
33
|
+
current = iterator.next();
|
|
34
|
+
if (!current.done) result += `,${config.spacingInner}`;
|
|
35
|
+
else if (!config.min) result += ",";
|
|
36
|
+
}
|
|
37
|
+
result += config.spacingOuter + indentation;
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Return values (for example, of a set)
|
|
43
|
+
* with spacing, indentation, and comma
|
|
44
|
+
* without surrounding punctuation (braces or brackets)
|
|
45
|
+
*/
|
|
46
|
+
function printIteratorValues$1(iterator, config, indentation, depth, refs, printer, length) {
|
|
47
|
+
let result = "";
|
|
48
|
+
let width = 0;
|
|
49
|
+
let current = iterator.next();
|
|
50
|
+
if (!current.done) {
|
|
51
|
+
result += config.spacingOuter;
|
|
52
|
+
const indentationNext = indentation + config.indent;
|
|
53
|
+
while (!current.done) {
|
|
54
|
+
result += indentationNext;
|
|
55
|
+
if (width++ === config.maxWidth) {
|
|
56
|
+
result += typeof length === "number" ? `…(${length - width + 1})` : "…";
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
result += printer(current.value, config, indentationNext, depth, refs);
|
|
60
|
+
current = iterator.next();
|
|
61
|
+
if (!current.done) result += `,${config.spacingInner}`;
|
|
62
|
+
else if (!config.min) result += ",";
|
|
63
|
+
}
|
|
64
|
+
result += config.spacingOuter + indentation;
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Return items (for example, of an array)
|
|
70
|
+
* with spacing, indentation, and comma
|
|
71
|
+
* without surrounding punctuation (for example, brackets)
|
|
72
|
+
*/
|
|
73
|
+
function printListItems$1(list, config, indentation, depth, refs, printer) {
|
|
74
|
+
let result = "";
|
|
75
|
+
list = list instanceof ArrayBuffer ? new DataView(list) : list;
|
|
76
|
+
const isDataView = (l) => l instanceof DataView;
|
|
77
|
+
const length = isDataView(list) ? list.byteLength : list.length;
|
|
78
|
+
if (length > 0) {
|
|
79
|
+
result += config.spacingOuter;
|
|
80
|
+
const indentationNext = indentation + config.indent;
|
|
81
|
+
for (let i = 0; i < length; i++) {
|
|
82
|
+
result += indentationNext;
|
|
83
|
+
if (i === config.maxWidth) {
|
|
84
|
+
result += `…(${length - i})`;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
if (isDataView(list) || i in list) result += printer(isDataView(list) ? list.getInt8(i) : list[i], config, indentationNext, depth, refs);
|
|
88
|
+
if (i < length - 1) result += `,${config.spacingInner}`;
|
|
89
|
+
else if (!config.min) result += ",";
|
|
90
|
+
}
|
|
91
|
+
result += config.spacingOuter + indentation;
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Return properties of an object
|
|
97
|
+
* with spacing, indentation, and comma
|
|
98
|
+
* without surrounding punctuation (for example, braces)
|
|
99
|
+
*/
|
|
100
|
+
function printObjectProperties$1(val, config, indentation, depth, refs, printer, compareKeysOverride = config.compareKeys) {
|
|
101
|
+
let result = "";
|
|
102
|
+
const keys = getKeysOfEnumerableProperties$1(val, compareKeysOverride);
|
|
103
|
+
if (keys.length > 0) {
|
|
104
|
+
result += config.spacingOuter;
|
|
105
|
+
const indentationNext = indentation + config.indent;
|
|
106
|
+
for (let i = 0; i < keys.length; i++) {
|
|
107
|
+
result += indentationNext;
|
|
108
|
+
if (i === config.maxWidth) {
|
|
109
|
+
result += `…(${keys.length - i})`;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
const key = keys[i];
|
|
113
|
+
const name = !config.quoteKeys && isUnquotableKey$1(key) ? key : printer(key, config, indentationNext, depth, refs);
|
|
114
|
+
const value = printer(val[key], config, indentationNext, depth, refs);
|
|
115
|
+
result += `${name}: ${value}`;
|
|
116
|
+
if (i < keys.length - 1) result += `,${config.spacingInner}`;
|
|
117
|
+
else if (!config.min) result += ",";
|
|
118
|
+
}
|
|
119
|
+
result += config.spacingOuter + indentation;
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
const keyStrRegExp$1 = /^[a-z_]\w*$/i;
|
|
124
|
+
function isUnquotableKey$1(key) {
|
|
125
|
+
return typeof key === "string" && key !== "__proto__" && keyStrRegExp$1.test(key);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// src/each/vendor/pretty-format/plugins/AsymmetricMatcher.ts
|
|
129
|
+
const asymmetricMatcher$1 = typeof Symbol === "function" && Symbol.for ? Symbol.for("jest.asymmetricMatcher") : 1267621;
|
|
130
|
+
const SPACE$5 = " ";
|
|
131
|
+
const serialize$10 = (val, config, indentation, depth, refs, printer) => {
|
|
132
|
+
const stringedValue = val.toString();
|
|
133
|
+
if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") {
|
|
134
|
+
if (++depth > config.maxDepth) return `[${stringedValue}]`;
|
|
135
|
+
return `${stringedValue + SPACE$5}[${printListItems$1(val.sample, config, indentation, depth, refs, printer)}]`;
|
|
136
|
+
}
|
|
137
|
+
if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") {
|
|
138
|
+
if (++depth > config.maxDepth) return `[${stringedValue}]`;
|
|
139
|
+
return `${stringedValue + SPACE$5}{${printObjectProperties$1(val.sample, config, indentation, depth, refs, printer)}}`;
|
|
140
|
+
}
|
|
141
|
+
if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") return stringedValue + SPACE$5 + printer(val.sample, config, indentation, depth, refs);
|
|
142
|
+
if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") return stringedValue + SPACE$5 + printer(val.sample, config, indentation, depth, refs);
|
|
143
|
+
if (typeof val.toAsymmetricMatcher !== "function") throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
|
|
144
|
+
return val.toAsymmetricMatcher();
|
|
145
|
+
};
|
|
146
|
+
const test$10 = (val) => val && val.$$typeof === asymmetricMatcher$1;
|
|
147
|
+
const plugin$10 = {
|
|
148
|
+
serialize: serialize$10,
|
|
149
|
+
test: test$10
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// src/each/vendor/pretty-format/plugins/DOMCollection.ts
|
|
153
|
+
const SPACE$4 = " ";
|
|
154
|
+
const OBJECT_NAMES$1 = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]);
|
|
155
|
+
const ARRAY_REGEXP$1 = /^(?:HTML\w*Collection|NodeList)$/;
|
|
156
|
+
function testName$1(name) {
|
|
157
|
+
return OBJECT_NAMES$1.has(name) || ARRAY_REGEXP$1.test(name);
|
|
158
|
+
}
|
|
159
|
+
const test$9 = (val) => val && val.constructor && !!val.constructor.name && testName$1(val.constructor.name);
|
|
160
|
+
function isNamedNodeMap$1(collection) {
|
|
161
|
+
return collection.constructor.name === "NamedNodeMap";
|
|
162
|
+
}
|
|
163
|
+
const serialize$9 = (collection, config, indentation, depth, refs, printer) => {
|
|
164
|
+
const name = collection.constructor.name;
|
|
165
|
+
if (++depth > config.maxDepth) return `[${name}]`;
|
|
166
|
+
return (config.min ? "" : name + SPACE$4) + (OBJECT_NAMES$1.has(name) ? `{${printObjectProperties$1(isNamedNodeMap$1(collection) ? [...collection].reduce((props, attribute) => {
|
|
167
|
+
props[attribute.name] = attribute.value;
|
|
168
|
+
return props;
|
|
169
|
+
}, {}) : { ...collection }, config, indentation, depth, refs, printer)}}` : `[${printListItems$1([...collection], config, indentation, depth, refs, printer)}]`);
|
|
170
|
+
};
|
|
171
|
+
const plugin$9 = {
|
|
172
|
+
serialize: serialize$9,
|
|
173
|
+
test: test$9
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// src/each/vendor/pretty-format/plugins/lib/escapeHTML.ts
|
|
177
|
+
/**
|
|
178
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
179
|
+
*
|
|
180
|
+
* This source code is licensed under the MIT license found in the
|
|
181
|
+
* LICENSE file in the root directory of this source tree.
|
|
182
|
+
*/
|
|
183
|
+
function escapeHTML$1(str) {
|
|
184
|
+
return str.replaceAll("<", "<").replaceAll(">", ">");
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// src/each/vendor/pretty-format/plugins/lib/markup.ts
|
|
188
|
+
function printProps$1(keys, props, config, indentation, depth, refs, printer) {
|
|
189
|
+
const indentationNext = indentation + config.indent;
|
|
190
|
+
const colors = config.colors;
|
|
191
|
+
return keys.map((key) => {
|
|
192
|
+
const value = props[key];
|
|
193
|
+
if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") && /__vitest_\d+__/.test(value)) return "";
|
|
194
|
+
let printed = printer(value, config, indentationNext, depth, refs);
|
|
195
|
+
if (typeof value !== "string") {
|
|
196
|
+
if (printed.includes("\n")) printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
|
|
197
|
+
printed = `{${printed}}`;
|
|
198
|
+
}
|
|
199
|
+
return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`;
|
|
200
|
+
}).join("");
|
|
201
|
+
}
|
|
202
|
+
function printChildren$1(children, config, indentation, depth, refs, printer) {
|
|
203
|
+
return children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText$1(child, config) : printer(child, config, indentation, depth, refs))).join("");
|
|
204
|
+
}
|
|
205
|
+
function printShadowRoot$1(children, config, indentation, depth, refs, printer) {
|
|
206
|
+
if (config.printShadowRoot === false) return "";
|
|
207
|
+
return [`${config.spacingOuter + indentation}#shadow-root`, printChildren$1(children, config, indentation + config.indent, depth, refs, printer)].join("");
|
|
208
|
+
}
|
|
209
|
+
function printText$1(text, config) {
|
|
210
|
+
const contentColor = config.colors.content;
|
|
211
|
+
return contentColor.open + escapeHTML$1(text) + contentColor.close;
|
|
212
|
+
}
|
|
213
|
+
function printComment$1(comment, config) {
|
|
214
|
+
const commentColor = config.colors.comment;
|
|
215
|
+
return `${commentColor.open}<!--${escapeHTML$1(comment)}-->${commentColor.close}`;
|
|
216
|
+
}
|
|
217
|
+
function printElement$1(type, printedProps, printedChildren, config, indentation) {
|
|
218
|
+
const tagColor = config.colors.tag;
|
|
219
|
+
return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}</${type}` : `${printedProps && !config.min ? "" : " "}/`}>${tagColor.close}`;
|
|
220
|
+
}
|
|
221
|
+
function printElementAsLeaf$1(type, config) {
|
|
222
|
+
const tagColor = config.colors.tag;
|
|
223
|
+
return `${tagColor.open}<${type}${tagColor.close} …${tagColor.open} />${tagColor.close}`;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// src/each/vendor/pretty-format/plugins/DOMElement.ts
|
|
227
|
+
const ELEMENT_NODE$1 = 1;
|
|
228
|
+
const TEXT_NODE$1 = 3;
|
|
229
|
+
const COMMENT_NODE$1 = 8;
|
|
230
|
+
const FRAGMENT_NODE$1 = 11;
|
|
231
|
+
const ELEMENT_REGEXP$1 = /^(?:(?:HTML|SVG)\w*)?Element$/;
|
|
232
|
+
function testHasAttribute$1(val) {
|
|
233
|
+
try {
|
|
234
|
+
return typeof val.hasAttribute === "function" && val.hasAttribute("is");
|
|
235
|
+
} catch {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function testNode$1(val) {
|
|
240
|
+
const constructorName = val.constructor.name;
|
|
241
|
+
const { nodeType, tagName } = val;
|
|
242
|
+
const isCustomElement = typeof tagName === "string" && tagName.includes("-") || testHasAttribute$1(val);
|
|
243
|
+
return nodeType === ELEMENT_NODE$1 && (ELEMENT_REGEXP$1.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE$1 && constructorName === "Text" || nodeType === COMMENT_NODE$1 && constructorName === "Comment" || nodeType === FRAGMENT_NODE$1 && constructorName === "DocumentFragment";
|
|
244
|
+
}
|
|
245
|
+
const test$8 = (val) => val?.constructor?.name && testNode$1(val);
|
|
246
|
+
function nodeIsText$1(node) {
|
|
247
|
+
return node.nodeType === TEXT_NODE$1;
|
|
248
|
+
}
|
|
249
|
+
function nodeIsComment$1(node) {
|
|
250
|
+
return node.nodeType === COMMENT_NODE$1;
|
|
251
|
+
}
|
|
252
|
+
function nodeIsFragment$1(node) {
|
|
253
|
+
return node.nodeType === FRAGMENT_NODE$1;
|
|
254
|
+
}
|
|
255
|
+
function filterChildren$1(children, filterNode) {
|
|
256
|
+
let filtered = children.filter((node) => {
|
|
257
|
+
if (node.nodeType === TEXT_NODE$1) return (node.data || "").trim().length > 0;
|
|
258
|
+
return true;
|
|
259
|
+
});
|
|
260
|
+
if (filterNode) filtered = filtered.filter(filterNode);
|
|
261
|
+
return filtered;
|
|
262
|
+
}
|
|
263
|
+
function serializeDOM$1(node, config, indentation, depth, refs, printer, filterNode) {
|
|
264
|
+
if (nodeIsText$1(node)) return printText$1(node.data, config);
|
|
265
|
+
if (nodeIsComment$1(node)) return printComment$1(node.data, config);
|
|
266
|
+
const type = nodeIsFragment$1(node) ? "DocumentFragment" : node.tagName.toLowerCase();
|
|
267
|
+
if (++depth > config.maxDepth) return printElementAsLeaf$1(type, config);
|
|
268
|
+
const children = Array.prototype.slice.call(node.childNodes || node.children);
|
|
269
|
+
const shadowChildren = nodeIsFragment$1(node) || !node.shadowRoot ? [] : Array.prototype.slice.call(node.shadowRoot.children);
|
|
270
|
+
const resolvedChildren = filterNode ? filterChildren$1(children, filterNode) : children;
|
|
271
|
+
const resolvedShadowChildren = filterNode ? filterChildren$1(shadowChildren, filterNode) : shadowChildren;
|
|
272
|
+
return printElement$1(type, printProps$1(nodeIsFragment$1(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment$1(node) ? {} : [...node.attributes].reduce((props, attribute) => {
|
|
273
|
+
props[attribute.name] = attribute.value;
|
|
274
|
+
return props;
|
|
275
|
+
}, {}), config, indentation + config.indent, depth, refs, printer), (resolvedShadowChildren.length > 0 ? printShadowRoot$1(resolvedShadowChildren, config, indentation + config.indent, depth, refs, printer) : "") + printChildren$1(resolvedChildren, config, indentation + config.indent, depth, refs, printer), config, indentation);
|
|
276
|
+
}
|
|
277
|
+
const serialize$8 = (node, config, indentation, depth, refs, printer) => serializeDOM$1(node, config, indentation, depth, refs, printer);
|
|
278
|
+
function createDOMElementFilter(filterNode) {
|
|
279
|
+
return {
|
|
280
|
+
test: test$8,
|
|
281
|
+
serialize: (node, config, indentation, depth, refs, printer) => serializeDOM$1(node, config, indentation, depth, refs, printer, filterNode)
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
const plugin$8 = {
|
|
285
|
+
serialize: serialize$8,
|
|
286
|
+
test: test$8
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
// src/each/vendor/pretty-format/plugins/Immutable.ts
|
|
290
|
+
const IS_ITERABLE_SENTINEL$1 = "@@__IMMUTABLE_ITERABLE__@@";
|
|
291
|
+
const IS_LIST_SENTINEL$1 = "@@__IMMUTABLE_LIST__@@";
|
|
292
|
+
const IS_KEYED_SENTINEL$1 = "@@__IMMUTABLE_KEYED__@@";
|
|
293
|
+
const IS_MAP_SENTINEL$1 = "@@__IMMUTABLE_MAP__@@";
|
|
294
|
+
const IS_ORDERED_SENTINEL$1 = "@@__IMMUTABLE_ORDERED__@@";
|
|
295
|
+
const IS_RECORD_SENTINEL$1 = "@@__IMMUTABLE_RECORD__@@";
|
|
296
|
+
const IS_SEQ_SENTINEL$1 = "@@__IMMUTABLE_SEQ__@@";
|
|
297
|
+
const IS_SET_SENTINEL$1 = "@@__IMMUTABLE_SET__@@";
|
|
298
|
+
const IS_STACK_SENTINEL$1 = "@@__IMMUTABLE_STACK__@@";
|
|
299
|
+
const getImmutableName$1 = (name) => `Immutable.${name}`;
|
|
300
|
+
const printAsLeaf$1 = (name) => `[${name}]`;
|
|
301
|
+
const SPACE$3 = " ";
|
|
302
|
+
const LAZY$1 = "…";
|
|
303
|
+
function printImmutableEntries$1(val, config, indentation, depth, refs, printer, type) {
|
|
304
|
+
return ++depth > config.maxDepth ? printAsLeaf$1(getImmutableName$1(type)) : `${getImmutableName$1(type) + SPACE$3}{${printIteratorEntries$1(val.entries(), config, indentation, depth, refs, printer)}}`;
|
|
305
|
+
}
|
|
306
|
+
function getRecordEntries$1(val) {
|
|
307
|
+
let i = 0;
|
|
308
|
+
return { next() {
|
|
309
|
+
if (i < val._keys.length) {
|
|
310
|
+
const key = val._keys[i++];
|
|
311
|
+
return {
|
|
312
|
+
done: false,
|
|
313
|
+
value: [key, val.get(key)]
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
return {
|
|
317
|
+
done: true,
|
|
318
|
+
value: void 0
|
|
319
|
+
};
|
|
320
|
+
} };
|
|
321
|
+
}
|
|
322
|
+
function printImmutableRecord$1(val, config, indentation, depth, refs, printer) {
|
|
323
|
+
const name = getImmutableName$1(val._name || "Record");
|
|
324
|
+
return ++depth > config.maxDepth ? printAsLeaf$1(name) : `${name + SPACE$3}{${printIteratorEntries$1(getRecordEntries$1(val), config, indentation, depth, refs, printer)}}`;
|
|
325
|
+
}
|
|
326
|
+
function printImmutableSeq$1(val, config, indentation, depth, refs, printer) {
|
|
327
|
+
const name = getImmutableName$1("Seq");
|
|
328
|
+
if (++depth > config.maxDepth) return printAsLeaf$1(name);
|
|
329
|
+
if (val[IS_KEYED_SENTINEL$1]) return `${name + SPACE$3}{${val._iter || val._object ? printIteratorEntries$1(val.entries(), config, indentation, depth, refs, printer) : LAZY$1}}`;
|
|
330
|
+
return `${name + SPACE$3}[${val._iter || val._array || val._collection || val._iterable ? printIteratorValues$1(val.values(), config, indentation, depth, refs, printer) : LAZY$1}]`;
|
|
331
|
+
}
|
|
332
|
+
function printImmutableValues$1(val, config, indentation, depth, refs, printer, type) {
|
|
333
|
+
return ++depth > config.maxDepth ? printAsLeaf$1(getImmutableName$1(type)) : `${getImmutableName$1(type) + SPACE$3}[${printIteratorValues$1(val.values(), config, indentation, depth, refs, printer)}]`;
|
|
334
|
+
}
|
|
335
|
+
const serialize$7 = (val, config, indentation, depth, refs, printer) => {
|
|
336
|
+
if (val[IS_MAP_SENTINEL$1]) return printImmutableEntries$1(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL$1] ? "OrderedMap" : "Map");
|
|
337
|
+
if (val[IS_LIST_SENTINEL$1]) return printImmutableValues$1(val, config, indentation, depth, refs, printer, "List");
|
|
338
|
+
if (val[IS_SET_SENTINEL$1]) return printImmutableValues$1(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL$1] ? "OrderedSet" : "Set");
|
|
339
|
+
if (val[IS_STACK_SENTINEL$1]) return printImmutableValues$1(val, config, indentation, depth, refs, printer, "Stack");
|
|
340
|
+
if (val[IS_SEQ_SENTINEL$1]) return printImmutableSeq$1(val, config, indentation, depth, refs, printer);
|
|
341
|
+
return printImmutableRecord$1(val, config, indentation, depth, refs, printer);
|
|
342
|
+
};
|
|
343
|
+
const test$7 = (val) => val && (val[IS_ITERABLE_SENTINEL$1] === true || val[IS_RECORD_SENTINEL$1] === true);
|
|
344
|
+
const plugin$7 = {
|
|
345
|
+
serialize: serialize$7,
|
|
346
|
+
test: test$7
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
// src/each/vendor/pretty-format/plugins/ReactTestComponent.ts
|
|
350
|
+
const testSymbol$1 = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.test.json") : 245830487;
|
|
351
|
+
function getPropKeys$1(object) {
|
|
352
|
+
const { props } = object;
|
|
353
|
+
return props ? Object.keys(props).filter((key) => props[key] !== void 0).sort() : [];
|
|
354
|
+
}
|
|
355
|
+
const serialize$6 = (object, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? printElementAsLeaf$1(object.type, config) : printElement$1(object.type, object.props ? printProps$1(getPropKeys$1(object), object.props, config, indentation + config.indent, depth, refs, printer) : "", object.children ? printChildren$1(object.children, config, indentation + config.indent, depth, refs, printer) : "", config, indentation);
|
|
356
|
+
const test$6 = (val) => val && val.$$typeof === testSymbol$1;
|
|
357
|
+
const plugin$6 = {
|
|
358
|
+
serialize: serialize$6,
|
|
359
|
+
test: test$6
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
// src/each/vendor/pretty-format/index.ts
|
|
363
|
+
const styles$1 = {};
|
|
364
|
+
const toString$1 = Object.prototype.toString;
|
|
365
|
+
const toISOString$1 = Date.prototype.toISOString;
|
|
366
|
+
const errorToString$1 = Error.prototype.toString;
|
|
367
|
+
const regExpToString$1 = RegExp.prototype.toString;
|
|
368
|
+
/**
|
|
369
|
+
* Explicitly comparing typeof constructor to function avoids undefined as name
|
|
370
|
+
* when mock identity-obj-proxy returns the key as the value for any key.
|
|
371
|
+
*/
|
|
372
|
+
function getConstructorName$1(val) {
|
|
373
|
+
return typeof val.constructor === "function" && val.constructor.name || "Object";
|
|
374
|
+
}
|
|
375
|
+
/** Is val is equal to global window object? Works even if it does not exist :) */
|
|
376
|
+
function isWindow$1(val) {
|
|
377
|
+
return typeof window !== "undefined" && val === window;
|
|
378
|
+
}
|
|
379
|
+
const SYMBOL_REGEXP$1 = /^Symbol\((.*)\)(.*)$/;
|
|
380
|
+
const NEWLINE_REGEXP$1 = /\n/g;
|
|
381
|
+
var PrettyFormatPluginError$1 = class extends Error {
|
|
382
|
+
constructor(message, stack) {
|
|
383
|
+
super(message);
|
|
384
|
+
this.stack = stack;
|
|
385
|
+
this.name = this.constructor.name;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
function isToStringedArrayType$1(toStringed) {
|
|
389
|
+
return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]";
|
|
390
|
+
}
|
|
391
|
+
function printNumber$1(val) {
|
|
392
|
+
return Object.is(val, -0) ? "-0" : String(val);
|
|
393
|
+
}
|
|
394
|
+
function printBigInt$1(val) {
|
|
395
|
+
return String(`${val}n`);
|
|
396
|
+
}
|
|
397
|
+
function printFunction$1(val, printFunctionName) {
|
|
398
|
+
if (!printFunctionName) return "[Function]";
|
|
399
|
+
return `[Function ${val.name || "anonymous"}]`;
|
|
400
|
+
}
|
|
401
|
+
function printSymbol$1(val) {
|
|
402
|
+
return Symbol.prototype.toString.call(val).replace(SYMBOL_REGEXP$1, "Symbol($1)");
|
|
403
|
+
}
|
|
404
|
+
function printError$1(val) {
|
|
405
|
+
return `[${errorToString$1.call(val)}]`;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* The first port of call for printing an object, handles most of the
|
|
409
|
+
* data-types in JS.
|
|
410
|
+
*/
|
|
411
|
+
function printBasicValue$1(val, printFunctionName, escapeRegex, escapeString, singleQuote) {
|
|
412
|
+
if (val === true || val === false) return `${val}`;
|
|
413
|
+
if (val === void 0) return "undefined";
|
|
414
|
+
if (val === null) return "null";
|
|
415
|
+
const typeOf = typeof val;
|
|
416
|
+
if (typeOf === "number") return printNumber$1(val);
|
|
417
|
+
if (typeOf === "bigint") return printBigInt$1(val);
|
|
418
|
+
if (typeOf === "string") {
|
|
419
|
+
const q = singleQuote ? "'" : "\"";
|
|
420
|
+
if (escapeString) {
|
|
421
|
+
const escapePattern = singleQuote ? /['\\]/g : /["\\]/g;
|
|
422
|
+
return `${q}${val.replaceAll(escapePattern, "\\$&")}${q}`;
|
|
423
|
+
}
|
|
424
|
+
return `${q}${val}${q}`;
|
|
425
|
+
}
|
|
426
|
+
if (typeOf === "function") return printFunction$1(val, printFunctionName);
|
|
427
|
+
if (typeOf === "symbol") return printSymbol$1(val);
|
|
428
|
+
const toStringed = toString$1.call(val);
|
|
429
|
+
if (toStringed === "[object WeakMap]") return "WeakMap {}";
|
|
430
|
+
if (toStringed === "[object WeakSet]") return "WeakSet {}";
|
|
431
|
+
if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") return printFunction$1(val, printFunctionName);
|
|
432
|
+
if (toStringed === "[object Symbol]") return printSymbol$1(val);
|
|
433
|
+
if (toStringed === "[object Date]") return Number.isNaN(+val) ? "Date { NaN }" : toISOString$1.call(val);
|
|
434
|
+
if (toStringed === "[object Error]") return printError$1(val);
|
|
435
|
+
if (toStringed === "[object RegExp]") {
|
|
436
|
+
if (escapeRegex) return regExpToString$1.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
|
|
437
|
+
return regExpToString$1.call(val);
|
|
438
|
+
}
|
|
439
|
+
if (val instanceof Error) return printError$1(val);
|
|
440
|
+
return null;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Handles more complex objects ( such as objects with circular references.
|
|
444
|
+
* maps and sets etc )
|
|
445
|
+
*/
|
|
446
|
+
function printComplexValue$1(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
447
|
+
if (refs.includes(val)) return "[Circular]";
|
|
448
|
+
refs = [...refs];
|
|
449
|
+
refs.push(val);
|
|
450
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
451
|
+
const min = config.min;
|
|
452
|
+
if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) return printer$2(val.toJSON(), config, indentation, depth, refs, true);
|
|
453
|
+
const toStringed = toString$1.call(val);
|
|
454
|
+
if (toStringed === "[object Arguments]") return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${printListItems$1(val, config, indentation, depth, refs, printer$2)}]`;
|
|
455
|
+
if (isToStringedArrayType$1(toStringed)) return hitMaxDepth ? `[${val.constructor.name}]` : `${!config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${printListItems$1(val, config, indentation, depth, refs, printer$2)}]`;
|
|
456
|
+
if (toStringed === "[object Map]") return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries$1(val.entries(), config, indentation, depth, refs, printer$2, " => ", val.size)}}`;
|
|
457
|
+
if (toStringed === "[object Set]") return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues$1(val.values(), config, indentation, depth, refs, printer$2, val.size)}}`;
|
|
458
|
+
return hitMaxDepth || isWindow$1(val) ? `[${getConstructorName$1(val)}]` : `${!config.printBasicPrototype && getConstructorName$1(val) === "Object" ? "" : `${getConstructorName$1(val)} `}{${printObjectProperties$1(val, config, indentation, depth, refs, printer$2)}}`;
|
|
459
|
+
}
|
|
460
|
+
const ErrorPlugin$1 = {
|
|
461
|
+
test: (val) => val && val instanceof Error,
|
|
462
|
+
serialize(val, config, indentation, depth, refs, printer) {
|
|
463
|
+
if (refs.includes(val)) return "[Circular]";
|
|
464
|
+
refs = [...refs, val];
|
|
465
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
466
|
+
const { message, cause, ...rest } = val;
|
|
467
|
+
const entries = {
|
|
468
|
+
message,
|
|
469
|
+
...typeof cause !== "undefined" ? { cause } : {},
|
|
470
|
+
...val instanceof AggregateError ? { errors: val.errors } : {},
|
|
471
|
+
...rest
|
|
472
|
+
};
|
|
473
|
+
const name = val.name !== "Error" ? val.name : getConstructorName$1(val);
|
|
474
|
+
return hitMaxDepth ? `[${name}]` : `${name} {${printObjectProperties$1(entries, config, indentation, depth, refs, printer, null)}}`;
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
function isNewPlugin$1(plugin) {
|
|
478
|
+
return plugin.serialize != null;
|
|
479
|
+
}
|
|
480
|
+
function printPlugin$1(plugin, val, config, indentation, depth, refs) {
|
|
481
|
+
let printed;
|
|
482
|
+
try {
|
|
483
|
+
printed = isNewPlugin$1(plugin) ? plugin.serialize(val, config, indentation, depth, refs, printer$2) : plugin.print(val, (valChild) => printer$2(valChild, config, indentation, depth, refs), (str) => {
|
|
484
|
+
const indentationNext = indentation + config.indent;
|
|
485
|
+
return indentationNext + str.replaceAll(NEWLINE_REGEXP$1, `\n${indentationNext}`);
|
|
486
|
+
}, {
|
|
487
|
+
edgeSpacing: config.spacingOuter,
|
|
488
|
+
min: config.min,
|
|
489
|
+
spacing: config.spacingInner
|
|
490
|
+
}, config.colors);
|
|
491
|
+
} catch (error) {
|
|
492
|
+
throw new PrettyFormatPluginError$1(error.message, error.stack);
|
|
493
|
+
}
|
|
494
|
+
if (typeof printed !== "string") throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
|
|
495
|
+
return printed;
|
|
496
|
+
}
|
|
497
|
+
function findPlugin$1(plugins, val) {
|
|
498
|
+
for (const plugin of plugins) try {
|
|
499
|
+
if (plugin.test(val)) return plugin;
|
|
500
|
+
} catch (error) {
|
|
501
|
+
throw new PrettyFormatPluginError$1(error.message, error.stack);
|
|
502
|
+
}
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
function printer$2(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
506
|
+
let result;
|
|
507
|
+
const plugin = findPlugin$1(config.plugins, val);
|
|
508
|
+
if (plugin !== null) result = printPlugin$1(plugin, val, config, indentation, depth, refs);
|
|
509
|
+
else {
|
|
510
|
+
const basicResult = printBasicValue$1(val, config.printFunctionName, config.escapeRegex, config.escapeString, config.singleQuote);
|
|
511
|
+
if (basicResult !== null) result = basicResult;
|
|
512
|
+
else result = printComplexValue$1(val, config, indentation, depth, refs, hasCalledToJSON);
|
|
513
|
+
}
|
|
514
|
+
config._outputLengthPerDepth[depth] ??= 0;
|
|
515
|
+
config._outputLengthPerDepth[depth] += result.length;
|
|
516
|
+
if (config._outputLengthPerDepth[depth] > config.maxOutputLength) config.maxDepth = 0;
|
|
517
|
+
return result;
|
|
518
|
+
}
|
|
519
|
+
const DEFAULT_THEME$1 = {
|
|
520
|
+
comment: "gray",
|
|
521
|
+
content: "reset",
|
|
522
|
+
prop: "yellow",
|
|
523
|
+
tag: "cyan",
|
|
524
|
+
value: "green"
|
|
525
|
+
};
|
|
526
|
+
const DEFAULT_THEME_KEYS$1 = Object.keys(DEFAULT_THEME$1);
|
|
527
|
+
const DEFAULT_OPTIONS$1 = {
|
|
528
|
+
callToJSON: true,
|
|
529
|
+
compareKeys: void 0,
|
|
530
|
+
escapeRegex: false,
|
|
531
|
+
escapeString: true,
|
|
532
|
+
highlight: false,
|
|
533
|
+
indent: 2,
|
|
534
|
+
maxDepth: Number.POSITIVE_INFINITY,
|
|
535
|
+
maxOutputLength: 1e6,
|
|
536
|
+
maxWidth: Number.POSITIVE_INFINITY,
|
|
537
|
+
min: false,
|
|
538
|
+
plugins: [],
|
|
539
|
+
printBasicPrototype: true,
|
|
540
|
+
printFunctionName: true,
|
|
541
|
+
printShadowRoot: true,
|
|
542
|
+
theme: DEFAULT_THEME$1,
|
|
543
|
+
singleQuote: false,
|
|
544
|
+
quoteKeys: true,
|
|
545
|
+
spacingInner: "\n",
|
|
546
|
+
spacingOuter: "\n"
|
|
547
|
+
};
|
|
548
|
+
function validateOptions$1(options) {
|
|
549
|
+
for (const key of Object.keys(options)) if (!Object.hasOwn(DEFAULT_OPTIONS$1, key)) throw new Error(`pretty-format: Unknown option "${key}".`);
|
|
550
|
+
if (options.min && options.indent !== void 0 && options.indent !== 0) throw new Error("pretty-format: Options \"min\" and \"indent\" cannot be used together.");
|
|
551
|
+
}
|
|
552
|
+
function getColorsHighlight$1() {
|
|
553
|
+
return DEFAULT_THEME_KEYS$1.reduce((colors, key) => {
|
|
554
|
+
const value = DEFAULT_THEME$1[key];
|
|
555
|
+
const color = value && styles$1[value];
|
|
556
|
+
if (color && typeof color.close === "string" && typeof color.open === "string") colors[key] = color;
|
|
557
|
+
else throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
|
|
558
|
+
return colors;
|
|
559
|
+
}, Object.create(null));
|
|
560
|
+
}
|
|
561
|
+
function getColorsEmpty$1() {
|
|
562
|
+
return DEFAULT_THEME_KEYS$1.reduce((colors, key) => {
|
|
563
|
+
colors[key] = {
|
|
564
|
+
close: "",
|
|
565
|
+
open: ""
|
|
566
|
+
};
|
|
567
|
+
return colors;
|
|
568
|
+
}, Object.create(null));
|
|
569
|
+
}
|
|
570
|
+
function getPrintFunctionName$1(options) {
|
|
571
|
+
return options?.printFunctionName ?? DEFAULT_OPTIONS$1.printFunctionName;
|
|
572
|
+
}
|
|
573
|
+
function getEscapeRegex$1(options) {
|
|
574
|
+
return options?.escapeRegex ?? DEFAULT_OPTIONS$1.escapeRegex;
|
|
575
|
+
}
|
|
576
|
+
function getEscapeString$1(options) {
|
|
577
|
+
return options?.escapeString ?? DEFAULT_OPTIONS$1.escapeString;
|
|
578
|
+
}
|
|
579
|
+
function getConfig$1(options) {
|
|
580
|
+
return {
|
|
581
|
+
callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS$1.callToJSON,
|
|
582
|
+
colors: options?.highlight ? getColorsHighlight$1() : getColorsEmpty$1(),
|
|
583
|
+
compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS$1.compareKeys,
|
|
584
|
+
escapeRegex: getEscapeRegex$1(options),
|
|
585
|
+
escapeString: getEscapeString$1(options),
|
|
586
|
+
indent: options?.min ? "" : createIndent$1(options?.indent ?? DEFAULT_OPTIONS$1.indent),
|
|
587
|
+
maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS$1.maxDepth,
|
|
588
|
+
maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS$1.maxWidth,
|
|
589
|
+
min: options?.min ?? DEFAULT_OPTIONS$1.min,
|
|
590
|
+
plugins: options?.plugins ?? DEFAULT_OPTIONS$1.plugins,
|
|
591
|
+
printBasicPrototype: options?.printBasicPrototype ?? !options?.min,
|
|
592
|
+
printFunctionName: getPrintFunctionName$1(options),
|
|
593
|
+
printShadowRoot: options?.printShadowRoot ?? true,
|
|
594
|
+
spacingInner: options?.spacingInner ?? (options?.min ? " " : "\n"),
|
|
595
|
+
spacingOuter: options?.spacingOuter ?? (options?.min ? "" : "\n"),
|
|
596
|
+
singleQuote: options?.singleQuote ?? DEFAULT_OPTIONS$1.singleQuote,
|
|
597
|
+
quoteKeys: options?.quoteKeys ?? DEFAULT_OPTIONS$1.quoteKeys,
|
|
598
|
+
maxOutputLength: options?.maxOutputLength ?? DEFAULT_OPTIONS$1.maxOutputLength,
|
|
599
|
+
_outputLengthPerDepth: []
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
function createIndent$1(indent) {
|
|
603
|
+
return Array.from({ length: indent + 1 }).join(" ");
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Returns a presentation string of your `val` object
|
|
607
|
+
* @param val any potential JavaScript object
|
|
608
|
+
* @param options Custom settings
|
|
609
|
+
*/
|
|
610
|
+
function format$2(val, options) {
|
|
611
|
+
if (options) validateOptions$1(options);
|
|
612
|
+
const config = getConfig$1(options);
|
|
613
|
+
const plugin = findPlugin$1(config.plugins, val);
|
|
614
|
+
if (plugin !== null) return printPlugin$1(plugin, val, config, "", 0, []);
|
|
615
|
+
const basicResult = printBasicValue$1(val, config.printFunctionName, config.escapeRegex, config.escapeString, config.singleQuote);
|
|
616
|
+
if (basicResult !== null) return basicResult;
|
|
617
|
+
return printComplexValue$1(val, config, "", 0, []);
|
|
618
|
+
}
|
|
619
|
+
const plugins$1 = {
|
|
620
|
+
AsymmetricMatcher: plugin$10,
|
|
621
|
+
DOMCollection: plugin$9,
|
|
622
|
+
DOMElement: plugin$8,
|
|
623
|
+
Immutable: plugin$7,
|
|
624
|
+
ReactTestComponent: plugin$6,
|
|
625
|
+
Error: ErrorPlugin$1
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
// src/each/vendor/utils/display.ts
|
|
629
|
+
const { AsymmetricMatcher: AsymmetricMatcher$1, DOMCollection: DOMCollection$1, DOMElement: DOMElement$1, Immutable: Immutable$1, ReactTestComponent: ReactTestComponent$1 } = plugins$1;
|
|
630
|
+
const PLUGINS = [
|
|
631
|
+
ReactTestComponent$1,
|
|
632
|
+
DOMElement$1,
|
|
633
|
+
DOMCollection$1,
|
|
634
|
+
Immutable$1,
|
|
635
|
+
AsymmetricMatcher$1
|
|
636
|
+
];
|
|
637
|
+
function stringify(object, maxDepth = 10, { maxLength, filterNode, ...options } = {}) {
|
|
638
|
+
const MAX_LENGTH = maxLength ?? 1e4;
|
|
639
|
+
let result;
|
|
640
|
+
const filterFn = typeof filterNode === "string" ? createNodeFilterFromSelector(filterNode) : filterNode;
|
|
641
|
+
const plugins = filterFn ? [
|
|
642
|
+
ReactTestComponent$1,
|
|
643
|
+
createDOMElementFilter(filterFn),
|
|
644
|
+
DOMCollection$1,
|
|
645
|
+
Immutable$1,
|
|
646
|
+
AsymmetricMatcher$1
|
|
647
|
+
] : PLUGINS;
|
|
648
|
+
try {
|
|
649
|
+
result = format$2(object, {
|
|
650
|
+
maxDepth,
|
|
651
|
+
escapeString: false,
|
|
652
|
+
plugins,
|
|
653
|
+
...options
|
|
654
|
+
});
|
|
655
|
+
} catch {
|
|
656
|
+
result = format$2(object, {
|
|
657
|
+
callToJSON: false,
|
|
658
|
+
maxDepth,
|
|
659
|
+
escapeString: false,
|
|
660
|
+
plugins,
|
|
661
|
+
...options
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), {
|
|
665
|
+
maxLength,
|
|
666
|
+
filterNode,
|
|
667
|
+
...options
|
|
668
|
+
}) : result;
|
|
669
|
+
}
|
|
670
|
+
function createNodeFilterFromSelector(selector) {
|
|
671
|
+
const ELEMENT_NODE = 1;
|
|
672
|
+
const COMMENT_NODE = 8;
|
|
673
|
+
return (node) => {
|
|
674
|
+
if (node.nodeType === COMMENT_NODE) return false;
|
|
675
|
+
if (node.nodeType === ELEMENT_NODE && node.matches) try {
|
|
676
|
+
return !node.matches(selector);
|
|
677
|
+
} catch {
|
|
678
|
+
return true;
|
|
679
|
+
}
|
|
680
|
+
return true;
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
const formatRegExp = /%[sdjifoOc%]/g;
|
|
684
|
+
function format$1(args, options = {}) {
|
|
685
|
+
const formatArg = (item) => inspect(item, options);
|
|
686
|
+
if (typeof args[0] !== "string") {
|
|
687
|
+
const objects = [];
|
|
688
|
+
for (let i = 0; i < args.length; i++) objects.push(formatArg(args[i]));
|
|
689
|
+
return objects.join(" ");
|
|
690
|
+
}
|
|
691
|
+
const len = args.length;
|
|
692
|
+
let i = 1;
|
|
693
|
+
const template = args[0];
|
|
694
|
+
let str = String(template).replace(formatRegExp, (x) => {
|
|
695
|
+
if (x === "%%") return "%";
|
|
696
|
+
if (i >= len) return x;
|
|
697
|
+
switch (x) {
|
|
698
|
+
case "%s": {
|
|
699
|
+
const value = args[i++];
|
|
700
|
+
if (typeof value === "bigint") return `${value.toString()}n`;
|
|
701
|
+
if (typeof value === "number" && value === 0 && 1 / value < 0) return "-0";
|
|
702
|
+
if (typeof value === "object" && value !== null) {
|
|
703
|
+
if (typeof value.toString === "function" && value.toString !== Object.prototype.toString) return value.toString();
|
|
704
|
+
return formatArg(value);
|
|
705
|
+
}
|
|
706
|
+
return String(value);
|
|
707
|
+
}
|
|
708
|
+
case "%d": {
|
|
709
|
+
const value = args[i++];
|
|
710
|
+
if (typeof value === "bigint") return `${value.toString()}n`;
|
|
711
|
+
if (typeof value === "symbol") return "NaN";
|
|
712
|
+
return Number(value).toString();
|
|
713
|
+
}
|
|
714
|
+
case "%i": {
|
|
715
|
+
const value = args[i++];
|
|
716
|
+
if (typeof value === "bigint") return `${value.toString()}n`;
|
|
717
|
+
return Number.parseInt(String(value)).toString();
|
|
718
|
+
}
|
|
719
|
+
case "%f": return Number.parseFloat(String(args[i++])).toString();
|
|
720
|
+
case "%o":
|
|
721
|
+
case "%O": return formatArg(args[i++]);
|
|
722
|
+
case "%c":
|
|
723
|
+
i++;
|
|
724
|
+
return "";
|
|
725
|
+
case "%j": try {
|
|
726
|
+
return JSON.stringify(args[i++]);
|
|
727
|
+
} catch (err) {
|
|
728
|
+
const m = err.message;
|
|
729
|
+
if (m.includes("circular structure") || m.includes("cyclic structures") || m.includes("cyclic object")) return "[Circular]";
|
|
730
|
+
throw err;
|
|
731
|
+
}
|
|
732
|
+
default: return x;
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
for (let x = args[i]; i < len; x = args[++i]) if (x === null || typeof x !== "object") str += ` ${typeof x === "symbol" ? x.toString() : x}`;
|
|
736
|
+
else str += ` ${formatArg(x)}`;
|
|
737
|
+
return str;
|
|
738
|
+
}
|
|
739
|
+
function inspect(obj, options) {
|
|
740
|
+
const { truncate, multiline, ...stringifyOptions } = options ?? {};
|
|
741
|
+
const prettyFormatOptions = {
|
|
742
|
+
singleQuote: true,
|
|
743
|
+
quoteKeys: false,
|
|
744
|
+
min: true,
|
|
745
|
+
spacingInner: " ",
|
|
746
|
+
spacingOuter: " ",
|
|
747
|
+
printBasicPrototype: false,
|
|
748
|
+
compareKeys: null,
|
|
749
|
+
...multiline ? {
|
|
750
|
+
min: false,
|
|
751
|
+
spacingInner: void 0,
|
|
752
|
+
spacingOuter: void 0
|
|
753
|
+
} : {}
|
|
754
|
+
};
|
|
755
|
+
const threshold = truncate ?? 0;
|
|
756
|
+
const formatted = stringify(obj, void 0, {
|
|
757
|
+
...prettyFormatOptions,
|
|
758
|
+
...stringifyOptions,
|
|
759
|
+
maxLength: threshold || void 0
|
|
760
|
+
});
|
|
761
|
+
if (threshold === 0 || formatted.length <= threshold) return formatted;
|
|
762
|
+
const type = Object.prototype.toString.call(obj);
|
|
763
|
+
if (typeof obj === "string") {
|
|
764
|
+
let end = threshold - 1;
|
|
765
|
+
if (end > 0 && isHighSurrogate(formatted[end - 1])) end = end - 1;
|
|
766
|
+
return `'${formatted.slice(1, end)}…'`;
|
|
767
|
+
}
|
|
768
|
+
if (type === "[object Array]" || type === "[object Object]" || type === "[object Set]" || type === "[object Map]") return stringifyByMaxWidth(obj, threshold, {
|
|
769
|
+
...prettyFormatOptions,
|
|
770
|
+
...stringifyOptions,
|
|
771
|
+
maxDepth: 1
|
|
772
|
+
});
|
|
773
|
+
return stringify(obj, void 0, {
|
|
774
|
+
...prettyFormatOptions,
|
|
775
|
+
...stringifyOptions,
|
|
776
|
+
maxDepth: 0
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
function truncateString(string, maxLength) {
|
|
780
|
+
if (string.length <= maxLength) return string;
|
|
781
|
+
let end = maxLength - 1;
|
|
782
|
+
if (isHighSurrogate(string[end - 1])) end = end - 1;
|
|
783
|
+
return `${string.slice(0, end)}…`;
|
|
784
|
+
}
|
|
785
|
+
function stringifyByMaxWidth(object, threshold, options) {
|
|
786
|
+
function evaluate(x) {
|
|
787
|
+
return stringify(object, void 0, {
|
|
788
|
+
...options,
|
|
789
|
+
maxWidth: x
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
return evaluate(binarySearch(0, threshold, (x) => evaluate(x).length <= threshold));
|
|
793
|
+
}
|
|
794
|
+
function binarySearch(x0, x1, f) {
|
|
795
|
+
while (x0 + 1 < x1) {
|
|
796
|
+
const x = Math.floor((x0 + x1) / 2);
|
|
797
|
+
if (f(x)) x0 = x;
|
|
798
|
+
else x1 = x;
|
|
799
|
+
}
|
|
800
|
+
return x0;
|
|
801
|
+
}
|
|
802
|
+
function isHighSurrogate(char) {
|
|
803
|
+
return char >= "\ud800" && char <= "\udbff";
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// src/each/vendor/utils/helpers.ts
|
|
807
|
+
function isObject(item) {
|
|
808
|
+
return item != null && typeof item === "object" && !Array.isArray(item);
|
|
809
|
+
}
|
|
810
|
+
function objectAttr(source, path, defaultValue = void 0) {
|
|
811
|
+
const paths = path.replace(/\[(\d+)\]/g, ".$1").split(".");
|
|
812
|
+
let result = source;
|
|
813
|
+
for (const p of paths) {
|
|
814
|
+
result = new Object(result)[p];
|
|
815
|
+
if (result === void 0) return defaultValue;
|
|
816
|
+
}
|
|
817
|
+
return result;
|
|
818
|
+
}
|
|
819
|
+
function isNegativeNaN(val) {
|
|
820
|
+
if (!Number.isNaN(val)) return false;
|
|
821
|
+
const f64 = /* @__PURE__ */ new Float64Array(1);
|
|
822
|
+
f64[0] = val;
|
|
823
|
+
return new Uint32Array(f64.buffer)[1] >>> 31 === 1;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// src/each/vendor/runner/title.ts
|
|
827
|
+
function formatTitle(template, items, idx, taskTitleValueFormatTruncate) {
|
|
828
|
+
if (template.includes("%#") || template.includes("%$")) template = template.replace(/%%/g, "__vitest_escaped_%__").replace(/%#/g, `${idx}`).replace(/%\$/g, `${idx + 1}`).replace(/__vitest_escaped_%__/g, "%%");
|
|
829
|
+
const count = template.split("%").length - 1;
|
|
830
|
+
if (template.includes("%f")) (template.match(/%f/g) || []).forEach((_, i) => {
|
|
831
|
+
if (isNegativeNaN(items[i]) || Object.is(items[i], -0)) {
|
|
832
|
+
let occurrence = 0;
|
|
833
|
+
template = template.replace(/%f/g, (match) => {
|
|
834
|
+
occurrence++;
|
|
835
|
+
return occurrence === i + 1 ? "-%f" : match;
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
const inspectOptions = { truncate: taskTitleValueFormatTruncate };
|
|
840
|
+
const isObjectItem = isObject(items[0]);
|
|
841
|
+
function formatAttribute(s) {
|
|
842
|
+
return s.replace(/\$([$\p{ID_Continue}.]+)/gu, (_, key) => {
|
|
843
|
+
const isArrayKey = /^\d+$/.test(key);
|
|
844
|
+
if (!isObjectItem && !isArrayKey) return `$${key}`;
|
|
845
|
+
const arrayElement = isArrayKey ? objectAttr(items, key) : void 0;
|
|
846
|
+
const value = isObjectItem ? objectAttr(items[0], key, arrayElement) : arrayElement;
|
|
847
|
+
if (typeof value === "string") return inspectOptions.truncate ? truncateString(value, inspectOptions.truncate) : value;
|
|
848
|
+
return inspect(value, inspectOptions);
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
let output = "";
|
|
852
|
+
let i = 0;
|
|
853
|
+
handleRegexMatch(template, formatRegExp, (match) => {
|
|
854
|
+
if (i < count) output += format$1([match[0], items[i++]], inspectOptions);
|
|
855
|
+
else output += match[0];
|
|
856
|
+
}, (nonMatch) => {
|
|
857
|
+
output += formatAttribute(nonMatch);
|
|
858
|
+
});
|
|
859
|
+
return output;
|
|
860
|
+
}
|
|
861
|
+
function handleRegexMatch(input, regex, onMatch, onNonMatch) {
|
|
862
|
+
let lastIndex = 0;
|
|
863
|
+
for (const m of input.matchAll(regex)) {
|
|
864
|
+
if (lastIndex < m.index) onNonMatch(input.slice(lastIndex, m.index));
|
|
865
|
+
onMatch(m);
|
|
866
|
+
lastIndex = m.index + m[0].length;
|
|
867
|
+
}
|
|
868
|
+
if (lastIndex < input.length) onNonMatch(input.slice(lastIndex));
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
// src/each/format-each-title.ts
|
|
872
|
+
/**
|
|
873
|
+
* Formats a `.each` or `.for` title as Vitest 5.0.5 does: `%s %d %i %f %j %o %O %c %%` through
|
|
874
|
+
* its `format`, `%#` and `%$` for the row's index and number, `$name`, `$a.b` and `$0` for an
|
|
875
|
+
* object row's keys or the row's items, and each value cut to 40 characters. `%p` is not a token.
|
|
876
|
+
* @public
|
|
877
|
+
*/
|
|
878
|
+
const formatEachTitle = (template, row, index, kind) => {
|
|
879
|
+
const items = Array.isArray(row) ? row : [row];
|
|
880
|
+
const [only] = items;
|
|
881
|
+
const spread = kind === "mixed" && items.length === 1 && Array.isArray(only) ? only : items;
|
|
882
|
+
return formatTitle(template, spread, index, 40);
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
// src/runtime/environment-conditions.ts
|
|
886
|
+
/**
|
|
887
|
+
* The resolver export conditions of a Vitest environment (`orchestrator.environmentConditions`).
|
|
888
|
+
* Vitest resolves a test file's imports on the server side whatever the environment, so under
|
|
889
|
+
* `environment: 'jsdom'` a package's `browser` variant is not picked and its `node` one is
|
|
890
|
+
* (recorded: `env/conditions-vitest-jsdom`, Vitest 5.0.5). An environment's own list wins.
|
|
891
|
+
* @public
|
|
892
|
+
*/
|
|
893
|
+
const vitestEnvironmentConditions = (env) => env.conditions ?? ["node"];
|
|
894
|
+
|
|
895
|
+
// src/vendor/pretty-format/collections.ts
|
|
896
|
+
function getKeysOfEnumerableProperties(object, compareKeys) {
|
|
897
|
+
const rawKeys = Object.keys(object);
|
|
898
|
+
const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys);
|
|
899
|
+
if (Object.getOwnPropertySymbols) {
|
|
900
|
+
for (const symbol of Object.getOwnPropertySymbols(object)) if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) keys.push(symbol);
|
|
901
|
+
}
|
|
902
|
+
return keys;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Return entries (for example, of a map)
|
|
906
|
+
* with spacing, indentation, and comma
|
|
907
|
+
* without surrounding punctuation (for example, braces)
|
|
908
|
+
*/
|
|
909
|
+
function printIteratorEntries(iterator, config, indentation, depth, refs, printer, separator = ": ", length) {
|
|
910
|
+
let result = "";
|
|
911
|
+
let width = 0;
|
|
912
|
+
let current = iterator.next();
|
|
913
|
+
if (!current.done) {
|
|
914
|
+
result += config.spacingOuter;
|
|
915
|
+
const indentationNext = indentation + config.indent;
|
|
916
|
+
while (!current.done) {
|
|
917
|
+
result += indentationNext;
|
|
918
|
+
if (width++ === config.maxWidth) {
|
|
919
|
+
result += typeof length === "number" ? `…(${length - width + 1})` : "…";
|
|
920
|
+
break;
|
|
921
|
+
}
|
|
922
|
+
const name = printer(current.value[0], config, indentationNext, depth, refs);
|
|
923
|
+
const value = printer(current.value[1], config, indentationNext, depth, refs);
|
|
924
|
+
result += name + separator + value;
|
|
925
|
+
current = iterator.next();
|
|
926
|
+
if (!current.done) result += `,${config.spacingInner}`;
|
|
927
|
+
else if (!config.min) result += ",";
|
|
928
|
+
}
|
|
929
|
+
result += config.spacingOuter + indentation;
|
|
930
|
+
}
|
|
931
|
+
return result;
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Return values (for example, of a set)
|
|
935
|
+
* with spacing, indentation, and comma
|
|
936
|
+
* without surrounding punctuation (braces or brackets)
|
|
937
|
+
*/
|
|
938
|
+
function printIteratorValues(iterator, config, indentation, depth, refs, printer, length) {
|
|
939
|
+
let result = "";
|
|
940
|
+
let width = 0;
|
|
941
|
+
let current = iterator.next();
|
|
942
|
+
if (!current.done) {
|
|
943
|
+
result += config.spacingOuter;
|
|
944
|
+
const indentationNext = indentation + config.indent;
|
|
945
|
+
while (!current.done) {
|
|
946
|
+
result += indentationNext;
|
|
947
|
+
if (width++ === config.maxWidth) {
|
|
948
|
+
result += typeof length === "number" ? `…(${length - width + 1})` : "…";
|
|
949
|
+
break;
|
|
950
|
+
}
|
|
951
|
+
result += printer(current.value, config, indentationNext, depth, refs);
|
|
952
|
+
current = iterator.next();
|
|
953
|
+
if (!current.done) result += `,${config.spacingInner}`;
|
|
954
|
+
else if (!config.min) result += ",";
|
|
955
|
+
}
|
|
956
|
+
result += config.spacingOuter + indentation;
|
|
957
|
+
}
|
|
958
|
+
return result;
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Return items (for example, of an array)
|
|
962
|
+
* with spacing, indentation, and comma
|
|
963
|
+
* without surrounding punctuation (for example, brackets)
|
|
964
|
+
*/
|
|
965
|
+
function printListItems(list, config, indentation, depth, refs, printer) {
|
|
966
|
+
let result = "";
|
|
967
|
+
list = list instanceof ArrayBuffer ? new DataView(list) : list;
|
|
968
|
+
const isDataView = (l) => l instanceof DataView;
|
|
969
|
+
const length = isDataView(list) ? list.byteLength : list.length;
|
|
970
|
+
if (length > 0) {
|
|
971
|
+
result += config.spacingOuter;
|
|
972
|
+
const indentationNext = indentation + config.indent;
|
|
973
|
+
for (let i = 0; i < length; i++) {
|
|
974
|
+
result += indentationNext;
|
|
975
|
+
if (i === config.maxWidth) {
|
|
976
|
+
result += `…(${length - i})`;
|
|
977
|
+
break;
|
|
978
|
+
}
|
|
979
|
+
if (isDataView(list) || i in list) result += printer(isDataView(list) ? list.getInt8(i) : list[i], config, indentationNext, depth, refs);
|
|
980
|
+
if (i < length - 1) result += `,${config.spacingInner}`;
|
|
981
|
+
else if (!config.min) result += ",";
|
|
982
|
+
}
|
|
983
|
+
result += config.spacingOuter + indentation;
|
|
984
|
+
}
|
|
985
|
+
return result;
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* Return properties of an object
|
|
989
|
+
* with spacing, indentation, and comma
|
|
990
|
+
* without surrounding punctuation (for example, braces)
|
|
991
|
+
*/
|
|
992
|
+
function printObjectProperties(val, config, indentation, depth, refs, printer, compareKeysOverride = config.compareKeys) {
|
|
993
|
+
let result = "";
|
|
994
|
+
const keys = getKeysOfEnumerableProperties(val, compareKeysOverride);
|
|
995
|
+
if (keys.length > 0) {
|
|
996
|
+
result += config.spacingOuter;
|
|
997
|
+
const indentationNext = indentation + config.indent;
|
|
998
|
+
for (let i = 0; i < keys.length; i++) {
|
|
999
|
+
result += indentationNext;
|
|
1000
|
+
if (i === config.maxWidth) {
|
|
1001
|
+
result += `…(${keys.length - i})`;
|
|
1002
|
+
break;
|
|
1003
|
+
}
|
|
1004
|
+
const key = keys[i];
|
|
1005
|
+
const name = !config.quoteKeys && isUnquotableKey(key) ? key : printer(key, config, indentationNext, depth, refs);
|
|
1006
|
+
const value = printer(val[key], config, indentationNext, depth, refs);
|
|
1007
|
+
result += `${name}: ${value}`;
|
|
1008
|
+
if (i < keys.length - 1) result += `,${config.spacingInner}`;
|
|
1009
|
+
else if (!config.min) result += ",";
|
|
1010
|
+
}
|
|
1011
|
+
result += config.spacingOuter + indentation;
|
|
1012
|
+
}
|
|
1013
|
+
return result;
|
|
1014
|
+
}
|
|
1015
|
+
const keyStrRegExp = /^[a-z_]\w*$/i;
|
|
1016
|
+
function isUnquotableKey(key) {
|
|
1017
|
+
return typeof key === "string" && key !== "__proto__" && keyStrRegExp.test(key);
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
// src/vendor/pretty-format/plugins/AsymmetricMatcher.ts
|
|
1021
|
+
const asymmetricMatcher = typeof Symbol === "function" && Symbol.for ? Symbol.for("jest.asymmetricMatcher") : 1267621;
|
|
1022
|
+
const SPACE$2 = " ";
|
|
1023
|
+
const serialize$5 = (val, config, indentation, depth, refs, printer) => {
|
|
1024
|
+
const stringedValue = val.toString();
|
|
1025
|
+
if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") {
|
|
1026
|
+
if (++depth > config.maxDepth) return `[${stringedValue}]`;
|
|
1027
|
+
return `${stringedValue + SPACE$2}[${printListItems(val.sample, config, indentation, depth, refs, printer)}]`;
|
|
1028
|
+
}
|
|
1029
|
+
if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") {
|
|
1030
|
+
if (++depth > config.maxDepth) return `[${stringedValue}]`;
|
|
1031
|
+
return `${stringedValue + SPACE$2}{${printObjectProperties(val.sample, config, indentation, depth, refs, printer)}}`;
|
|
1032
|
+
}
|
|
1033
|
+
if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") return stringedValue + SPACE$2 + printer(val.sample, config, indentation, depth, refs);
|
|
1034
|
+
if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") return stringedValue + SPACE$2 + printer(val.sample, config, indentation, depth, refs);
|
|
1035
|
+
if (typeof val.toAsymmetricMatcher !== "function") throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
|
|
1036
|
+
return val.toAsymmetricMatcher();
|
|
1037
|
+
};
|
|
1038
|
+
const test$5 = (val) => val && val.$$typeof === asymmetricMatcher;
|
|
1039
|
+
const plugin$5 = {
|
|
1040
|
+
serialize: serialize$5,
|
|
1041
|
+
test: test$5
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
// src/vendor/pretty-format/plugins/DOMCollection.ts
|
|
1045
|
+
const SPACE$1 = " ";
|
|
1046
|
+
const OBJECT_NAMES = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]);
|
|
1047
|
+
const ARRAY_REGEXP = /^(?:HTML\w*Collection|NodeList)$/;
|
|
1048
|
+
function testName(name) {
|
|
1049
|
+
return OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
|
|
1050
|
+
}
|
|
1051
|
+
const test$4 = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);
|
|
1052
|
+
function isNamedNodeMap(collection) {
|
|
1053
|
+
return collection.constructor.name === "NamedNodeMap";
|
|
1054
|
+
}
|
|
1055
|
+
const serialize$4 = (collection, config, indentation, depth, refs, printer) => {
|
|
1056
|
+
const name = collection.constructor.name;
|
|
1057
|
+
if (++depth > config.maxDepth) return `[${name}]`;
|
|
1058
|
+
return (config.min ? "" : name + SPACE$1) + (OBJECT_NAMES.has(name) ? `{${printObjectProperties(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => {
|
|
1059
|
+
props[attribute.name] = attribute.value;
|
|
1060
|
+
return props;
|
|
1061
|
+
}, {}) : { ...collection }, config, indentation, depth, refs, printer)}}` : `[${printListItems([...collection], config, indentation, depth, refs, printer)}]`);
|
|
1062
|
+
};
|
|
1063
|
+
const plugin$4 = {
|
|
1064
|
+
serialize: serialize$4,
|
|
1065
|
+
test: test$4
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
// src/vendor/pretty-format/plugins/lib/escapeHTML.ts
|
|
1069
|
+
/**
|
|
1070
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1071
|
+
*
|
|
1072
|
+
* This source code is licensed under the MIT license found in the
|
|
1073
|
+
* LICENSE file in the root directory of this source tree.
|
|
1074
|
+
*/
|
|
1075
|
+
function escapeHTML(str) {
|
|
1076
|
+
return str.replaceAll("<", "<").replaceAll(">", ">");
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
// src/vendor/pretty-format/plugins/lib/markup.ts
|
|
1080
|
+
function printProps(keys, props, config, indentation, depth, refs, printer) {
|
|
1081
|
+
const indentationNext = indentation + config.indent;
|
|
1082
|
+
const colors = config.colors;
|
|
1083
|
+
return keys.map((key) => {
|
|
1084
|
+
const value = props[key];
|
|
1085
|
+
if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") && /__vitest_\d+__/.test(value)) return "";
|
|
1086
|
+
let printed = printer(value, config, indentationNext, depth, refs);
|
|
1087
|
+
if (typeof value !== "string") {
|
|
1088
|
+
if (printed.includes("\n")) printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
|
|
1089
|
+
printed = `{${printed}}`;
|
|
1090
|
+
}
|
|
1091
|
+
return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`;
|
|
1092
|
+
}).join("");
|
|
1093
|
+
}
|
|
1094
|
+
function printChildren(children, config, indentation, depth, refs, printer) {
|
|
1095
|
+
return children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer(child, config, indentation, depth, refs))).join("");
|
|
1096
|
+
}
|
|
1097
|
+
function printShadowRoot(children, config, indentation, depth, refs, printer) {
|
|
1098
|
+
if (config.printShadowRoot === false) return "";
|
|
1099
|
+
return [`${config.spacingOuter + indentation}#shadow-root`, printChildren(children, config, indentation + config.indent, depth, refs, printer)].join("");
|
|
1100
|
+
}
|
|
1101
|
+
function printText(text, config) {
|
|
1102
|
+
const contentColor = config.colors.content;
|
|
1103
|
+
return contentColor.open + escapeHTML(text) + contentColor.close;
|
|
1104
|
+
}
|
|
1105
|
+
function printComment(comment, config) {
|
|
1106
|
+
const commentColor = config.colors.comment;
|
|
1107
|
+
return `${commentColor.open}<!--${escapeHTML(comment)}-->${commentColor.close}`;
|
|
1108
|
+
}
|
|
1109
|
+
function printElement(type, printedProps, printedChildren, config, indentation) {
|
|
1110
|
+
const tagColor = config.colors.tag;
|
|
1111
|
+
return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}</${type}` : `${printedProps && !config.min ? "" : " "}/`}>${tagColor.close}`;
|
|
1112
|
+
}
|
|
1113
|
+
function printElementAsLeaf(type, config) {
|
|
1114
|
+
const tagColor = config.colors.tag;
|
|
1115
|
+
return `${tagColor.open}<${type}${tagColor.close} …${tagColor.open} />${tagColor.close}`;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
// src/vendor/pretty-format/plugins/DOMElement.ts
|
|
1119
|
+
const ELEMENT_NODE = 1;
|
|
1120
|
+
const TEXT_NODE = 3;
|
|
1121
|
+
const COMMENT_NODE = 8;
|
|
1122
|
+
const FRAGMENT_NODE = 11;
|
|
1123
|
+
const ELEMENT_REGEXP = /^(?:(?:HTML|SVG)\w*)?Element$/;
|
|
1124
|
+
function testHasAttribute(val) {
|
|
1125
|
+
try {
|
|
1126
|
+
return typeof val.hasAttribute === "function" && val.hasAttribute("is");
|
|
1127
|
+
} catch {
|
|
1128
|
+
return false;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
function testNode(val) {
|
|
1132
|
+
const constructorName = val.constructor.name;
|
|
1133
|
+
const { nodeType, tagName } = val;
|
|
1134
|
+
const isCustomElement = typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val);
|
|
1135
|
+
return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment";
|
|
1136
|
+
}
|
|
1137
|
+
const test$3 = (val) => val?.constructor?.name && testNode(val);
|
|
1138
|
+
function nodeIsText(node) {
|
|
1139
|
+
return node.nodeType === TEXT_NODE;
|
|
1140
|
+
}
|
|
1141
|
+
function nodeIsComment(node) {
|
|
1142
|
+
return node.nodeType === COMMENT_NODE;
|
|
1143
|
+
}
|
|
1144
|
+
function nodeIsFragment(node) {
|
|
1145
|
+
return node.nodeType === FRAGMENT_NODE;
|
|
1146
|
+
}
|
|
1147
|
+
function filterChildren(children, filterNode) {
|
|
1148
|
+
let filtered = children.filter((node) => {
|
|
1149
|
+
if (node.nodeType === TEXT_NODE) return (node.data || "").trim().length > 0;
|
|
1150
|
+
return true;
|
|
1151
|
+
});
|
|
1152
|
+
if (filterNode) filtered = filtered.filter(filterNode);
|
|
1153
|
+
return filtered;
|
|
1154
|
+
}
|
|
1155
|
+
function serializeDOM(node, config, indentation, depth, refs, printer, filterNode) {
|
|
1156
|
+
if (nodeIsText(node)) return printText(node.data, config);
|
|
1157
|
+
if (nodeIsComment(node)) return printComment(node.data, config);
|
|
1158
|
+
const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
|
|
1159
|
+
if (++depth > config.maxDepth) return printElementAsLeaf(type, config);
|
|
1160
|
+
const children = Array.prototype.slice.call(node.childNodes || node.children);
|
|
1161
|
+
const shadowChildren = nodeIsFragment(node) || !node.shadowRoot ? [] : Array.prototype.slice.call(node.shadowRoot.children);
|
|
1162
|
+
const resolvedChildren = filterNode ? filterChildren(children, filterNode) : children;
|
|
1163
|
+
const resolvedShadowChildren = filterNode ? filterChildren(shadowChildren, filterNode) : shadowChildren;
|
|
1164
|
+
return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
|
|
1165
|
+
props[attribute.name] = attribute.value;
|
|
1166
|
+
return props;
|
|
1167
|
+
}, {}), config, indentation + config.indent, depth, refs, printer), (resolvedShadowChildren.length > 0 ? printShadowRoot(resolvedShadowChildren, config, indentation + config.indent, depth, refs, printer) : "") + printChildren(resolvedChildren, config, indentation + config.indent, depth, refs, printer), config, indentation);
|
|
1168
|
+
}
|
|
1169
|
+
const serialize$3 = (node, config, indentation, depth, refs, printer) => serializeDOM(node, config, indentation, depth, refs, printer);
|
|
1170
|
+
const plugin$3 = {
|
|
1171
|
+
serialize: serialize$3,
|
|
1172
|
+
test: test$3
|
|
1173
|
+
};
|
|
1174
|
+
|
|
1175
|
+
// src/vendor/pretty-format/plugins/Immutable.ts
|
|
1176
|
+
const IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
1177
|
+
const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
|
|
1178
|
+
const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
|
|
1179
|
+
const IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@";
|
|
1180
|
+
const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
|
|
1181
|
+
const IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@";
|
|
1182
|
+
const IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@";
|
|
1183
|
+
const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
|
|
1184
|
+
const IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@";
|
|
1185
|
+
const getImmutableName = (name) => `Immutable.${name}`;
|
|
1186
|
+
const printAsLeaf = (name) => `[${name}]`;
|
|
1187
|
+
const SPACE = " ";
|
|
1188
|
+
const LAZY = "…";
|
|
1189
|
+
function printImmutableEntries(val, config, indentation, depth, refs, printer, type) {
|
|
1190
|
+
return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer)}}`;
|
|
1191
|
+
}
|
|
1192
|
+
function getRecordEntries(val) {
|
|
1193
|
+
let i = 0;
|
|
1194
|
+
return { next() {
|
|
1195
|
+
if (i < val._keys.length) {
|
|
1196
|
+
const key = val._keys[i++];
|
|
1197
|
+
return {
|
|
1198
|
+
done: false,
|
|
1199
|
+
value: [key, val.get(key)]
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
return {
|
|
1203
|
+
done: true,
|
|
1204
|
+
value: void 0
|
|
1205
|
+
};
|
|
1206
|
+
} };
|
|
1207
|
+
}
|
|
1208
|
+
function printImmutableRecord(val, config, indentation, depth, refs, printer) {
|
|
1209
|
+
const name = getImmutableName(val._name || "Record");
|
|
1210
|
+
return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${printIteratorEntries(getRecordEntries(val), config, indentation, depth, refs, printer)}}`;
|
|
1211
|
+
}
|
|
1212
|
+
function printImmutableSeq(val, config, indentation, depth, refs, printer) {
|
|
1213
|
+
const name = getImmutableName("Seq");
|
|
1214
|
+
if (++depth > config.maxDepth) return printAsLeaf(name);
|
|
1215
|
+
if (val[IS_KEYED_SENTINEL]) return `${name + SPACE}{${val._iter || val._object ? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer) : LAZY}}`;
|
|
1216
|
+
return `${name + SPACE}[${val._iter || val._array || val._collection || val._iterable ? printIteratorValues(val.values(), config, indentation, depth, refs, printer) : LAZY}]`;
|
|
1217
|
+
}
|
|
1218
|
+
function printImmutableValues(val, config, indentation, depth, refs, printer, type) {
|
|
1219
|
+
return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}]`;
|
|
1220
|
+
}
|
|
1221
|
+
const serialize$2 = (val, config, indentation, depth, refs, printer) => {
|
|
1222
|
+
if (val[IS_MAP_SENTINEL]) return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map");
|
|
1223
|
+
if (val[IS_LIST_SENTINEL]) return printImmutableValues(val, config, indentation, depth, refs, printer, "List");
|
|
1224
|
+
if (val[IS_SET_SENTINEL]) return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set");
|
|
1225
|
+
if (val[IS_STACK_SENTINEL]) return printImmutableValues(val, config, indentation, depth, refs, printer, "Stack");
|
|
1226
|
+
if (val[IS_SEQ_SENTINEL]) return printImmutableSeq(val, config, indentation, depth, refs, printer);
|
|
1227
|
+
return printImmutableRecord(val, config, indentation, depth, refs, printer);
|
|
1228
|
+
};
|
|
1229
|
+
const test$2 = (val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
|
|
1230
|
+
const plugin$2 = {
|
|
1231
|
+
serialize: serialize$2,
|
|
1232
|
+
test: test$2
|
|
1233
|
+
};
|
|
1234
|
+
|
|
1235
|
+
// src/vendor/pretty-format/plugins/ReactTestComponent.ts
|
|
1236
|
+
const testSymbol = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.test.json") : 245830487;
|
|
1237
|
+
function getPropKeys(object) {
|
|
1238
|
+
const { props } = object;
|
|
1239
|
+
return props ? Object.keys(props).filter((key) => props[key] !== void 0).sort() : [];
|
|
1240
|
+
}
|
|
1241
|
+
const serialize$1 = (object, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? printElementAsLeaf(object.type, config) : printElement(object.type, object.props ? printProps(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer) : "", object.children ? printChildren(object.children, config, indentation + config.indent, depth, refs, printer) : "", config, indentation);
|
|
1242
|
+
const test$1 = (val) => val && val.$$typeof === testSymbol;
|
|
1243
|
+
const plugin$1 = {
|
|
1244
|
+
serialize: serialize$1,
|
|
1245
|
+
test: test$1
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
// src/vendor/pretty-format/index.ts
|
|
1249
|
+
const styles = {
|
|
1250
|
+
cyan: {
|
|
1251
|
+
open: "\x1B[36m",
|
|
1252
|
+
close: "\x1B[39m"
|
|
1253
|
+
},
|
|
1254
|
+
gray: {
|
|
1255
|
+
open: "\x1B[90m",
|
|
1256
|
+
close: "\x1B[39m"
|
|
1257
|
+
},
|
|
1258
|
+
green: {
|
|
1259
|
+
open: "\x1B[32m",
|
|
1260
|
+
close: "\x1B[39m"
|
|
1261
|
+
},
|
|
1262
|
+
reset: {
|
|
1263
|
+
open: "\x1B[0m",
|
|
1264
|
+
close: "\x1B[0m"
|
|
1265
|
+
},
|
|
1266
|
+
yellow: {
|
|
1267
|
+
open: "\x1B[33m",
|
|
1268
|
+
close: "\x1B[39m"
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1271
|
+
const toString = Object.prototype.toString;
|
|
1272
|
+
const toISOString = Date.prototype.toISOString;
|
|
1273
|
+
const errorToString = Error.prototype.toString;
|
|
1274
|
+
const regExpToString = RegExp.prototype.toString;
|
|
1275
|
+
/**
|
|
1276
|
+
* Explicitly comparing typeof constructor to function avoids undefined as name
|
|
1277
|
+
* when mock identity-obj-proxy returns the key as the value for any key.
|
|
1278
|
+
*/
|
|
1279
|
+
function getConstructorName(val) {
|
|
1280
|
+
return typeof val.constructor === "function" && val.constructor.name || "Object";
|
|
1281
|
+
}
|
|
1282
|
+
/** Is val is equal to global window object? Works even if it does not exist :) */
|
|
1283
|
+
function isWindow(val) {
|
|
1284
|
+
const globalWindow = globalThis.window;
|
|
1285
|
+
return typeof globalWindow !== "undefined" && val === globalWindow;
|
|
1286
|
+
}
|
|
1287
|
+
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
|
1288
|
+
const NEWLINE_REGEXP = /\n/g;
|
|
1289
|
+
var PrettyFormatPluginError = class extends Error {
|
|
1290
|
+
constructor(message, stack) {
|
|
1291
|
+
super(message);
|
|
1292
|
+
this.stack = stack;
|
|
1293
|
+
this.name = this.constructor.name;
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
function isToStringedArrayType(toStringed) {
|
|
1297
|
+
return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]";
|
|
1298
|
+
}
|
|
1299
|
+
function printNumber(val) {
|
|
1300
|
+
return Object.is(val, -0) ? "-0" : String(val);
|
|
1301
|
+
}
|
|
1302
|
+
function printBigInt(val) {
|
|
1303
|
+
return String(`${val}n`);
|
|
1304
|
+
}
|
|
1305
|
+
function printFunction(val, printFunctionName) {
|
|
1306
|
+
if (!printFunctionName) return "[Function]";
|
|
1307
|
+
return `[Function ${val.name || "anonymous"}]`;
|
|
1308
|
+
}
|
|
1309
|
+
function printSymbol(val) {
|
|
1310
|
+
return Symbol.prototype.toString.call(val).replace(SYMBOL_REGEXP, "Symbol($1)");
|
|
1311
|
+
}
|
|
1312
|
+
function printError(val) {
|
|
1313
|
+
return `[${errorToString.call(val)}]`;
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* The first port of call for printing an object, handles most of the
|
|
1317
|
+
* data-types in JS.
|
|
1318
|
+
*/
|
|
1319
|
+
function printBasicValue(val, printFunctionName, escapeRegex, escapeString, singleQuote) {
|
|
1320
|
+
if (val === true || val === false) return `${val}`;
|
|
1321
|
+
if (val === void 0) return "undefined";
|
|
1322
|
+
if (val === null) return "null";
|
|
1323
|
+
const typeOf = typeof val;
|
|
1324
|
+
if (typeOf === "number") return printNumber(val);
|
|
1325
|
+
if (typeOf === "bigint") return printBigInt(val);
|
|
1326
|
+
if (typeOf === "string") {
|
|
1327
|
+
const q = singleQuote ? "'" : "\"";
|
|
1328
|
+
if (escapeString) {
|
|
1329
|
+
const escapePattern = singleQuote ? /['\\]/g : /["\\]/g;
|
|
1330
|
+
return `${q}${val.replaceAll(escapePattern, "\\$&")}${q}`;
|
|
1331
|
+
}
|
|
1332
|
+
return `${q}${val}${q}`;
|
|
1333
|
+
}
|
|
1334
|
+
if (typeOf === "function") return printFunction(val, printFunctionName);
|
|
1335
|
+
if (typeOf === "symbol") return printSymbol(val);
|
|
1336
|
+
const toStringed = toString.call(val);
|
|
1337
|
+
if (toStringed === "[object WeakMap]") return "WeakMap {}";
|
|
1338
|
+
if (toStringed === "[object WeakSet]") return "WeakSet {}";
|
|
1339
|
+
if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") return printFunction(val, printFunctionName);
|
|
1340
|
+
if (toStringed === "[object Symbol]") return printSymbol(val);
|
|
1341
|
+
if (toStringed === "[object Date]") return Number.isNaN(+val) ? "Date { NaN }" : toISOString.call(val);
|
|
1342
|
+
if (toStringed === "[object Error]") return printError(val);
|
|
1343
|
+
if (toStringed === "[object RegExp]") {
|
|
1344
|
+
if (escapeRegex) return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
|
|
1345
|
+
return regExpToString.call(val);
|
|
1346
|
+
}
|
|
1347
|
+
if (val instanceof Error) return printError(val);
|
|
1348
|
+
return null;
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Handles more complex objects ( such as objects with circular references.
|
|
1352
|
+
* maps and sets etc )
|
|
1353
|
+
*/
|
|
1354
|
+
function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
1355
|
+
if (refs.includes(val)) return "[Circular]";
|
|
1356
|
+
refs = [...refs];
|
|
1357
|
+
refs.push(val);
|
|
1358
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
1359
|
+
const min = config.min;
|
|
1360
|
+
if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) return printer$1(val.toJSON(), config, indentation, depth, refs, true);
|
|
1361
|
+
const toStringed = toString.call(val);
|
|
1362
|
+
if (toStringed === "[object Arguments]") return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${printListItems(val, config, indentation, depth, refs, printer$1)}]`;
|
|
1363
|
+
if (isToStringedArrayType(toStringed)) return hitMaxDepth ? `[${val.constructor.name}]` : `${!config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${printListItems(val, config, indentation, depth, refs, printer$1)}]`;
|
|
1364
|
+
if (toStringed === "[object Map]") return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer$1, " => ", val.size)}}`;
|
|
1365
|
+
if (toStringed === "[object Set]") return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues(val.values(), config, indentation, depth, refs, printer$1, val.size)}}`;
|
|
1366
|
+
return hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${!config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${printObjectProperties(val, config, indentation, depth, refs, printer$1)}}`;
|
|
1367
|
+
}
|
|
1368
|
+
const ErrorPlugin = {
|
|
1369
|
+
test: (val) => val && val instanceof Error,
|
|
1370
|
+
serialize(val, config, indentation, depth, refs, printer) {
|
|
1371
|
+
if (refs.includes(val)) return "[Circular]";
|
|
1372
|
+
refs = [...refs, val];
|
|
1373
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
1374
|
+
const { message, cause, ...rest } = val;
|
|
1375
|
+
const entries = {
|
|
1376
|
+
message,
|
|
1377
|
+
...typeof cause !== "undefined" ? { cause } : {},
|
|
1378
|
+
...val instanceof AggregateError ? { errors: val.errors } : {},
|
|
1379
|
+
...rest
|
|
1380
|
+
};
|
|
1381
|
+
const name = val.name !== "Error" ? val.name : getConstructorName(val);
|
|
1382
|
+
return hitMaxDepth ? `[${name}]` : `${name} {${printObjectProperties(entries, config, indentation, depth, refs, printer, null)}}`;
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
function isNewPlugin(plugin) {
|
|
1386
|
+
return plugin.serialize != null;
|
|
1387
|
+
}
|
|
1388
|
+
function printPlugin(plugin, val, config, indentation, depth, refs) {
|
|
1389
|
+
let printed;
|
|
1390
|
+
try {
|
|
1391
|
+
printed = isNewPlugin(plugin) ? plugin.serialize(val, config, indentation, depth, refs, printer$1) : plugin.print(val, (valChild) => printer$1(valChild, config, indentation, depth, refs), (str) => {
|
|
1392
|
+
const indentationNext = indentation + config.indent;
|
|
1393
|
+
return indentationNext + str.replaceAll(NEWLINE_REGEXP, `\n${indentationNext}`);
|
|
1394
|
+
}, {
|
|
1395
|
+
edgeSpacing: config.spacingOuter,
|
|
1396
|
+
min: config.min,
|
|
1397
|
+
spacing: config.spacingInner
|
|
1398
|
+
}, config.colors);
|
|
1399
|
+
} catch (error) {
|
|
1400
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
1401
|
+
}
|
|
1402
|
+
if (typeof printed !== "string") throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
|
|
1403
|
+
return printed;
|
|
1404
|
+
}
|
|
1405
|
+
function findPlugin(plugins, val) {
|
|
1406
|
+
for (const plugin of plugins) try {
|
|
1407
|
+
if (plugin.test(val)) return plugin;
|
|
1408
|
+
} catch (error) {
|
|
1409
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
1410
|
+
}
|
|
1411
|
+
return null;
|
|
1412
|
+
}
|
|
1413
|
+
function printer$1(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
1414
|
+
let result;
|
|
1415
|
+
const plugin = findPlugin(config.plugins, val);
|
|
1416
|
+
if (plugin !== null) result = printPlugin(plugin, val, config, indentation, depth, refs);
|
|
1417
|
+
else {
|
|
1418
|
+
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString, config.singleQuote);
|
|
1419
|
+
if (basicResult !== null) result = basicResult;
|
|
1420
|
+
else result = printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
|
|
1421
|
+
}
|
|
1422
|
+
config._outputLengthPerDepth[depth] ??= 0;
|
|
1423
|
+
config._outputLengthPerDepth[depth] += result.length;
|
|
1424
|
+
if (config._outputLengthPerDepth[depth] > config.maxOutputLength) config.maxDepth = 0;
|
|
1425
|
+
return result;
|
|
1426
|
+
}
|
|
1427
|
+
const DEFAULT_THEME = {
|
|
1428
|
+
comment: "gray",
|
|
1429
|
+
content: "reset",
|
|
1430
|
+
prop: "yellow",
|
|
1431
|
+
tag: "cyan",
|
|
1432
|
+
value: "green"
|
|
1433
|
+
};
|
|
1434
|
+
const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
|
|
1435
|
+
const DEFAULT_OPTIONS = {
|
|
1436
|
+
callToJSON: true,
|
|
1437
|
+
compareKeys: void 0,
|
|
1438
|
+
escapeRegex: false,
|
|
1439
|
+
escapeString: true,
|
|
1440
|
+
highlight: false,
|
|
1441
|
+
indent: 2,
|
|
1442
|
+
maxDepth: Number.POSITIVE_INFINITY,
|
|
1443
|
+
maxOutputLength: 1e6,
|
|
1444
|
+
maxWidth: Number.POSITIVE_INFINITY,
|
|
1445
|
+
min: false,
|
|
1446
|
+
plugins: [],
|
|
1447
|
+
printBasicPrototype: true,
|
|
1448
|
+
printFunctionName: true,
|
|
1449
|
+
printShadowRoot: true,
|
|
1450
|
+
theme: DEFAULT_THEME,
|
|
1451
|
+
singleQuote: false,
|
|
1452
|
+
quoteKeys: true,
|
|
1453
|
+
spacingInner: "\n",
|
|
1454
|
+
spacingOuter: "\n"
|
|
1455
|
+
};
|
|
1456
|
+
function validateOptions(options) {
|
|
1457
|
+
for (const key of Object.keys(options)) if (!Object.hasOwn(DEFAULT_OPTIONS, key)) throw new Error(`pretty-format: Unknown option "${key}".`);
|
|
1458
|
+
if (options.min && options.indent !== void 0 && options.indent !== 0) throw new Error("pretty-format: Options \"min\" and \"indent\" cannot be used together.");
|
|
1459
|
+
}
|
|
1460
|
+
function getColorsHighlight() {
|
|
1461
|
+
return DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
1462
|
+
const value = DEFAULT_THEME[key];
|
|
1463
|
+
const color = value && styles[value];
|
|
1464
|
+
if (color && typeof color.close === "string" && typeof color.open === "string") colors[key] = color;
|
|
1465
|
+
else throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
|
|
1466
|
+
return colors;
|
|
1467
|
+
}, Object.create(null));
|
|
1468
|
+
}
|
|
1469
|
+
function getColorsEmpty() {
|
|
1470
|
+
return DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
1471
|
+
colors[key] = {
|
|
1472
|
+
close: "",
|
|
1473
|
+
open: ""
|
|
1474
|
+
};
|
|
1475
|
+
return colors;
|
|
1476
|
+
}, Object.create(null));
|
|
1477
|
+
}
|
|
1478
|
+
function getPrintFunctionName(options) {
|
|
1479
|
+
return options?.printFunctionName ?? DEFAULT_OPTIONS.printFunctionName;
|
|
1480
|
+
}
|
|
1481
|
+
function getEscapeRegex(options) {
|
|
1482
|
+
return options?.escapeRegex ?? DEFAULT_OPTIONS.escapeRegex;
|
|
1483
|
+
}
|
|
1484
|
+
function getEscapeString(options) {
|
|
1485
|
+
return options?.escapeString ?? DEFAULT_OPTIONS.escapeString;
|
|
1486
|
+
}
|
|
1487
|
+
function getConfig(options) {
|
|
1488
|
+
return {
|
|
1489
|
+
callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS.callToJSON,
|
|
1490
|
+
colors: options?.highlight ? getColorsHighlight() : getColorsEmpty(),
|
|
1491
|
+
compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys,
|
|
1492
|
+
escapeRegex: getEscapeRegex(options),
|
|
1493
|
+
escapeString: getEscapeString(options),
|
|
1494
|
+
indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS.indent),
|
|
1495
|
+
maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS.maxDepth,
|
|
1496
|
+
maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS.maxWidth,
|
|
1497
|
+
min: options?.min ?? DEFAULT_OPTIONS.min,
|
|
1498
|
+
plugins: options?.plugins ?? DEFAULT_OPTIONS.plugins,
|
|
1499
|
+
printBasicPrototype: options?.printBasicPrototype ?? !options?.min,
|
|
1500
|
+
printFunctionName: getPrintFunctionName(options),
|
|
1501
|
+
printShadowRoot: options?.printShadowRoot ?? true,
|
|
1502
|
+
spacingInner: options?.spacingInner ?? (options?.min ? " " : "\n"),
|
|
1503
|
+
spacingOuter: options?.spacingOuter ?? (options?.min ? "" : "\n"),
|
|
1504
|
+
singleQuote: options?.singleQuote ?? DEFAULT_OPTIONS.singleQuote,
|
|
1505
|
+
quoteKeys: options?.quoteKeys ?? DEFAULT_OPTIONS.quoteKeys,
|
|
1506
|
+
maxOutputLength: options?.maxOutputLength ?? DEFAULT_OPTIONS.maxOutputLength,
|
|
1507
|
+
_outputLengthPerDepth: []
|
|
1508
|
+
};
|
|
1509
|
+
}
|
|
1510
|
+
function createIndent(indent) {
|
|
1511
|
+
return Array.from({ length: indent + 1 }).join(" ");
|
|
1512
|
+
}
|
|
1513
|
+
/**
|
|
1514
|
+
* Returns a presentation string of your `val` object
|
|
1515
|
+
* @param val any potential JavaScript object
|
|
1516
|
+
* @param options Custom settings
|
|
1517
|
+
*/
|
|
1518
|
+
function format(val, options) {
|
|
1519
|
+
if (options) validateOptions(options);
|
|
1520
|
+
const config = getConfig(options);
|
|
1521
|
+
const plugin = findPlugin(config.plugins, val);
|
|
1522
|
+
if (plugin !== null) return printPlugin(plugin, val, config, "", 0, []);
|
|
1523
|
+
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString, config.singleQuote);
|
|
1524
|
+
if (basicResult !== null) return basicResult;
|
|
1525
|
+
return printComplexValue(val, config, "", 0, []);
|
|
1526
|
+
}
|
|
1527
|
+
const plugins = {
|
|
1528
|
+
AsymmetricMatcher: plugin$5,
|
|
1529
|
+
DOMCollection: plugin$4,
|
|
1530
|
+
DOMElement: plugin$3,
|
|
1531
|
+
Immutable: plugin$2,
|
|
1532
|
+
ReactTestComponent: plugin$1,
|
|
1533
|
+
Error: ErrorPlugin
|
|
1534
|
+
};
|
|
1535
|
+
|
|
1536
|
+
// src/vendor/pretty-format/mockSerializer.ts
|
|
1537
|
+
const serialize = (val, config, indentation, depth, refs, printer) => {
|
|
1538
|
+
const name = val.getMockName();
|
|
1539
|
+
const nameString = name === "vi.fn()" ? "" : ` ${name}`;
|
|
1540
|
+
let callsString = "";
|
|
1541
|
+
if (val.mock.calls.length !== 0) {
|
|
1542
|
+
const indentationNext = indentation + config.indent;
|
|
1543
|
+
callsString = ` {${config.spacingOuter}${indentationNext}"calls": ${printer(val.mock.calls, config, indentationNext, depth, refs)}${config.min ? ", " : ","}${config.spacingOuter}${indentationNext}"results": ${printer(val.mock.results, config, indentationNext, depth, refs)}${config.min ? "" : ","}${config.spacingOuter}${indentation}}`;
|
|
1544
|
+
}
|
|
1545
|
+
return `[MockFunction${nameString}]${callsString}`;
|
|
1546
|
+
};
|
|
1547
|
+
const test = (val) => val && !!val._isMockFunction;
|
|
1548
|
+
const plugin = {
|
|
1549
|
+
serialize,
|
|
1550
|
+
test
|
|
1551
|
+
};
|
|
1552
|
+
|
|
1553
|
+
// src/runtime/snapshot-printer.ts
|
|
1554
|
+
const { DOMCollection, DOMElement, Immutable, ReactTestComponent, AsymmetricMatcher } = plugins;
|
|
1555
|
+
/**
|
|
1556
|
+
* Vitest's built-in plugins, in its order (`port/plugins.ts`): the mock serializer last. The React
|
|
1557
|
+
* element plugin is not vendored (vendor/pretty-format/UPSTREAM.md).
|
|
1558
|
+
*/
|
|
1559
|
+
const BUILT_IN = [
|
|
1560
|
+
ReactTestComponent,
|
|
1561
|
+
DOMElement,
|
|
1562
|
+
DOMCollection,
|
|
1563
|
+
Immutable,
|
|
1564
|
+
AsymmetricMatcher,
|
|
1565
|
+
plugin
|
|
1566
|
+
];
|
|
1567
|
+
/** `escapeRegex`, `indent` and `printFunctionName` as `serialize` sets them (`port/utils.ts` L73-L90). */
|
|
1568
|
+
const SERIALIZE_DEFAULTS = {
|
|
1569
|
+
escapeRegex: true,
|
|
1570
|
+
indent: 2,
|
|
1571
|
+
printFunctionName: false
|
|
1572
|
+
};
|
|
1573
|
+
const mismatched = (info) => `Snapshot \`${info.key}\` mismatched`;
|
|
1574
|
+
const printer = {
|
|
1575
|
+
serialize(value, options) {
|
|
1576
|
+
return format(value, {
|
|
1577
|
+
...SERIALIZE_DEFAULTS,
|
|
1578
|
+
plugins: [...options.plugins, ...BUILT_IN],
|
|
1579
|
+
...options.format
|
|
1580
|
+
});
|
|
1581
|
+
},
|
|
1582
|
+
messages: {
|
|
1583
|
+
mismatch: mismatched,
|
|
1584
|
+
notWritten: mismatched,
|
|
1585
|
+
propertiesMismatch: () => "Snapshot properties mismatched"
|
|
1586
|
+
}
|
|
1587
|
+
};
|
|
1588
|
+
/**
|
|
1589
|
+
* The Vitest dialect's snapshot printer: what `vitestPolicy.snapshot.printer` loads. The worker
|
|
1590
|
+
* builds it once.
|
|
1591
|
+
* @public
|
|
1592
|
+
*/
|
|
1593
|
+
function vitestSnapshotPrinter() {
|
|
1594
|
+
return printer;
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
// src/runtime/index.ts
|
|
1598
|
+
/**
|
|
1599
|
+
* An error from the Vitest dialect.
|
|
1600
|
+
* @public
|
|
1601
|
+
*/
|
|
1602
|
+
var VitestDialectError = class extends Error {
|
|
1603
|
+
name = "VitestDialectError";
|
|
1604
|
+
code;
|
|
1605
|
+
constructor(code, message) {
|
|
1606
|
+
super(message);
|
|
1607
|
+
this.code = code;
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
/**
|
|
1611
|
+
* The Vitest dialect's globals factory. Not built yet: it throws `VITEST_DIALECT_NOT_BUILT`.
|
|
1612
|
+
* @public
|
|
1613
|
+
*/
|
|
1614
|
+
function vitestGlobals(_host) {
|
|
1615
|
+
throw new VitestDialectError("VITEST_DIALECT_NOT_BUILT", "The Vitest dialect's globals (`describe`, `vi`, ...) are not built yet (T11.16, Phase 2)");
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
export { VitestDialectError, formatEachTitle, vitestEnvironmentConditions, vitestGlobals, vitestSnapshotPrinter };
|