vitest 0.0.65 → 0.0.69

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/dist/entry.js ADDED
@@ -0,0 +1,3330 @@
1
+ import chai, { expect } from 'chai';
2
+ import SinonChai from 'sinon-chai';
3
+ import Subset from 'chai-subset';
4
+ import path, { basename } from 'path';
5
+ import { g as getNames, i as interpretOnlyMode, p as partitionSuiteChildren, c as hasTests, h as hasFailed } from './utils-9dcc4050.js';
6
+ import fs from 'fs';
7
+ import { performance } from 'perf_hooks';
8
+ import { j as setHooks, c as createSuiteHooks, h as clearContext, d as defaultSuite, k as context, l as getHooks, m as getFn } from './suite-819c135e.js';
9
+ import { n as nanoid } from './index-6427e0f2.js';
10
+
11
+ var node = {
12
+ name: "node",
13
+ async setup() {
14
+ return {
15
+ teardown() {
16
+ }
17
+ };
18
+ }
19
+ };
20
+
21
+ const LIVING_KEYS = [
22
+ "DOMException",
23
+ "URL",
24
+ "URLSearchParams",
25
+ "EventTarget",
26
+ "NamedNodeMap",
27
+ "Node",
28
+ "Attr",
29
+ "Element",
30
+ "DocumentFragment",
31
+ "DOMImplementation",
32
+ "Document",
33
+ "XMLDocument",
34
+ "CharacterData",
35
+ "Text",
36
+ "CDATASection",
37
+ "ProcessingInstruction",
38
+ "Comment",
39
+ "DocumentType",
40
+ "NodeList",
41
+ "HTMLCollection",
42
+ "HTMLOptionsCollection",
43
+ "DOMStringMap",
44
+ "DOMTokenList",
45
+ "StyleSheetList",
46
+ "HTMLElement",
47
+ "HTMLHeadElement",
48
+ "HTMLTitleElement",
49
+ "HTMLBaseElement",
50
+ "HTMLLinkElement",
51
+ "HTMLMetaElement",
52
+ "HTMLStyleElement",
53
+ "HTMLBodyElement",
54
+ "HTMLHeadingElement",
55
+ "HTMLParagraphElement",
56
+ "HTMLHRElement",
57
+ "HTMLPreElement",
58
+ "HTMLUListElement",
59
+ "HTMLOListElement",
60
+ "HTMLLIElement",
61
+ "HTMLMenuElement",
62
+ "HTMLDListElement",
63
+ "HTMLDivElement",
64
+ "HTMLAnchorElement",
65
+ "HTMLAreaElement",
66
+ "HTMLBRElement",
67
+ "HTMLButtonElement",
68
+ "HTMLCanvasElement",
69
+ "HTMLDataElement",
70
+ "HTMLDataListElement",
71
+ "HTMLDetailsElement",
72
+ "HTMLDialogElement",
73
+ "HTMLDirectoryElement",
74
+ "HTMLFieldSetElement",
75
+ "HTMLFontElement",
76
+ "HTMLFormElement",
77
+ "HTMLHtmlElement",
78
+ "HTMLImageElement",
79
+ "HTMLInputElement",
80
+ "HTMLLabelElement",
81
+ "HTMLLegendElement",
82
+ "HTMLMapElement",
83
+ "HTMLMarqueeElement",
84
+ "HTMLMediaElement",
85
+ "HTMLMeterElement",
86
+ "HTMLModElement",
87
+ "HTMLOptGroupElement",
88
+ "HTMLOptionElement",
89
+ "HTMLOutputElement",
90
+ "HTMLPictureElement",
91
+ "HTMLProgressElement",
92
+ "HTMLQuoteElement",
93
+ "HTMLScriptElement",
94
+ "HTMLSelectElement",
95
+ "HTMLSlotElement",
96
+ "HTMLSourceElement",
97
+ "HTMLSpanElement",
98
+ "HTMLTableCaptionElement",
99
+ "HTMLTableCellElement",
100
+ "HTMLTableColElement",
101
+ "HTMLTableElement",
102
+ "HTMLTimeElement",
103
+ "HTMLTableRowElement",
104
+ "HTMLTableSectionElement",
105
+ "HTMLTemplateElement",
106
+ "HTMLTextAreaElement",
107
+ "HTMLUnknownElement",
108
+ "HTMLFrameElement",
109
+ "HTMLFrameSetElement",
110
+ "HTMLIFrameElement",
111
+ "HTMLEmbedElement",
112
+ "HTMLObjectElement",
113
+ "HTMLParamElement",
114
+ "HTMLVideoElement",
115
+ "HTMLAudioElement",
116
+ "HTMLTrackElement",
117
+ "SVGElement",
118
+ "SVGGraphicsElement",
119
+ "SVGSVGElement",
120
+ "SVGTitleElement",
121
+ "SVGAnimatedString",
122
+ "SVGNumber",
123
+ "SVGStringList",
124
+ "Event",
125
+ "CloseEvent",
126
+ "CustomEvent",
127
+ "MessageEvent",
128
+ "ErrorEvent",
129
+ "HashChangeEvent",
130
+ "PopStateEvent",
131
+ "StorageEvent",
132
+ "ProgressEvent",
133
+ "PageTransitionEvent",
134
+ "UIEvent",
135
+ "FocusEvent",
136
+ "InputEvent",
137
+ "MouseEvent",
138
+ "KeyboardEvent",
139
+ "TouchEvent",
140
+ "CompositionEvent",
141
+ "WheelEvent",
142
+ "BarProp",
143
+ "External",
144
+ "Location",
145
+ "History",
146
+ "Screen",
147
+ "Performance",
148
+ "Navigator",
149
+ "PluginArray",
150
+ "MimeTypeArray",
151
+ "Plugin",
152
+ "MimeType",
153
+ "FileReader",
154
+ "Blob",
155
+ "File",
156
+ "FileList",
157
+ "ValidityState",
158
+ "DOMParser",
159
+ "XMLSerializer",
160
+ "FormData",
161
+ "XMLHttpRequestEventTarget",
162
+ "XMLHttpRequestUpload",
163
+ "XMLHttpRequest",
164
+ "WebSocket",
165
+ "NodeFilter",
166
+ "NodeIterator",
167
+ "TreeWalker",
168
+ "AbstractRange",
169
+ "Range",
170
+ "StaticRange",
171
+ "Selection",
172
+ "Storage",
173
+ "CustomElementRegistry",
174
+ "ShadowRoot",
175
+ "MutationObserver",
176
+ "MutationRecord",
177
+ "Headers",
178
+ "AbortController",
179
+ "AbortSignal"
180
+ ];
181
+ const OTHER_KEYS = [
182
+ "addEventListener",
183
+ "alert",
184
+ "atob",
185
+ "blur",
186
+ "btoa",
187
+ "close",
188
+ "confirm",
189
+ "createPopup",
190
+ "dispatchEvent",
191
+ "document",
192
+ "focus",
193
+ "frames",
194
+ "getComputedStyle",
195
+ "history",
196
+ "innerHeight",
197
+ "innerWidth",
198
+ "length",
199
+ "location",
200
+ "moveBy",
201
+ "moveTo",
202
+ "name",
203
+ "navigator",
204
+ "open",
205
+ "outerHeight",
206
+ "outerWidth",
207
+ "pageXOffset",
208
+ "pageYOffset",
209
+ "parent",
210
+ "postMessage",
211
+ "print",
212
+ "prompt",
213
+ "removeEventListener",
214
+ "resizeBy",
215
+ "resizeTo",
216
+ "screen",
217
+ "screenLeft",
218
+ "screenTop",
219
+ "screenX",
220
+ "screenY",
221
+ "scroll",
222
+ "scrollBy",
223
+ "scrollLeft",
224
+ "scrollTo",
225
+ "scrollTop",
226
+ "scrollX",
227
+ "scrollY",
228
+ "self",
229
+ "stop",
230
+ "top",
231
+ "window"
232
+ ];
233
+ const KEYS = LIVING_KEYS.concat(OTHER_KEYS);
234
+
235
+ var jsdom = {
236
+ name: "jsdom",
237
+ async setup(global) {
238
+ const { JSDOM } = await import('jsdom');
239
+ const dom = new JSDOM("<!DOCTYPE html>", {
240
+ pretendToBeVisual: true,
241
+ runScripts: "dangerously",
242
+ url: "http://localhost:3000"
243
+ });
244
+ const keys = KEYS.concat(Object.getOwnPropertyNames(dom.window)).filter((k) => !k.startsWith("_")).filter((k) => !(k in global));
245
+ for (const key of keys)
246
+ global[key] = dom.window[key];
247
+ return {
248
+ teardown(global2) {
249
+ keys.forEach((key) => delete global2[key]);
250
+ }
251
+ };
252
+ }
253
+ };
254
+
255
+ var happy = {
256
+ name: "happy-dom",
257
+ async setup(global) {
258
+ const { Window } = await import('happy-dom');
259
+ const win = new Window();
260
+ const keys = KEYS.concat(Object.getOwnPropertyNames(win)).filter((k) => !k.startsWith("_")).filter((k) => !(k in global));
261
+ for (const key of keys)
262
+ global[key] = win[key];
263
+ return {
264
+ teardown(global2) {
265
+ win.happyDOM.cancelAsync();
266
+ keys.forEach((key) => delete global2[key]);
267
+ }
268
+ };
269
+ }
270
+ };
271
+
272
+ const environments = {
273
+ node,
274
+ jsdom,
275
+ "happy-dom": happy
276
+ };
277
+
278
+ const rpc = async (method, ...args) => {
279
+ var _a;
280
+ return (_a = process.__vitest_worker__) == null ? void 0 : _a.rpc(method, ...args);
281
+ };
282
+ const send = async (method, ...args) => {
283
+ var _a;
284
+ return (_a = process.__vitest_worker__) == null ? void 0 : _a.send(method, ...args);
285
+ };
286
+
287
+ var naturalCompare$2 = {exports: {}};
288
+
289
+ /*
290
+ * @version 1.4.0
291
+ * @date 2015-10-26
292
+ * @stability 3 - Stable
293
+ * @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
294
+ * @license MIT License
295
+ */
296
+
297
+
298
+ var naturalCompare = function(a, b) {
299
+ var i, codeA
300
+ , codeB = 1
301
+ , posA = 0
302
+ , posB = 0
303
+ , alphabet = String.alphabet;
304
+
305
+ function getCode(str, pos, code) {
306
+ if (code) {
307
+ for (i = pos; code = getCode(str, i), code < 76 && code > 65;) ++i;
308
+ return +str.slice(pos - 1, i)
309
+ }
310
+ code = alphabet && alphabet.indexOf(str.charAt(pos));
311
+ return code > -1 ? code + 76 : ((code = str.charCodeAt(pos) || 0), code < 45 || code > 127) ? code
312
+ : code < 46 ? 65 // -
313
+ : code < 48 ? code - 1
314
+ : code < 58 ? code + 18 // 0-9
315
+ : code < 65 ? code - 11
316
+ : code < 91 ? code + 11 // A-Z
317
+ : code < 97 ? code - 37
318
+ : code < 123 ? code + 5 // a-z
319
+ : code - 63
320
+ }
321
+
322
+
323
+ if ((a+="") != (b+="")) for (;codeB;) {
324
+ codeA = getCode(a, posA++);
325
+ codeB = getCode(b, posB++);
326
+
327
+ if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {
328
+ codeA = getCode(a, posA, posA);
329
+ codeB = getCode(b, posB, posA = i);
330
+ posB = i;
331
+ }
332
+
333
+ if (codeA != codeB) return (codeA < codeB) ? -1 : 1
334
+ }
335
+ return 0
336
+ };
337
+
338
+ try {
339
+ naturalCompare$2.exports = naturalCompare;
340
+ } catch (e) {
341
+ String.naturalCompare = naturalCompare;
342
+ }
343
+
344
+ var naturalCompare$1 = naturalCompare$2.exports;
345
+
346
+ var build = {};
347
+
348
+ var ansiStyles = {exports: {}};
349
+
350
+ (function (module) {
351
+
352
+ const ANSI_BACKGROUND_OFFSET = 10;
353
+
354
+ const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
355
+
356
+ const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
357
+
358
+ function assembleStyles() {
359
+ const codes = new Map();
360
+ const styles = {
361
+ modifier: {
362
+ reset: [0, 0],
363
+ // 21 isn't widely supported and 22 does the same thing
364
+ bold: [1, 22],
365
+ dim: [2, 22],
366
+ italic: [3, 23],
367
+ underline: [4, 24],
368
+ overline: [53, 55],
369
+ inverse: [7, 27],
370
+ hidden: [8, 28],
371
+ strikethrough: [9, 29]
372
+ },
373
+ color: {
374
+ black: [30, 39],
375
+ red: [31, 39],
376
+ green: [32, 39],
377
+ yellow: [33, 39],
378
+ blue: [34, 39],
379
+ magenta: [35, 39],
380
+ cyan: [36, 39],
381
+ white: [37, 39],
382
+
383
+ // Bright color
384
+ blackBright: [90, 39],
385
+ redBright: [91, 39],
386
+ greenBright: [92, 39],
387
+ yellowBright: [93, 39],
388
+ blueBright: [94, 39],
389
+ magentaBright: [95, 39],
390
+ cyanBright: [96, 39],
391
+ whiteBright: [97, 39]
392
+ },
393
+ bgColor: {
394
+ bgBlack: [40, 49],
395
+ bgRed: [41, 49],
396
+ bgGreen: [42, 49],
397
+ bgYellow: [43, 49],
398
+ bgBlue: [44, 49],
399
+ bgMagenta: [45, 49],
400
+ bgCyan: [46, 49],
401
+ bgWhite: [47, 49],
402
+
403
+ // Bright color
404
+ bgBlackBright: [100, 49],
405
+ bgRedBright: [101, 49],
406
+ bgGreenBright: [102, 49],
407
+ bgYellowBright: [103, 49],
408
+ bgBlueBright: [104, 49],
409
+ bgMagentaBright: [105, 49],
410
+ bgCyanBright: [106, 49],
411
+ bgWhiteBright: [107, 49]
412
+ }
413
+ };
414
+
415
+ // Alias bright black as gray (and grey)
416
+ styles.color.gray = styles.color.blackBright;
417
+ styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
418
+ styles.color.grey = styles.color.blackBright;
419
+ styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
420
+
421
+ for (const [groupName, group] of Object.entries(styles)) {
422
+ for (const [styleName, style] of Object.entries(group)) {
423
+ styles[styleName] = {
424
+ open: `\u001B[${style[0]}m`,
425
+ close: `\u001B[${style[1]}m`
426
+ };
427
+
428
+ group[styleName] = styles[styleName];
429
+
430
+ codes.set(style[0], style[1]);
431
+ }
432
+
433
+ Object.defineProperty(styles, groupName, {
434
+ value: group,
435
+ enumerable: false
436
+ });
437
+ }
438
+
439
+ Object.defineProperty(styles, 'codes', {
440
+ value: codes,
441
+ enumerable: false
442
+ });
443
+
444
+ styles.color.close = '\u001B[39m';
445
+ styles.bgColor.close = '\u001B[49m';
446
+
447
+ styles.color.ansi256 = wrapAnsi256();
448
+ styles.color.ansi16m = wrapAnsi16m();
449
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
450
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
451
+
452
+ // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
453
+ Object.defineProperties(styles, {
454
+ rgbToAnsi256: {
455
+ value: (red, green, blue) => {
456
+ // We use the extended greyscale palette here, with the exception of
457
+ // black and white. normal palette only has 4 greyscale shades.
458
+ if (red === green && green === blue) {
459
+ if (red < 8) {
460
+ return 16;
461
+ }
462
+
463
+ if (red > 248) {
464
+ return 231;
465
+ }
466
+
467
+ return Math.round(((red - 8) / 247) * 24) + 232;
468
+ }
469
+
470
+ return 16 +
471
+ (36 * Math.round(red / 255 * 5)) +
472
+ (6 * Math.round(green / 255 * 5)) +
473
+ Math.round(blue / 255 * 5);
474
+ },
475
+ enumerable: false
476
+ },
477
+ hexToRgb: {
478
+ value: hex => {
479
+ const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
480
+ if (!matches) {
481
+ return [0, 0, 0];
482
+ }
483
+
484
+ let {colorString} = matches.groups;
485
+
486
+ if (colorString.length === 3) {
487
+ colorString = colorString.split('').map(character => character + character).join('');
488
+ }
489
+
490
+ const integer = Number.parseInt(colorString, 16);
491
+
492
+ return [
493
+ (integer >> 16) & 0xFF,
494
+ (integer >> 8) & 0xFF,
495
+ integer & 0xFF
496
+ ];
497
+ },
498
+ enumerable: false
499
+ },
500
+ hexToAnsi256: {
501
+ value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
502
+ enumerable: false
503
+ }
504
+ });
505
+
506
+ return styles;
507
+ }
508
+
509
+ // Make the export immutable
510
+ Object.defineProperty(module, 'exports', {
511
+ enumerable: true,
512
+ get: assembleStyles
513
+ });
514
+ }(ansiStyles));
515
+
516
+ var collections = {};
517
+
518
+ Object.defineProperty(collections, '__esModule', {
519
+ value: true
520
+ });
521
+ collections.printIteratorEntries = printIteratorEntries;
522
+ collections.printIteratorValues = printIteratorValues;
523
+ collections.printListItems = printListItems;
524
+ collections.printObjectProperties = printObjectProperties;
525
+
526
+ /**
527
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
528
+ *
529
+ * This source code is licensed under the MIT license found in the
530
+ * LICENSE file in the root directory of this source tree.
531
+ *
532
+ */
533
+ const getKeysOfEnumerableProperties = (object, compareKeys) => {
534
+ const keys = Object.keys(object).sort(compareKeys);
535
+
536
+ if (Object.getOwnPropertySymbols) {
537
+ Object.getOwnPropertySymbols(object).forEach(symbol => {
538
+ if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
539
+ keys.push(symbol);
540
+ }
541
+ });
542
+ }
543
+
544
+ return keys;
545
+ };
546
+ /**
547
+ * Return entries (for example, of a map)
548
+ * with spacing, indentation, and comma
549
+ * without surrounding punctuation (for example, braces)
550
+ */
551
+
552
+ function printIteratorEntries(
553
+ iterator,
554
+ config,
555
+ indentation,
556
+ depth,
557
+ refs,
558
+ printer, // Too bad, so sad that separator for ECMAScript Map has been ' => '
559
+ // What a distracting diff if you change a data structure to/from
560
+ // ECMAScript Object or Immutable.Map/OrderedMap which use the default.
561
+ separator = ': '
562
+ ) {
563
+ let result = '';
564
+ let current = iterator.next();
565
+
566
+ if (!current.done) {
567
+ result += config.spacingOuter;
568
+ const indentationNext = indentation + config.indent;
569
+
570
+ while (!current.done) {
571
+ const name = printer(
572
+ current.value[0],
573
+ config,
574
+ indentationNext,
575
+ depth,
576
+ refs
577
+ );
578
+ const value = printer(
579
+ current.value[1],
580
+ config,
581
+ indentationNext,
582
+ depth,
583
+ refs
584
+ );
585
+ result += indentationNext + name + separator + value;
586
+ current = iterator.next();
587
+
588
+ if (!current.done) {
589
+ result += ',' + config.spacingInner;
590
+ } else if (!config.min) {
591
+ result += ',';
592
+ }
593
+ }
594
+
595
+ result += config.spacingOuter + indentation;
596
+ }
597
+
598
+ return result;
599
+ }
600
+ /**
601
+ * Return values (for example, of a set)
602
+ * with spacing, indentation, and comma
603
+ * without surrounding punctuation (braces or brackets)
604
+ */
605
+
606
+ function printIteratorValues(
607
+ iterator,
608
+ config,
609
+ indentation,
610
+ depth,
611
+ refs,
612
+ printer
613
+ ) {
614
+ let result = '';
615
+ let current = iterator.next();
616
+
617
+ if (!current.done) {
618
+ result += config.spacingOuter;
619
+ const indentationNext = indentation + config.indent;
620
+
621
+ while (!current.done) {
622
+ result +=
623
+ indentationNext +
624
+ printer(current.value, config, indentationNext, depth, refs);
625
+ current = iterator.next();
626
+
627
+ if (!current.done) {
628
+ result += ',' + config.spacingInner;
629
+ } else if (!config.min) {
630
+ result += ',';
631
+ }
632
+ }
633
+
634
+ result += config.spacingOuter + indentation;
635
+ }
636
+
637
+ return result;
638
+ }
639
+ /**
640
+ * Return items (for example, of an array)
641
+ * with spacing, indentation, and comma
642
+ * without surrounding punctuation (for example, brackets)
643
+ **/
644
+
645
+ function printListItems(list, config, indentation, depth, refs, printer) {
646
+ let result = '';
647
+
648
+ if (list.length) {
649
+ result += config.spacingOuter;
650
+ const indentationNext = indentation + config.indent;
651
+
652
+ for (let i = 0; i < list.length; i++) {
653
+ result += indentationNext;
654
+
655
+ if (i in list) {
656
+ result += printer(list[i], config, indentationNext, depth, refs);
657
+ }
658
+
659
+ if (i < list.length - 1) {
660
+ result += ',' + config.spacingInner;
661
+ } else if (!config.min) {
662
+ result += ',';
663
+ }
664
+ }
665
+
666
+ result += config.spacingOuter + indentation;
667
+ }
668
+
669
+ return result;
670
+ }
671
+ /**
672
+ * Return properties of an object
673
+ * with spacing, indentation, and comma
674
+ * without surrounding punctuation (for example, braces)
675
+ */
676
+
677
+ function printObjectProperties(val, config, indentation, depth, refs, printer) {
678
+ let result = '';
679
+ const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
680
+
681
+ if (keys.length) {
682
+ result += config.spacingOuter;
683
+ const indentationNext = indentation + config.indent;
684
+
685
+ for (let i = 0; i < keys.length; i++) {
686
+ const key = keys[i];
687
+ const name = printer(key, config, indentationNext, depth, refs);
688
+ const value = printer(val[key], config, indentationNext, depth, refs);
689
+ result += indentationNext + name + ': ' + value;
690
+
691
+ if (i < keys.length - 1) {
692
+ result += ',' + config.spacingInner;
693
+ } else if (!config.min) {
694
+ result += ',';
695
+ }
696
+ }
697
+
698
+ result += config.spacingOuter + indentation;
699
+ }
700
+
701
+ return result;
702
+ }
703
+
704
+ var AsymmetricMatcher$1 = {};
705
+
706
+ Object.defineProperty(AsymmetricMatcher$1, '__esModule', {
707
+ value: true
708
+ });
709
+ AsymmetricMatcher$1.default = AsymmetricMatcher$1.test = AsymmetricMatcher$1.serialize = void 0;
710
+
711
+ var _collections$3 = collections;
712
+
713
+ var global$1 = (function () {
714
+ if (typeof globalThis !== 'undefined') {
715
+ return globalThis;
716
+ } else if (typeof global$1 !== 'undefined') {
717
+ return global$1;
718
+ } else if (typeof self !== 'undefined') {
719
+ return self;
720
+ } else if (typeof window !== 'undefined') {
721
+ return window;
722
+ } else {
723
+ return Function('return this')();
724
+ }
725
+ })();
726
+
727
+ var Symbol$2 = global$1['jest-symbol-do-not-touch'] || global$1.Symbol;
728
+ const asymmetricMatcher =
729
+ typeof Symbol$2 === 'function' && Symbol$2.for
730
+ ? Symbol$2.for('jest.asymmetricMatcher')
731
+ : 0x1357a5;
732
+ const SPACE$2 = ' ';
733
+
734
+ const serialize$7 = (val, config, indentation, depth, refs, printer) => {
735
+ const stringedValue = val.toString();
736
+
737
+ if (
738
+ stringedValue === 'ArrayContaining' ||
739
+ stringedValue === 'ArrayNotContaining'
740
+ ) {
741
+ if (++depth > config.maxDepth) {
742
+ return '[' + stringedValue + ']';
743
+ }
744
+
745
+ return (
746
+ stringedValue +
747
+ SPACE$2 +
748
+ '[' +
749
+ (0, _collections$3.printListItems)(
750
+ val.sample,
751
+ config,
752
+ indentation,
753
+ depth,
754
+ refs,
755
+ printer
756
+ ) +
757
+ ']'
758
+ );
759
+ }
760
+
761
+ if (
762
+ stringedValue === 'ObjectContaining' ||
763
+ stringedValue === 'ObjectNotContaining'
764
+ ) {
765
+ if (++depth > config.maxDepth) {
766
+ return '[' + stringedValue + ']';
767
+ }
768
+
769
+ return (
770
+ stringedValue +
771
+ SPACE$2 +
772
+ '{' +
773
+ (0, _collections$3.printObjectProperties)(
774
+ val.sample,
775
+ config,
776
+ indentation,
777
+ depth,
778
+ refs,
779
+ printer
780
+ ) +
781
+ '}'
782
+ );
783
+ }
784
+
785
+ if (
786
+ stringedValue === 'StringMatching' ||
787
+ stringedValue === 'StringNotMatching'
788
+ ) {
789
+ return (
790
+ stringedValue +
791
+ SPACE$2 +
792
+ printer(val.sample, config, indentation, depth, refs)
793
+ );
794
+ }
795
+
796
+ if (
797
+ stringedValue === 'StringContaining' ||
798
+ stringedValue === 'StringNotContaining'
799
+ ) {
800
+ return (
801
+ stringedValue +
802
+ SPACE$2 +
803
+ printer(val.sample, config, indentation, depth, refs)
804
+ );
805
+ }
806
+
807
+ return val.toAsymmetricMatcher();
808
+ };
809
+
810
+ AsymmetricMatcher$1.serialize = serialize$7;
811
+
812
+ const test$6 = val => val && val.$$typeof === asymmetricMatcher;
813
+
814
+ AsymmetricMatcher$1.test = test$6;
815
+ const plugin$6 = {
816
+ serialize: serialize$7,
817
+ test: test$6
818
+ };
819
+ var _default$7 = plugin$6;
820
+ AsymmetricMatcher$1.default = _default$7;
821
+
822
+ var ConvertAnsi = {};
823
+
824
+ var ansiRegex = ({onlyFirst = false} = {}) => {
825
+ const pattern = [
826
+ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
827
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
828
+ ].join('|');
829
+
830
+ return new RegExp(pattern, onlyFirst ? undefined : 'g');
831
+ };
832
+
833
+ Object.defineProperty(ConvertAnsi, '__esModule', {
834
+ value: true
835
+ });
836
+ ConvertAnsi.default = ConvertAnsi.serialize = ConvertAnsi.test = void 0;
837
+
838
+ var _ansiRegex = _interopRequireDefault$2(ansiRegex);
839
+
840
+ var _ansiStyles$1 = _interopRequireDefault$2(ansiStyles.exports);
841
+
842
+ function _interopRequireDefault$2(obj) {
843
+ return obj && obj.__esModule ? obj : {default: obj};
844
+ }
845
+
846
+ /**
847
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
848
+ *
849
+ * This source code is licensed under the MIT license found in the
850
+ * LICENSE file in the root directory of this source tree.
851
+ */
852
+ const toHumanReadableAnsi = text =>
853
+ text.replace((0, _ansiRegex.default)(), match => {
854
+ switch (match) {
855
+ case _ansiStyles$1.default.red.close:
856
+ case _ansiStyles$1.default.green.close:
857
+ case _ansiStyles$1.default.cyan.close:
858
+ case _ansiStyles$1.default.gray.close:
859
+ case _ansiStyles$1.default.white.close:
860
+ case _ansiStyles$1.default.yellow.close:
861
+ case _ansiStyles$1.default.bgRed.close:
862
+ case _ansiStyles$1.default.bgGreen.close:
863
+ case _ansiStyles$1.default.bgYellow.close:
864
+ case _ansiStyles$1.default.inverse.close:
865
+ case _ansiStyles$1.default.dim.close:
866
+ case _ansiStyles$1.default.bold.close:
867
+ case _ansiStyles$1.default.reset.open:
868
+ case _ansiStyles$1.default.reset.close:
869
+ return '</>';
870
+
871
+ case _ansiStyles$1.default.red.open:
872
+ return '<red>';
873
+
874
+ case _ansiStyles$1.default.green.open:
875
+ return '<green>';
876
+
877
+ case _ansiStyles$1.default.cyan.open:
878
+ return '<cyan>';
879
+
880
+ case _ansiStyles$1.default.gray.open:
881
+ return '<gray>';
882
+
883
+ case _ansiStyles$1.default.white.open:
884
+ return '<white>';
885
+
886
+ case _ansiStyles$1.default.yellow.open:
887
+ return '<yellow>';
888
+
889
+ case _ansiStyles$1.default.bgRed.open:
890
+ return '<bgRed>';
891
+
892
+ case _ansiStyles$1.default.bgGreen.open:
893
+ return '<bgGreen>';
894
+
895
+ case _ansiStyles$1.default.bgYellow.open:
896
+ return '<bgYellow>';
897
+
898
+ case _ansiStyles$1.default.inverse.open:
899
+ return '<inverse>';
900
+
901
+ case _ansiStyles$1.default.dim.open:
902
+ return '<dim>';
903
+
904
+ case _ansiStyles$1.default.bold.open:
905
+ return '<bold>';
906
+
907
+ default:
908
+ return '';
909
+ }
910
+ });
911
+
912
+ const test$5 = val =>
913
+ typeof val === 'string' && !!val.match((0, _ansiRegex.default)());
914
+
915
+ ConvertAnsi.test = test$5;
916
+
917
+ const serialize$6 = (val, config, indentation, depth, refs, printer) =>
918
+ printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
919
+
920
+ ConvertAnsi.serialize = serialize$6;
921
+ const plugin$5 = {
922
+ serialize: serialize$6,
923
+ test: test$5
924
+ };
925
+ var _default$6 = plugin$5;
926
+ ConvertAnsi.default = _default$6;
927
+
928
+ var DOMCollection$1 = {};
929
+
930
+ Object.defineProperty(DOMCollection$1, '__esModule', {
931
+ value: true
932
+ });
933
+ DOMCollection$1.default = DOMCollection$1.serialize = DOMCollection$1.test = void 0;
934
+
935
+ var _collections$2 = collections;
936
+
937
+ /**
938
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
939
+ *
940
+ * This source code is licensed under the MIT license found in the
941
+ * LICENSE file in the root directory of this source tree.
942
+ */
943
+
944
+ /* eslint-disable local/ban-types-eventually */
945
+ const SPACE$1 = ' ';
946
+ const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
947
+ const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
948
+
949
+ const testName = name =>
950
+ OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);
951
+
952
+ const test$4 = val =>
953
+ val &&
954
+ val.constructor &&
955
+ !!val.constructor.name &&
956
+ testName(val.constructor.name);
957
+
958
+ DOMCollection$1.test = test$4;
959
+
960
+ const isNamedNodeMap = collection =>
961
+ collection.constructor.name === 'NamedNodeMap';
962
+
963
+ const serialize$5 = (collection, config, indentation, depth, refs, printer) => {
964
+ const name = collection.constructor.name;
965
+
966
+ if (++depth > config.maxDepth) {
967
+ return '[' + name + ']';
968
+ }
969
+
970
+ return (
971
+ (config.min ? '' : name + SPACE$1) +
972
+ (OBJECT_NAMES.indexOf(name) !== -1
973
+ ? '{' +
974
+ (0, _collections$2.printObjectProperties)(
975
+ isNamedNodeMap(collection)
976
+ ? Array.from(collection).reduce((props, attribute) => {
977
+ props[attribute.name] = attribute.value;
978
+ return props;
979
+ }, {})
980
+ : {...collection},
981
+ config,
982
+ indentation,
983
+ depth,
984
+ refs,
985
+ printer
986
+ ) +
987
+ '}'
988
+ : '[' +
989
+ (0, _collections$2.printListItems)(
990
+ Array.from(collection),
991
+ config,
992
+ indentation,
993
+ depth,
994
+ refs,
995
+ printer
996
+ ) +
997
+ ']')
998
+ );
999
+ };
1000
+
1001
+ DOMCollection$1.serialize = serialize$5;
1002
+ const plugin$4 = {
1003
+ serialize: serialize$5,
1004
+ test: test$4
1005
+ };
1006
+ var _default$5 = plugin$4;
1007
+ DOMCollection$1.default = _default$5;
1008
+
1009
+ var DOMElement$1 = {};
1010
+
1011
+ var markup = {};
1012
+
1013
+ var escapeHTML$1 = {};
1014
+
1015
+ Object.defineProperty(escapeHTML$1, '__esModule', {
1016
+ value: true
1017
+ });
1018
+ escapeHTML$1.default = escapeHTML;
1019
+
1020
+ /**
1021
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1022
+ *
1023
+ * This source code is licensed under the MIT license found in the
1024
+ * LICENSE file in the root directory of this source tree.
1025
+ */
1026
+ function escapeHTML(str) {
1027
+ return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
1028
+ }
1029
+
1030
+ Object.defineProperty(markup, '__esModule', {
1031
+ value: true
1032
+ });
1033
+ markup.printElementAsLeaf =
1034
+ markup.printElement =
1035
+ markup.printComment =
1036
+ markup.printText =
1037
+ markup.printChildren =
1038
+ markup.printProps =
1039
+ void 0;
1040
+
1041
+ var _escapeHTML = _interopRequireDefault$1(escapeHTML$1);
1042
+
1043
+ function _interopRequireDefault$1(obj) {
1044
+ return obj && obj.__esModule ? obj : {default: obj};
1045
+ }
1046
+
1047
+ /**
1048
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1049
+ *
1050
+ * This source code is licensed under the MIT license found in the
1051
+ * LICENSE file in the root directory of this source tree.
1052
+ */
1053
+ // Return empty string if keys is empty.
1054
+ const printProps = (keys, props, config, indentation, depth, refs, printer) => {
1055
+ const indentationNext = indentation + config.indent;
1056
+ const colors = config.colors;
1057
+ return keys
1058
+ .map(key => {
1059
+ const value = props[key];
1060
+ let printed = printer(value, config, indentationNext, depth, refs);
1061
+
1062
+ if (typeof value !== 'string') {
1063
+ if (printed.indexOf('\n') !== -1) {
1064
+ printed =
1065
+ config.spacingOuter +
1066
+ indentationNext +
1067
+ printed +
1068
+ config.spacingOuter +
1069
+ indentation;
1070
+ }
1071
+
1072
+ printed = '{' + printed + '}';
1073
+ }
1074
+
1075
+ return (
1076
+ config.spacingInner +
1077
+ indentation +
1078
+ colors.prop.open +
1079
+ key +
1080
+ colors.prop.close +
1081
+ '=' +
1082
+ colors.value.open +
1083
+ printed +
1084
+ colors.value.close
1085
+ );
1086
+ })
1087
+ .join('');
1088
+ }; // Return empty string if children is empty.
1089
+
1090
+ markup.printProps = printProps;
1091
+
1092
+ const printChildren = (children, config, indentation, depth, refs, printer) =>
1093
+ children
1094
+ .map(
1095
+ child =>
1096
+ config.spacingOuter +
1097
+ indentation +
1098
+ (typeof child === 'string'
1099
+ ? printText(child, config)
1100
+ : printer(child, config, indentation, depth, refs))
1101
+ )
1102
+ .join('');
1103
+
1104
+ markup.printChildren = printChildren;
1105
+
1106
+ const printText = (text, config) => {
1107
+ const contentColor = config.colors.content;
1108
+ return (
1109
+ contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close
1110
+ );
1111
+ };
1112
+
1113
+ markup.printText = printText;
1114
+
1115
+ const printComment = (comment, config) => {
1116
+ const commentColor = config.colors.comment;
1117
+ return (
1118
+ commentColor.open +
1119
+ '<!--' +
1120
+ (0, _escapeHTML.default)(comment) +
1121
+ '-->' +
1122
+ commentColor.close
1123
+ );
1124
+ }; // Separate the functions to format props, children, and element,
1125
+ // so a plugin could override a particular function, if needed.
1126
+ // Too bad, so sad: the traditional (but unnecessary) space
1127
+ // in a self-closing tagColor requires a second test of printedProps.
1128
+
1129
+ markup.printComment = printComment;
1130
+
1131
+ const printElement = (
1132
+ type,
1133
+ printedProps,
1134
+ printedChildren,
1135
+ config,
1136
+ indentation
1137
+ ) => {
1138
+ const tagColor = config.colors.tag;
1139
+ return (
1140
+ tagColor.open +
1141
+ '<' +
1142
+ type +
1143
+ (printedProps &&
1144
+ tagColor.close +
1145
+ printedProps +
1146
+ config.spacingOuter +
1147
+ indentation +
1148
+ tagColor.open) +
1149
+ (printedChildren
1150
+ ? '>' +
1151
+ tagColor.close +
1152
+ printedChildren +
1153
+ config.spacingOuter +
1154
+ indentation +
1155
+ tagColor.open +
1156
+ '</' +
1157
+ type
1158
+ : (printedProps && !config.min ? '' : ' ') + '/') +
1159
+ '>' +
1160
+ tagColor.close
1161
+ );
1162
+ };
1163
+
1164
+ markup.printElement = printElement;
1165
+
1166
+ const printElementAsLeaf = (type, config) => {
1167
+ const tagColor = config.colors.tag;
1168
+ return (
1169
+ tagColor.open +
1170
+ '<' +
1171
+ type +
1172
+ tagColor.close +
1173
+ ' …' +
1174
+ tagColor.open +
1175
+ ' />' +
1176
+ tagColor.close
1177
+ );
1178
+ };
1179
+
1180
+ markup.printElementAsLeaf = printElementAsLeaf;
1181
+
1182
+ Object.defineProperty(DOMElement$1, '__esModule', {
1183
+ value: true
1184
+ });
1185
+ DOMElement$1.default = DOMElement$1.serialize = DOMElement$1.test = void 0;
1186
+
1187
+ var _markup$2 = markup;
1188
+
1189
+ /**
1190
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1191
+ *
1192
+ * This source code is licensed under the MIT license found in the
1193
+ * LICENSE file in the root directory of this source tree.
1194
+ */
1195
+ const ELEMENT_NODE = 1;
1196
+ const TEXT_NODE = 3;
1197
+ const COMMENT_NODE = 8;
1198
+ const FRAGMENT_NODE = 11;
1199
+ const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
1200
+
1201
+ const testHasAttribute = val => {
1202
+ try {
1203
+ return typeof val.hasAttribute === 'function' && val.hasAttribute('is');
1204
+ } catch {
1205
+ return false;
1206
+ }
1207
+ };
1208
+
1209
+ const testNode = val => {
1210
+ const constructorName = val.constructor.name;
1211
+ const {nodeType, tagName} = val;
1212
+ const isCustomElement =
1213
+ (typeof tagName === 'string' && tagName.includes('-')) ||
1214
+ testHasAttribute(val);
1215
+ return (
1216
+ (nodeType === ELEMENT_NODE &&
1217
+ (ELEMENT_REGEXP.test(constructorName) || isCustomElement)) ||
1218
+ (nodeType === TEXT_NODE && constructorName === 'Text') ||
1219
+ (nodeType === COMMENT_NODE && constructorName === 'Comment') ||
1220
+ (nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment')
1221
+ );
1222
+ };
1223
+
1224
+ const test$3 = val => {
1225
+ var _val$constructor;
1226
+
1227
+ return (
1228
+ (val === null || val === void 0
1229
+ ? void 0
1230
+ : (_val$constructor = val.constructor) === null ||
1231
+ _val$constructor === void 0
1232
+ ? void 0
1233
+ : _val$constructor.name) && testNode(val)
1234
+ );
1235
+ };
1236
+
1237
+ DOMElement$1.test = test$3;
1238
+
1239
+ function nodeIsText(node) {
1240
+ return node.nodeType === TEXT_NODE;
1241
+ }
1242
+
1243
+ function nodeIsComment(node) {
1244
+ return node.nodeType === COMMENT_NODE;
1245
+ }
1246
+
1247
+ function nodeIsFragment(node) {
1248
+ return node.nodeType === FRAGMENT_NODE;
1249
+ }
1250
+
1251
+ const serialize$4 = (node, config, indentation, depth, refs, printer) => {
1252
+ if (nodeIsText(node)) {
1253
+ return (0, _markup$2.printText)(node.data, config);
1254
+ }
1255
+
1256
+ if (nodeIsComment(node)) {
1257
+ return (0, _markup$2.printComment)(node.data, config);
1258
+ }
1259
+
1260
+ const type = nodeIsFragment(node)
1261
+ ? `DocumentFragment`
1262
+ : node.tagName.toLowerCase();
1263
+
1264
+ if (++depth > config.maxDepth) {
1265
+ return (0, _markup$2.printElementAsLeaf)(type, config);
1266
+ }
1267
+
1268
+ return (0, _markup$2.printElement)(
1269
+ type,
1270
+ (0, _markup$2.printProps)(
1271
+ nodeIsFragment(node)
1272
+ ? []
1273
+ : Array.from(node.attributes)
1274
+ .map(attr => attr.name)
1275
+ .sort(),
1276
+ nodeIsFragment(node)
1277
+ ? {}
1278
+ : Array.from(node.attributes).reduce((props, attribute) => {
1279
+ props[attribute.name] = attribute.value;
1280
+ return props;
1281
+ }, {}),
1282
+ config,
1283
+ indentation + config.indent,
1284
+ depth,
1285
+ refs,
1286
+ printer
1287
+ ),
1288
+ (0, _markup$2.printChildren)(
1289
+ Array.prototype.slice.call(node.childNodes || node.children),
1290
+ config,
1291
+ indentation + config.indent,
1292
+ depth,
1293
+ refs,
1294
+ printer
1295
+ ),
1296
+ config,
1297
+ indentation
1298
+ );
1299
+ };
1300
+
1301
+ DOMElement$1.serialize = serialize$4;
1302
+ const plugin$3 = {
1303
+ serialize: serialize$4,
1304
+ test: test$3
1305
+ };
1306
+ var _default$4 = plugin$3;
1307
+ DOMElement$1.default = _default$4;
1308
+
1309
+ var Immutable$1 = {};
1310
+
1311
+ Object.defineProperty(Immutable$1, '__esModule', {
1312
+ value: true
1313
+ });
1314
+ Immutable$1.default = Immutable$1.test = Immutable$1.serialize = void 0;
1315
+
1316
+ var _collections$1 = collections;
1317
+
1318
+ /**
1319
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1320
+ *
1321
+ * This source code is licensed under the MIT license found in the
1322
+ * LICENSE file in the root directory of this source tree.
1323
+ */
1324
+ // SENTINEL constants are from https://github.com/facebook/immutable-js
1325
+ const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
1326
+ const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
1327
+ const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
1328
+ const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
1329
+ const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
1330
+ const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
1331
+
1332
+ const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
1333
+ const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
1334
+ const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
1335
+
1336
+ const getImmutableName = name => 'Immutable.' + name;
1337
+
1338
+ const printAsLeaf = name => '[' + name + ']';
1339
+
1340
+ const SPACE = ' ';
1341
+ const LAZY = '…'; // Seq is lazy if it calls a method like filter
1342
+
1343
+ const printImmutableEntries = (
1344
+ val,
1345
+ config,
1346
+ indentation,
1347
+ depth,
1348
+ refs,
1349
+ printer,
1350
+ type
1351
+ ) =>
1352
+ ++depth > config.maxDepth
1353
+ ? printAsLeaf(getImmutableName(type))
1354
+ : getImmutableName(type) +
1355
+ SPACE +
1356
+ '{' +
1357
+ (0, _collections$1.printIteratorEntries)(
1358
+ val.entries(),
1359
+ config,
1360
+ indentation,
1361
+ depth,
1362
+ refs,
1363
+ printer
1364
+ ) +
1365
+ '}'; // Record has an entries method because it is a collection in immutable v3.
1366
+ // Return an iterator for Immutable Record from version v3 or v4.
1367
+
1368
+ function getRecordEntries(val) {
1369
+ let i = 0;
1370
+ return {
1371
+ next() {
1372
+ if (i < val._keys.length) {
1373
+ const key = val._keys[i++];
1374
+ return {
1375
+ done: false,
1376
+ value: [key, val.get(key)]
1377
+ };
1378
+ }
1379
+
1380
+ return {
1381
+ done: true,
1382
+ value: undefined
1383
+ };
1384
+ }
1385
+ };
1386
+ }
1387
+
1388
+ const printImmutableRecord = (
1389
+ val,
1390
+ config,
1391
+ indentation,
1392
+ depth,
1393
+ refs,
1394
+ printer
1395
+ ) => {
1396
+ // _name property is defined only for an Immutable Record instance
1397
+ // which was constructed with a second optional descriptive name arg
1398
+ const name = getImmutableName(val._name || 'Record');
1399
+ return ++depth > config.maxDepth
1400
+ ? printAsLeaf(name)
1401
+ : name +
1402
+ SPACE +
1403
+ '{' +
1404
+ (0, _collections$1.printIteratorEntries)(
1405
+ getRecordEntries(val),
1406
+ config,
1407
+ indentation,
1408
+ depth,
1409
+ refs,
1410
+ printer
1411
+ ) +
1412
+ '}';
1413
+ };
1414
+
1415
+ const printImmutableSeq = (val, config, indentation, depth, refs, printer) => {
1416
+ const name = getImmutableName('Seq');
1417
+
1418
+ if (++depth > config.maxDepth) {
1419
+ return printAsLeaf(name);
1420
+ }
1421
+
1422
+ if (val[IS_KEYED_SENTINEL]) {
1423
+ return (
1424
+ name +
1425
+ SPACE +
1426
+ '{' +
1427
+ (val._iter || val._object
1428
+ ? (0, _collections$1.printIteratorEntries)(
1429
+ val.entries(),
1430
+ config,
1431
+ indentation,
1432
+ depth,
1433
+ refs,
1434
+ printer
1435
+ )
1436
+ : LAZY) +
1437
+ '}'
1438
+ );
1439
+ }
1440
+
1441
+ return (
1442
+ name +
1443
+ SPACE +
1444
+ '[' +
1445
+ (val._iter || // from Immutable collection of values
1446
+ val._array || // from ECMAScript array
1447
+ val._collection || // from ECMAScript collection in immutable v4
1448
+ val._iterable // from ECMAScript collection in immutable v3
1449
+ ? (0, _collections$1.printIteratorValues)(
1450
+ val.values(),
1451
+ config,
1452
+ indentation,
1453
+ depth,
1454
+ refs,
1455
+ printer
1456
+ )
1457
+ : LAZY) +
1458
+ ']'
1459
+ );
1460
+ };
1461
+
1462
+ const printImmutableValues = (
1463
+ val,
1464
+ config,
1465
+ indentation,
1466
+ depth,
1467
+ refs,
1468
+ printer,
1469
+ type
1470
+ ) =>
1471
+ ++depth > config.maxDepth
1472
+ ? printAsLeaf(getImmutableName(type))
1473
+ : getImmutableName(type) +
1474
+ SPACE +
1475
+ '[' +
1476
+ (0, _collections$1.printIteratorValues)(
1477
+ val.values(),
1478
+ config,
1479
+ indentation,
1480
+ depth,
1481
+ refs,
1482
+ printer
1483
+ ) +
1484
+ ']';
1485
+
1486
+ const serialize$3 = (val, config, indentation, depth, refs, printer) => {
1487
+ if (val[IS_MAP_SENTINEL]) {
1488
+ return printImmutableEntries(
1489
+ val,
1490
+ config,
1491
+ indentation,
1492
+ depth,
1493
+ refs,
1494
+ printer,
1495
+ val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map'
1496
+ );
1497
+ }
1498
+
1499
+ if (val[IS_LIST_SENTINEL]) {
1500
+ return printImmutableValues(
1501
+ val,
1502
+ config,
1503
+ indentation,
1504
+ depth,
1505
+ refs,
1506
+ printer,
1507
+ 'List'
1508
+ );
1509
+ }
1510
+
1511
+ if (val[IS_SET_SENTINEL]) {
1512
+ return printImmutableValues(
1513
+ val,
1514
+ config,
1515
+ indentation,
1516
+ depth,
1517
+ refs,
1518
+ printer,
1519
+ val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set'
1520
+ );
1521
+ }
1522
+
1523
+ if (val[IS_STACK_SENTINEL]) {
1524
+ return printImmutableValues(
1525
+ val,
1526
+ config,
1527
+ indentation,
1528
+ depth,
1529
+ refs,
1530
+ printer,
1531
+ 'Stack'
1532
+ );
1533
+ }
1534
+
1535
+ if (val[IS_SEQ_SENTINEL]) {
1536
+ return printImmutableSeq(val, config, indentation, depth, refs, printer);
1537
+ } // For compatibility with immutable v3 and v4, let record be the default.
1538
+
1539
+ return printImmutableRecord(val, config, indentation, depth, refs, printer);
1540
+ }; // Explicitly comparing sentinel properties to true avoids false positive
1541
+ // when mock identity-obj-proxy returns the key as the value for any key.
1542
+
1543
+ Immutable$1.serialize = serialize$3;
1544
+
1545
+ const test$2 = val =>
1546
+ val &&
1547
+ (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
1548
+
1549
+ Immutable$1.test = test$2;
1550
+ const plugin$2 = {
1551
+ serialize: serialize$3,
1552
+ test: test$2
1553
+ };
1554
+ var _default$3 = plugin$2;
1555
+ Immutable$1.default = _default$3;
1556
+
1557
+ var ReactElement$1 = {};
1558
+
1559
+ var reactIs = {exports: {}};
1560
+
1561
+ var reactIs_production_min = {};
1562
+
1563
+ /** @license React v17.0.2
1564
+ * react-is.production.min.js
1565
+ *
1566
+ * Copyright (c) Facebook, Inc. and its affiliates.
1567
+ *
1568
+ * This source code is licensed under the MIT license found in the
1569
+ * LICENSE file in the root directory of this source tree.
1570
+ */
1571
+ var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;
1572
+ if("function"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x("react.element");c=x("react.portal");d=x("react.fragment");e=x("react.strict_mode");f=x("react.profiler");g=x("react.provider");h=x("react.context");k=x("react.forward_ref");l=x("react.suspense");m=x("react.suspense_list");n=x("react.memo");p=x("react.lazy");q=x("react.block");r=x("react.server.block");u=x("react.fundamental");v=x("react.debug_trace_mode");w=x("react.legacy_hidden");}
1573
+ function y(a){if("object"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=z;reactIs_production_min.Element=A;reactIs_production_min.ForwardRef=B;reactIs_production_min.Fragment=C;reactIs_production_min.Lazy=D;reactIs_production_min.Memo=E;reactIs_production_min.Portal=F;reactIs_production_min.Profiler=G;reactIs_production_min.StrictMode=H;
1574
+ reactIs_production_min.Suspense=I;reactIs_production_min.isAsyncMode=function(){return !1};reactIs_production_min.isConcurrentMode=function(){return !1};reactIs_production_min.isContextConsumer=function(a){return y(a)===h};reactIs_production_min.isContextProvider=function(a){return y(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return y(a)===k};reactIs_production_min.isFragment=function(a){return y(a)===d};reactIs_production_min.isLazy=function(a){return y(a)===p};reactIs_production_min.isMemo=function(a){return y(a)===n};
1575
+ reactIs_production_min.isPortal=function(a){return y(a)===c};reactIs_production_min.isProfiler=function(a){return y(a)===f};reactIs_production_min.isStrictMode=function(a){return y(a)===e};reactIs_production_min.isSuspense=function(a){return y(a)===l};reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||"object"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};
1576
+ reactIs_production_min.typeOf=y;
1577
+
1578
+ var reactIs_development = {};
1579
+
1580
+ /** @license React v17.0.2
1581
+ * react-is.development.js
1582
+ *
1583
+ * Copyright (c) Facebook, Inc. and its affiliates.
1584
+ *
1585
+ * This source code is licensed under the MIT license found in the
1586
+ * LICENSE file in the root directory of this source tree.
1587
+ */
1588
+
1589
+ if (process.env.NODE_ENV !== "production") {
1590
+ (function() {
1591
+
1592
+ // ATTENTION
1593
+ // When adding new symbols to this file,
1594
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
1595
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
1596
+ // nor polyfill, then a plain number is used for performance.
1597
+ var REACT_ELEMENT_TYPE = 0xeac7;
1598
+ var REACT_PORTAL_TYPE = 0xeaca;
1599
+ var REACT_FRAGMENT_TYPE = 0xeacb;
1600
+ var REACT_STRICT_MODE_TYPE = 0xeacc;
1601
+ var REACT_PROFILER_TYPE = 0xead2;
1602
+ var REACT_PROVIDER_TYPE = 0xeacd;
1603
+ var REACT_CONTEXT_TYPE = 0xeace;
1604
+ var REACT_FORWARD_REF_TYPE = 0xead0;
1605
+ var REACT_SUSPENSE_TYPE = 0xead1;
1606
+ var REACT_SUSPENSE_LIST_TYPE = 0xead8;
1607
+ var REACT_MEMO_TYPE = 0xead3;
1608
+ var REACT_LAZY_TYPE = 0xead4;
1609
+ var REACT_BLOCK_TYPE = 0xead9;
1610
+ var REACT_SERVER_BLOCK_TYPE = 0xeada;
1611
+ var REACT_FUNDAMENTAL_TYPE = 0xead5;
1612
+ var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
1613
+ var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
1614
+
1615
+ if (typeof Symbol === 'function' && Symbol.for) {
1616
+ var symbolFor = Symbol.for;
1617
+ REACT_ELEMENT_TYPE = symbolFor('react.element');
1618
+ REACT_PORTAL_TYPE = symbolFor('react.portal');
1619
+ REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
1620
+ REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
1621
+ REACT_PROFILER_TYPE = symbolFor('react.profiler');
1622
+ REACT_PROVIDER_TYPE = symbolFor('react.provider');
1623
+ REACT_CONTEXT_TYPE = symbolFor('react.context');
1624
+ REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
1625
+ REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
1626
+ REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
1627
+ REACT_MEMO_TYPE = symbolFor('react.memo');
1628
+ REACT_LAZY_TYPE = symbolFor('react.lazy');
1629
+ REACT_BLOCK_TYPE = symbolFor('react.block');
1630
+ REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
1631
+ REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
1632
+ symbolFor('react.scope');
1633
+ symbolFor('react.opaque.id');
1634
+ REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
1635
+ symbolFor('react.offscreen');
1636
+ REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
1637
+ }
1638
+
1639
+ // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1640
+
1641
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
1642
+
1643
+ function isValidElementType(type) {
1644
+ if (typeof type === 'string' || typeof type === 'function') {
1645
+ return true;
1646
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1647
+
1648
+
1649
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
1650
+ return true;
1651
+ }
1652
+
1653
+ if (typeof type === 'object' && type !== null) {
1654
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
1655
+ return true;
1656
+ }
1657
+ }
1658
+
1659
+ return false;
1660
+ }
1661
+
1662
+ function typeOf(object) {
1663
+ if (typeof object === 'object' && object !== null) {
1664
+ var $$typeof = object.$$typeof;
1665
+
1666
+ switch ($$typeof) {
1667
+ case REACT_ELEMENT_TYPE:
1668
+ var type = object.type;
1669
+
1670
+ switch (type) {
1671
+ case REACT_FRAGMENT_TYPE:
1672
+ case REACT_PROFILER_TYPE:
1673
+ case REACT_STRICT_MODE_TYPE:
1674
+ case REACT_SUSPENSE_TYPE:
1675
+ case REACT_SUSPENSE_LIST_TYPE:
1676
+ return type;
1677
+
1678
+ default:
1679
+ var $$typeofType = type && type.$$typeof;
1680
+
1681
+ switch ($$typeofType) {
1682
+ case REACT_CONTEXT_TYPE:
1683
+ case REACT_FORWARD_REF_TYPE:
1684
+ case REACT_LAZY_TYPE:
1685
+ case REACT_MEMO_TYPE:
1686
+ case REACT_PROVIDER_TYPE:
1687
+ return $$typeofType;
1688
+
1689
+ default:
1690
+ return $$typeof;
1691
+ }
1692
+
1693
+ }
1694
+
1695
+ case REACT_PORTAL_TYPE:
1696
+ return $$typeof;
1697
+ }
1698
+ }
1699
+
1700
+ return undefined;
1701
+ }
1702
+ var ContextConsumer = REACT_CONTEXT_TYPE;
1703
+ var ContextProvider = REACT_PROVIDER_TYPE;
1704
+ var Element = REACT_ELEMENT_TYPE;
1705
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
1706
+ var Fragment = REACT_FRAGMENT_TYPE;
1707
+ var Lazy = REACT_LAZY_TYPE;
1708
+ var Memo = REACT_MEMO_TYPE;
1709
+ var Portal = REACT_PORTAL_TYPE;
1710
+ var Profiler = REACT_PROFILER_TYPE;
1711
+ var StrictMode = REACT_STRICT_MODE_TYPE;
1712
+ var Suspense = REACT_SUSPENSE_TYPE;
1713
+ var hasWarnedAboutDeprecatedIsAsyncMode = false;
1714
+ var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
1715
+
1716
+ function isAsyncMode(object) {
1717
+ {
1718
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
1719
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
1720
+
1721
+ console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
1722
+ }
1723
+ }
1724
+
1725
+ return false;
1726
+ }
1727
+ function isConcurrentMode(object) {
1728
+ {
1729
+ if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
1730
+ hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
1731
+
1732
+ console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
1733
+ }
1734
+ }
1735
+
1736
+ return false;
1737
+ }
1738
+ function isContextConsumer(object) {
1739
+ return typeOf(object) === REACT_CONTEXT_TYPE;
1740
+ }
1741
+ function isContextProvider(object) {
1742
+ return typeOf(object) === REACT_PROVIDER_TYPE;
1743
+ }
1744
+ function isElement(object) {
1745
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1746
+ }
1747
+ function isForwardRef(object) {
1748
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
1749
+ }
1750
+ function isFragment(object) {
1751
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
1752
+ }
1753
+ function isLazy(object) {
1754
+ return typeOf(object) === REACT_LAZY_TYPE;
1755
+ }
1756
+ function isMemo(object) {
1757
+ return typeOf(object) === REACT_MEMO_TYPE;
1758
+ }
1759
+ function isPortal(object) {
1760
+ return typeOf(object) === REACT_PORTAL_TYPE;
1761
+ }
1762
+ function isProfiler(object) {
1763
+ return typeOf(object) === REACT_PROFILER_TYPE;
1764
+ }
1765
+ function isStrictMode(object) {
1766
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
1767
+ }
1768
+ function isSuspense(object) {
1769
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
1770
+ }
1771
+
1772
+ reactIs_development.ContextConsumer = ContextConsumer;
1773
+ reactIs_development.ContextProvider = ContextProvider;
1774
+ reactIs_development.Element = Element;
1775
+ reactIs_development.ForwardRef = ForwardRef;
1776
+ reactIs_development.Fragment = Fragment;
1777
+ reactIs_development.Lazy = Lazy;
1778
+ reactIs_development.Memo = Memo;
1779
+ reactIs_development.Portal = Portal;
1780
+ reactIs_development.Profiler = Profiler;
1781
+ reactIs_development.StrictMode = StrictMode;
1782
+ reactIs_development.Suspense = Suspense;
1783
+ reactIs_development.isAsyncMode = isAsyncMode;
1784
+ reactIs_development.isConcurrentMode = isConcurrentMode;
1785
+ reactIs_development.isContextConsumer = isContextConsumer;
1786
+ reactIs_development.isContextProvider = isContextProvider;
1787
+ reactIs_development.isElement = isElement;
1788
+ reactIs_development.isForwardRef = isForwardRef;
1789
+ reactIs_development.isFragment = isFragment;
1790
+ reactIs_development.isLazy = isLazy;
1791
+ reactIs_development.isMemo = isMemo;
1792
+ reactIs_development.isPortal = isPortal;
1793
+ reactIs_development.isProfiler = isProfiler;
1794
+ reactIs_development.isStrictMode = isStrictMode;
1795
+ reactIs_development.isSuspense = isSuspense;
1796
+ reactIs_development.isValidElementType = isValidElementType;
1797
+ reactIs_development.typeOf = typeOf;
1798
+ })();
1799
+ }
1800
+
1801
+ if (process.env.NODE_ENV === 'production') {
1802
+ reactIs.exports = reactIs_production_min;
1803
+ } else {
1804
+ reactIs.exports = reactIs_development;
1805
+ }
1806
+
1807
+ Object.defineProperty(ReactElement$1, '__esModule', {
1808
+ value: true
1809
+ });
1810
+ ReactElement$1.default = ReactElement$1.test = ReactElement$1.serialize = void 0;
1811
+
1812
+ var ReactIs = _interopRequireWildcard(reactIs.exports);
1813
+
1814
+ var _markup$1 = markup;
1815
+
1816
+ function _getRequireWildcardCache(nodeInterop) {
1817
+ if (typeof WeakMap !== 'function') return null;
1818
+ var cacheBabelInterop = new WeakMap();
1819
+ var cacheNodeInterop = new WeakMap();
1820
+ return (_getRequireWildcardCache = function (nodeInterop) {
1821
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
1822
+ })(nodeInterop);
1823
+ }
1824
+
1825
+ function _interopRequireWildcard(obj, nodeInterop) {
1826
+ if (!nodeInterop && obj && obj.__esModule) {
1827
+ return obj;
1828
+ }
1829
+ if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
1830
+ return {default: obj};
1831
+ }
1832
+ var cache = _getRequireWildcardCache(nodeInterop);
1833
+ if (cache && cache.has(obj)) {
1834
+ return cache.get(obj);
1835
+ }
1836
+ var newObj = {};
1837
+ var hasPropertyDescriptor =
1838
+ Object.defineProperty && Object.getOwnPropertyDescriptor;
1839
+ for (var key in obj) {
1840
+ if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
1841
+ var desc = hasPropertyDescriptor
1842
+ ? Object.getOwnPropertyDescriptor(obj, key)
1843
+ : null;
1844
+ if (desc && (desc.get || desc.set)) {
1845
+ Object.defineProperty(newObj, key, desc);
1846
+ } else {
1847
+ newObj[key] = obj[key];
1848
+ }
1849
+ }
1850
+ }
1851
+ newObj.default = obj;
1852
+ if (cache) {
1853
+ cache.set(obj, newObj);
1854
+ }
1855
+ return newObj;
1856
+ }
1857
+
1858
+ /**
1859
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1860
+ *
1861
+ * This source code is licensed under the MIT license found in the
1862
+ * LICENSE file in the root directory of this source tree.
1863
+ */
1864
+ // Given element.props.children, or subtree during recursive traversal,
1865
+ // return flattened array of children.
1866
+ const getChildren = (arg, children = []) => {
1867
+ if (Array.isArray(arg)) {
1868
+ arg.forEach(item => {
1869
+ getChildren(item, children);
1870
+ });
1871
+ } else if (arg != null && arg !== false) {
1872
+ children.push(arg);
1873
+ }
1874
+
1875
+ return children;
1876
+ };
1877
+
1878
+ const getType = element => {
1879
+ const type = element.type;
1880
+
1881
+ if (typeof type === 'string') {
1882
+ return type;
1883
+ }
1884
+
1885
+ if (typeof type === 'function') {
1886
+ return type.displayName || type.name || 'Unknown';
1887
+ }
1888
+
1889
+ if (ReactIs.isFragment(element)) {
1890
+ return 'React.Fragment';
1891
+ }
1892
+
1893
+ if (ReactIs.isSuspense(element)) {
1894
+ return 'React.Suspense';
1895
+ }
1896
+
1897
+ if (typeof type === 'object' && type !== null) {
1898
+ if (ReactIs.isContextProvider(element)) {
1899
+ return 'Context.Provider';
1900
+ }
1901
+
1902
+ if (ReactIs.isContextConsumer(element)) {
1903
+ return 'Context.Consumer';
1904
+ }
1905
+
1906
+ if (ReactIs.isForwardRef(element)) {
1907
+ if (type.displayName) {
1908
+ return type.displayName;
1909
+ }
1910
+
1911
+ const functionName = type.render.displayName || type.render.name || '';
1912
+ return functionName !== ''
1913
+ ? 'ForwardRef(' + functionName + ')'
1914
+ : 'ForwardRef';
1915
+ }
1916
+
1917
+ if (ReactIs.isMemo(element)) {
1918
+ const functionName =
1919
+ type.displayName || type.type.displayName || type.type.name || '';
1920
+ return functionName !== '' ? 'Memo(' + functionName + ')' : 'Memo';
1921
+ }
1922
+ }
1923
+
1924
+ return 'UNDEFINED';
1925
+ };
1926
+
1927
+ const getPropKeys$1 = element => {
1928
+ const {props} = element;
1929
+ return Object.keys(props)
1930
+ .filter(key => key !== 'children' && props[key] !== undefined)
1931
+ .sort();
1932
+ };
1933
+
1934
+ const serialize$2 = (element, config, indentation, depth, refs, printer) =>
1935
+ ++depth > config.maxDepth
1936
+ ? (0, _markup$1.printElementAsLeaf)(getType(element), config)
1937
+ : (0, _markup$1.printElement)(
1938
+ getType(element),
1939
+ (0, _markup$1.printProps)(
1940
+ getPropKeys$1(element),
1941
+ element.props,
1942
+ config,
1943
+ indentation + config.indent,
1944
+ depth,
1945
+ refs,
1946
+ printer
1947
+ ),
1948
+ (0, _markup$1.printChildren)(
1949
+ getChildren(element.props.children),
1950
+ config,
1951
+ indentation + config.indent,
1952
+ depth,
1953
+ refs,
1954
+ printer
1955
+ ),
1956
+ config,
1957
+ indentation
1958
+ );
1959
+
1960
+ ReactElement$1.serialize = serialize$2;
1961
+
1962
+ const test$1 = val => val != null && ReactIs.isElement(val);
1963
+
1964
+ ReactElement$1.test = test$1;
1965
+ const plugin$1 = {
1966
+ serialize: serialize$2,
1967
+ test: test$1
1968
+ };
1969
+ var _default$2 = plugin$1;
1970
+ ReactElement$1.default = _default$2;
1971
+
1972
+ var ReactTestComponent$1 = {};
1973
+
1974
+ Object.defineProperty(ReactTestComponent$1, '__esModule', {
1975
+ value: true
1976
+ });
1977
+ ReactTestComponent$1.default = ReactTestComponent$1.test = ReactTestComponent$1.serialize = void 0;
1978
+
1979
+ var _markup = markup;
1980
+
1981
+ var global = (function () {
1982
+ if (typeof globalThis !== 'undefined') {
1983
+ return globalThis;
1984
+ } else if (typeof global !== 'undefined') {
1985
+ return global;
1986
+ } else if (typeof self !== 'undefined') {
1987
+ return self;
1988
+ } else if (typeof window !== 'undefined') {
1989
+ return window;
1990
+ } else {
1991
+ return Function('return this')();
1992
+ }
1993
+ })();
1994
+
1995
+ var Symbol$1 = global['jest-symbol-do-not-touch'] || global.Symbol;
1996
+ const testSymbol =
1997
+ typeof Symbol$1 === 'function' && Symbol$1.for
1998
+ ? Symbol$1.for('react.test.json')
1999
+ : 0xea71357;
2000
+
2001
+ const getPropKeys = object => {
2002
+ const {props} = object;
2003
+ return props
2004
+ ? Object.keys(props)
2005
+ .filter(key => props[key] !== undefined)
2006
+ .sort()
2007
+ : [];
2008
+ };
2009
+
2010
+ const serialize$1 = (object, config, indentation, depth, refs, printer) =>
2011
+ ++depth > config.maxDepth
2012
+ ? (0, _markup.printElementAsLeaf)(object.type, config)
2013
+ : (0, _markup.printElement)(
2014
+ object.type,
2015
+ object.props
2016
+ ? (0, _markup.printProps)(
2017
+ getPropKeys(object),
2018
+ object.props,
2019
+ config,
2020
+ indentation + config.indent,
2021
+ depth,
2022
+ refs,
2023
+ printer
2024
+ )
2025
+ : '',
2026
+ object.children
2027
+ ? (0, _markup.printChildren)(
2028
+ object.children,
2029
+ config,
2030
+ indentation + config.indent,
2031
+ depth,
2032
+ refs,
2033
+ printer
2034
+ )
2035
+ : '',
2036
+ config,
2037
+ indentation
2038
+ );
2039
+
2040
+ ReactTestComponent$1.serialize = serialize$1;
2041
+
2042
+ const test = val => val && val.$$typeof === testSymbol;
2043
+
2044
+ ReactTestComponent$1.test = test;
2045
+ const plugin = {
2046
+ serialize: serialize$1,
2047
+ test
2048
+ };
2049
+ var _default$1 = plugin;
2050
+ ReactTestComponent$1.default = _default$1;
2051
+
2052
+ Object.defineProperty(build, '__esModule', {
2053
+ value: true
2054
+ });
2055
+ var format_1 = build.format = format;
2056
+ build.default = plugins_1 = build.plugins = build.DEFAULT_OPTIONS = void 0;
2057
+
2058
+ var _ansiStyles = _interopRequireDefault(ansiStyles.exports);
2059
+
2060
+ var _collections = collections;
2061
+
2062
+ var _AsymmetricMatcher = _interopRequireDefault(
2063
+ AsymmetricMatcher$1
2064
+ );
2065
+
2066
+ var _ConvertAnsi = _interopRequireDefault(ConvertAnsi);
2067
+
2068
+ var _DOMCollection = _interopRequireDefault(DOMCollection$1);
2069
+
2070
+ var _DOMElement = _interopRequireDefault(DOMElement$1);
2071
+
2072
+ var _Immutable = _interopRequireDefault(Immutable$1);
2073
+
2074
+ var _ReactElement = _interopRequireDefault(ReactElement$1);
2075
+
2076
+ var _ReactTestComponent = _interopRequireDefault(
2077
+ ReactTestComponent$1
2078
+ );
2079
+
2080
+ function _interopRequireDefault(obj) {
2081
+ return obj && obj.__esModule ? obj : {default: obj};
2082
+ }
2083
+
2084
+ /**
2085
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2086
+ *
2087
+ * This source code is licensed under the MIT license found in the
2088
+ * LICENSE file in the root directory of this source tree.
2089
+ */
2090
+
2091
+ /* eslint-disable local/ban-types-eventually */
2092
+ const toString = Object.prototype.toString;
2093
+ const toISOString = Date.prototype.toISOString;
2094
+ const errorToString = Error.prototype.toString;
2095
+ const regExpToString = RegExp.prototype.toString;
2096
+ /**
2097
+ * Explicitly comparing typeof constructor to function avoids undefined as name
2098
+ * when mock identity-obj-proxy returns the key as the value for any key.
2099
+ */
2100
+
2101
+ const getConstructorName = val =>
2102
+ (typeof val.constructor === 'function' && val.constructor.name) || 'Object';
2103
+ /* global window */
2104
+
2105
+ /** Is val is equal to global window object? Works even if it does not exist :) */
2106
+
2107
+ const isWindow = val => typeof window !== 'undefined' && val === window;
2108
+
2109
+ const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
2110
+ const NEWLINE_REGEXP = /\n/gi;
2111
+
2112
+ class PrettyFormatPluginError extends Error {
2113
+ constructor(message, stack) {
2114
+ super(message);
2115
+ this.stack = stack;
2116
+ this.name = this.constructor.name;
2117
+ }
2118
+ }
2119
+
2120
+ function isToStringedArrayType(toStringed) {
2121
+ return (
2122
+ toStringed === '[object Array]' ||
2123
+ toStringed === '[object ArrayBuffer]' ||
2124
+ toStringed === '[object DataView]' ||
2125
+ toStringed === '[object Float32Array]' ||
2126
+ toStringed === '[object Float64Array]' ||
2127
+ toStringed === '[object Int8Array]' ||
2128
+ toStringed === '[object Int16Array]' ||
2129
+ toStringed === '[object Int32Array]' ||
2130
+ toStringed === '[object Uint8Array]' ||
2131
+ toStringed === '[object Uint8ClampedArray]' ||
2132
+ toStringed === '[object Uint16Array]' ||
2133
+ toStringed === '[object Uint32Array]'
2134
+ );
2135
+ }
2136
+
2137
+ function printNumber(val) {
2138
+ return Object.is(val, -0) ? '-0' : String(val);
2139
+ }
2140
+
2141
+ function printBigInt(val) {
2142
+ return String(`${val}n`);
2143
+ }
2144
+
2145
+ function printFunction(val, printFunctionName) {
2146
+ if (!printFunctionName) {
2147
+ return '[Function]';
2148
+ }
2149
+
2150
+ return '[Function ' + (val.name || 'anonymous') + ']';
2151
+ }
2152
+
2153
+ function printSymbol(val) {
2154
+ return String(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
2155
+ }
2156
+
2157
+ function printError(val) {
2158
+ return '[' + errorToString.call(val) + ']';
2159
+ }
2160
+ /**
2161
+ * The first port of call for printing an object, handles most of the
2162
+ * data-types in JS.
2163
+ */
2164
+
2165
+ function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
2166
+ if (val === true || val === false) {
2167
+ return '' + val;
2168
+ }
2169
+
2170
+ if (val === undefined) {
2171
+ return 'undefined';
2172
+ }
2173
+
2174
+ if (val === null) {
2175
+ return 'null';
2176
+ }
2177
+
2178
+ const typeOf = typeof val;
2179
+
2180
+ if (typeOf === 'number') {
2181
+ return printNumber(val);
2182
+ }
2183
+
2184
+ if (typeOf === 'bigint') {
2185
+ return printBigInt(val);
2186
+ }
2187
+
2188
+ if (typeOf === 'string') {
2189
+ if (escapeString) {
2190
+ return '"' + val.replace(/"|\\/g, '\\$&') + '"';
2191
+ }
2192
+
2193
+ return '"' + val + '"';
2194
+ }
2195
+
2196
+ if (typeOf === 'function') {
2197
+ return printFunction(val, printFunctionName);
2198
+ }
2199
+
2200
+ if (typeOf === 'symbol') {
2201
+ return printSymbol(val);
2202
+ }
2203
+
2204
+ const toStringed = toString.call(val);
2205
+
2206
+ if (toStringed === '[object WeakMap]') {
2207
+ return 'WeakMap {}';
2208
+ }
2209
+
2210
+ if (toStringed === '[object WeakSet]') {
2211
+ return 'WeakSet {}';
2212
+ }
2213
+
2214
+ if (
2215
+ toStringed === '[object Function]' ||
2216
+ toStringed === '[object GeneratorFunction]'
2217
+ ) {
2218
+ return printFunction(val, printFunctionName);
2219
+ }
2220
+
2221
+ if (toStringed === '[object Symbol]') {
2222
+ return printSymbol(val);
2223
+ }
2224
+
2225
+ if (toStringed === '[object Date]') {
2226
+ return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
2227
+ }
2228
+
2229
+ if (toStringed === '[object Error]') {
2230
+ return printError(val);
2231
+ }
2232
+
2233
+ if (toStringed === '[object RegExp]') {
2234
+ if (escapeRegex) {
2235
+ // https://github.com/benjamingr/RegExp.escape/blob/main/polyfill.js
2236
+ return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
2237
+ }
2238
+
2239
+ return regExpToString.call(val);
2240
+ }
2241
+
2242
+ if (val instanceof Error) {
2243
+ return printError(val);
2244
+ }
2245
+
2246
+ return null;
2247
+ }
2248
+ /**
2249
+ * Handles more complex objects ( such as objects with circular references.
2250
+ * maps and sets etc )
2251
+ */
2252
+
2253
+ function printComplexValue(
2254
+ val,
2255
+ config,
2256
+ indentation,
2257
+ depth,
2258
+ refs,
2259
+ hasCalledToJSON
2260
+ ) {
2261
+ if (refs.indexOf(val) !== -1) {
2262
+ return '[Circular]';
2263
+ }
2264
+
2265
+ refs = refs.slice();
2266
+ refs.push(val);
2267
+ const hitMaxDepth = ++depth > config.maxDepth;
2268
+ const min = config.min;
2269
+
2270
+ if (
2271
+ config.callToJSON &&
2272
+ !hitMaxDepth &&
2273
+ val.toJSON &&
2274
+ typeof val.toJSON === 'function' &&
2275
+ !hasCalledToJSON
2276
+ ) {
2277
+ return printer(val.toJSON(), config, indentation, depth, refs, true);
2278
+ }
2279
+
2280
+ const toStringed = toString.call(val);
2281
+
2282
+ if (toStringed === '[object Arguments]') {
2283
+ return hitMaxDepth
2284
+ ? '[Arguments]'
2285
+ : (min ? '' : 'Arguments ') +
2286
+ '[' +
2287
+ (0, _collections.printListItems)(
2288
+ val,
2289
+ config,
2290
+ indentation,
2291
+ depth,
2292
+ refs,
2293
+ printer
2294
+ ) +
2295
+ ']';
2296
+ }
2297
+
2298
+ if (isToStringedArrayType(toStringed)) {
2299
+ return hitMaxDepth
2300
+ ? '[' + val.constructor.name + ']'
2301
+ : (min
2302
+ ? ''
2303
+ : !config.printBasicPrototype && val.constructor.name === 'Array'
2304
+ ? ''
2305
+ : val.constructor.name + ' ') +
2306
+ '[' +
2307
+ (0, _collections.printListItems)(
2308
+ val,
2309
+ config,
2310
+ indentation,
2311
+ depth,
2312
+ refs,
2313
+ printer
2314
+ ) +
2315
+ ']';
2316
+ }
2317
+
2318
+ if (toStringed === '[object Map]') {
2319
+ return hitMaxDepth
2320
+ ? '[Map]'
2321
+ : 'Map {' +
2322
+ (0, _collections.printIteratorEntries)(
2323
+ val.entries(),
2324
+ config,
2325
+ indentation,
2326
+ depth,
2327
+ refs,
2328
+ printer,
2329
+ ' => '
2330
+ ) +
2331
+ '}';
2332
+ }
2333
+
2334
+ if (toStringed === '[object Set]') {
2335
+ return hitMaxDepth
2336
+ ? '[Set]'
2337
+ : 'Set {' +
2338
+ (0, _collections.printIteratorValues)(
2339
+ val.values(),
2340
+ config,
2341
+ indentation,
2342
+ depth,
2343
+ refs,
2344
+ printer
2345
+ ) +
2346
+ '}';
2347
+ } // Avoid failure to serialize global window object in jsdom test environment.
2348
+ // For example, not even relevant if window is prop of React element.
2349
+
2350
+ return hitMaxDepth || isWindow(val)
2351
+ ? '[' + getConstructorName(val) + ']'
2352
+ : (min
2353
+ ? ''
2354
+ : !config.printBasicPrototype && getConstructorName(val) === 'Object'
2355
+ ? ''
2356
+ : getConstructorName(val) + ' ') +
2357
+ '{' +
2358
+ (0, _collections.printObjectProperties)(
2359
+ val,
2360
+ config,
2361
+ indentation,
2362
+ depth,
2363
+ refs,
2364
+ printer
2365
+ ) +
2366
+ '}';
2367
+ }
2368
+
2369
+ function isNewPlugin(plugin) {
2370
+ return plugin.serialize != null;
2371
+ }
2372
+
2373
+ function printPlugin(plugin, val, config, indentation, depth, refs) {
2374
+ let printed;
2375
+
2376
+ try {
2377
+ printed = isNewPlugin(plugin)
2378
+ ? plugin.serialize(val, config, indentation, depth, refs, printer)
2379
+ : plugin.print(
2380
+ val,
2381
+ valChild => printer(valChild, config, indentation, depth, refs),
2382
+ str => {
2383
+ const indentationNext = indentation + config.indent;
2384
+ return (
2385
+ indentationNext +
2386
+ str.replace(NEWLINE_REGEXP, '\n' + indentationNext)
2387
+ );
2388
+ },
2389
+ {
2390
+ edgeSpacing: config.spacingOuter,
2391
+ min: config.min,
2392
+ spacing: config.spacingInner
2393
+ },
2394
+ config.colors
2395
+ );
2396
+ } catch (error) {
2397
+ throw new PrettyFormatPluginError(error.message, error.stack);
2398
+ }
2399
+
2400
+ if (typeof printed !== 'string') {
2401
+ throw new Error(
2402
+ `pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`
2403
+ );
2404
+ }
2405
+
2406
+ return printed;
2407
+ }
2408
+
2409
+ function findPlugin(plugins, val) {
2410
+ for (let p = 0; p < plugins.length; p++) {
2411
+ try {
2412
+ if (plugins[p].test(val)) {
2413
+ return plugins[p];
2414
+ }
2415
+ } catch (error) {
2416
+ throw new PrettyFormatPluginError(error.message, error.stack);
2417
+ }
2418
+ }
2419
+
2420
+ return null;
2421
+ }
2422
+
2423
+ function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
2424
+ const plugin = findPlugin(config.plugins, val);
2425
+
2426
+ if (plugin !== null) {
2427
+ return printPlugin(plugin, val, config, indentation, depth, refs);
2428
+ }
2429
+
2430
+ const basicResult = printBasicValue(
2431
+ val,
2432
+ config.printFunctionName,
2433
+ config.escapeRegex,
2434
+ config.escapeString
2435
+ );
2436
+
2437
+ if (basicResult !== null) {
2438
+ return basicResult;
2439
+ }
2440
+
2441
+ return printComplexValue(
2442
+ val,
2443
+ config,
2444
+ indentation,
2445
+ depth,
2446
+ refs,
2447
+ hasCalledToJSON
2448
+ );
2449
+ }
2450
+
2451
+ const DEFAULT_THEME = {
2452
+ comment: 'gray',
2453
+ content: 'reset',
2454
+ prop: 'yellow',
2455
+ tag: 'cyan',
2456
+ value: 'green'
2457
+ };
2458
+ const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
2459
+ const DEFAULT_OPTIONS = {
2460
+ callToJSON: true,
2461
+ compareKeys: undefined,
2462
+ escapeRegex: false,
2463
+ escapeString: true,
2464
+ highlight: false,
2465
+ indent: 2,
2466
+ maxDepth: Infinity,
2467
+ min: false,
2468
+ plugins: [],
2469
+ printBasicPrototype: true,
2470
+ printFunctionName: true,
2471
+ theme: DEFAULT_THEME
2472
+ };
2473
+ build.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
2474
+
2475
+ function validateOptions(options) {
2476
+ Object.keys(options).forEach(key => {
2477
+ if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
2478
+ throw new Error(`pretty-format: Unknown option "${key}".`);
2479
+ }
2480
+ });
2481
+
2482
+ if (options.min && options.indent !== undefined && options.indent !== 0) {
2483
+ throw new Error(
2484
+ 'pretty-format: Options "min" and "indent" cannot be used together.'
2485
+ );
2486
+ }
2487
+
2488
+ if (options.theme !== undefined) {
2489
+ if (options.theme === null) {
2490
+ throw new Error(`pretty-format: Option "theme" must not be null.`);
2491
+ }
2492
+
2493
+ if (typeof options.theme !== 'object') {
2494
+ throw new Error(
2495
+ `pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`
2496
+ );
2497
+ }
2498
+ }
2499
+ }
2500
+
2501
+ const getColorsHighlight = options =>
2502
+ DEFAULT_THEME_KEYS.reduce((colors, key) => {
2503
+ const value =
2504
+ options.theme && options.theme[key] !== undefined
2505
+ ? options.theme[key]
2506
+ : DEFAULT_THEME[key];
2507
+ const color = value && _ansiStyles.default[value];
2508
+
2509
+ if (
2510
+ color &&
2511
+ typeof color.close === 'string' &&
2512
+ typeof color.open === 'string'
2513
+ ) {
2514
+ colors[key] = color;
2515
+ } else {
2516
+ throw new Error(
2517
+ `pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`
2518
+ );
2519
+ }
2520
+
2521
+ return colors;
2522
+ }, Object.create(null));
2523
+
2524
+ const getColorsEmpty = () =>
2525
+ DEFAULT_THEME_KEYS.reduce((colors, key) => {
2526
+ colors[key] = {
2527
+ close: '',
2528
+ open: ''
2529
+ };
2530
+ return colors;
2531
+ }, Object.create(null));
2532
+
2533
+ const getPrintFunctionName = options =>
2534
+ options && options.printFunctionName !== undefined
2535
+ ? options.printFunctionName
2536
+ : DEFAULT_OPTIONS.printFunctionName;
2537
+
2538
+ const getEscapeRegex = options =>
2539
+ options && options.escapeRegex !== undefined
2540
+ ? options.escapeRegex
2541
+ : DEFAULT_OPTIONS.escapeRegex;
2542
+
2543
+ const getEscapeString = options =>
2544
+ options && options.escapeString !== undefined
2545
+ ? options.escapeString
2546
+ : DEFAULT_OPTIONS.escapeString;
2547
+
2548
+ const getConfig = options => {
2549
+ var _options$printBasicPr;
2550
+
2551
+ return {
2552
+ callToJSON:
2553
+ options && options.callToJSON !== undefined
2554
+ ? options.callToJSON
2555
+ : DEFAULT_OPTIONS.callToJSON,
2556
+ colors:
2557
+ options && options.highlight
2558
+ ? getColorsHighlight(options)
2559
+ : getColorsEmpty(),
2560
+ compareKeys:
2561
+ options && typeof options.compareKeys === 'function'
2562
+ ? options.compareKeys
2563
+ : DEFAULT_OPTIONS.compareKeys,
2564
+ escapeRegex: getEscapeRegex(options),
2565
+ escapeString: getEscapeString(options),
2566
+ indent:
2567
+ options && options.min
2568
+ ? ''
2569
+ : createIndent(
2570
+ options && options.indent !== undefined
2571
+ ? options.indent
2572
+ : DEFAULT_OPTIONS.indent
2573
+ ),
2574
+ maxDepth:
2575
+ options && options.maxDepth !== undefined
2576
+ ? options.maxDepth
2577
+ : DEFAULT_OPTIONS.maxDepth,
2578
+ min:
2579
+ options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
2580
+ plugins:
2581
+ options && options.plugins !== undefined
2582
+ ? options.plugins
2583
+ : DEFAULT_OPTIONS.plugins,
2584
+ printBasicPrototype:
2585
+ (_options$printBasicPr =
2586
+ options === null || options === void 0
2587
+ ? void 0
2588
+ : options.printBasicPrototype) !== null &&
2589
+ _options$printBasicPr !== void 0
2590
+ ? _options$printBasicPr
2591
+ : true,
2592
+ printFunctionName: getPrintFunctionName(options),
2593
+ spacingInner: options && options.min ? ' ' : '\n',
2594
+ spacingOuter: options && options.min ? '' : '\n'
2595
+ };
2596
+ };
2597
+
2598
+ function createIndent(indent) {
2599
+ return new Array(indent + 1).join(' ');
2600
+ }
2601
+ /**
2602
+ * Returns a presentation string of your `val` object
2603
+ * @param val any potential JavaScript object
2604
+ * @param options Custom settings
2605
+ */
2606
+
2607
+ function format(val, options) {
2608
+ if (options) {
2609
+ validateOptions(options);
2610
+
2611
+ if (options.plugins) {
2612
+ const plugin = findPlugin(options.plugins, val);
2613
+
2614
+ if (plugin !== null) {
2615
+ return printPlugin(plugin, val, getConfig(options), '', 0, []);
2616
+ }
2617
+ }
2618
+ }
2619
+
2620
+ const basicResult = printBasicValue(
2621
+ val,
2622
+ getPrintFunctionName(options),
2623
+ getEscapeRegex(options),
2624
+ getEscapeString(options)
2625
+ );
2626
+
2627
+ if (basicResult !== null) {
2628
+ return basicResult;
2629
+ }
2630
+
2631
+ return printComplexValue(val, getConfig(options), '', 0, []);
2632
+ }
2633
+
2634
+ const plugins = {
2635
+ AsymmetricMatcher: _AsymmetricMatcher.default,
2636
+ ConvertAnsi: _ConvertAnsi.default,
2637
+ DOMCollection: _DOMCollection.default,
2638
+ DOMElement: _DOMElement.default,
2639
+ Immutable: _Immutable.default,
2640
+ ReactElement: _ReactElement.default,
2641
+ ReactTestComponent: _ReactTestComponent.default
2642
+ };
2643
+ var plugins_1 = build.plugins = plugins;
2644
+ var _default = format;
2645
+ build.default = _default;
2646
+
2647
+ const {
2648
+ DOMCollection,
2649
+ DOMElement,
2650
+ Immutable,
2651
+ ReactElement,
2652
+ ReactTestComponent,
2653
+ AsymmetricMatcher
2654
+ } = plugins_1;
2655
+ let PLUGINS = [
2656
+ ReactTestComponent,
2657
+ ReactElement,
2658
+ DOMElement,
2659
+ DOMCollection,
2660
+ Immutable,
2661
+ AsymmetricMatcher
2662
+ ];
2663
+ const getSerializers = () => PLUGINS;
2664
+
2665
+ var __defProp = Object.defineProperty;
2666
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2667
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
2668
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
2669
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2670
+ var __spreadValues = (a, b) => {
2671
+ for (var prop in b || (b = {}))
2672
+ if (__hasOwnProp.call(b, prop))
2673
+ __defNormalProp(a, prop, b[prop]);
2674
+ if (__getOwnPropSymbols)
2675
+ for (var prop of __getOwnPropSymbols(b)) {
2676
+ if (__propIsEnum.call(b, prop))
2677
+ __defNormalProp(a, prop, b[prop]);
2678
+ }
2679
+ return a;
2680
+ };
2681
+ const SNAPSHOT_VERSION = "1";
2682
+ const writeSnapshotVersion = () => `// Vitest Snapshot v${SNAPSHOT_VERSION}`;
2683
+ const testNameToKey = (testName, count) => `${testName} ${count}`;
2684
+ const keyToTestName = (key) => {
2685
+ if (!/ \d+$/.test(key))
2686
+ throw new Error("Snapshot keys must end with a number.");
2687
+ return key.replace(/ \d+$/, "");
2688
+ };
2689
+ const getSnapshotData = (snapshotPath, update) => {
2690
+ const data = Object.create(null);
2691
+ let snapshotContents = "";
2692
+ let dirty = false;
2693
+ if (fs.existsSync(snapshotPath)) {
2694
+ try {
2695
+ snapshotContents = fs.readFileSync(snapshotPath, "utf8");
2696
+ const populate = new Function("exports", snapshotContents);
2697
+ populate(data);
2698
+ } catch {
2699
+ }
2700
+ }
2701
+ const isInvalid = snapshotContents;
2702
+ if ((update === "all" || update === "new") && isInvalid)
2703
+ dirty = true;
2704
+ return { data, dirty };
2705
+ };
2706
+ const addExtraLineBreaks = (string) => string.includes("\n") ? `
2707
+ ${string}
2708
+ ` : string;
2709
+ const removeExtraLineBreaks = (string) => string.length > 2 && string.startsWith("\n") && string.endsWith("\n") ? string.slice(1, -1) : string;
2710
+ const escapeRegex = true;
2711
+ const printFunctionName = false;
2712
+ function serialize(val, indent = 2, formatOverrides = {}) {
2713
+ return normalizeNewlines(format_1(val, __spreadValues({
2714
+ escapeRegex,
2715
+ indent,
2716
+ plugins: getSerializers(),
2717
+ printFunctionName
2718
+ }, formatOverrides)));
2719
+ }
2720
+ function escapeBacktickString(str) {
2721
+ return str.replace(/`|\\|\${/g, "\\$&");
2722
+ }
2723
+ function printBacktickString(str) {
2724
+ return `\`${escapeBacktickString(str)}\``;
2725
+ }
2726
+ function ensureDirectoryExists(filePath) {
2727
+ try {
2728
+ fs.mkdirSync(path.join(path.dirname(filePath)), { recursive: true });
2729
+ } catch {
2730
+ }
2731
+ }
2732
+ function normalizeNewlines(string) {
2733
+ return string.replace(/\r\n|\r/g, "\n");
2734
+ }
2735
+ function saveSnapshotFile(snapshotData, snapshotPath) {
2736
+ const snapshots = Object.keys(snapshotData).sort(naturalCompare$1).map((key) => `exports[${printBacktickString(key)}] = ${printBacktickString(normalizeNewlines(snapshotData[key]))};`);
2737
+ ensureDirectoryExists(snapshotPath);
2738
+ fs.writeFileSync(snapshotPath, `${writeSnapshotVersion()}
2739
+
2740
+ ${snapshots.join("\n\n")}
2741
+ `);
2742
+ }
2743
+
2744
+ class SnapshotState {
2745
+ constructor(snapshotPath, options) {
2746
+ this._snapshotPath = snapshotPath;
2747
+ const { data, dirty } = getSnapshotData(this._snapshotPath, options.updateSnapshot);
2748
+ this._initialData = data;
2749
+ this._snapshotData = data;
2750
+ this._dirty = dirty;
2751
+ this._uncheckedKeys = new Set(Object.keys(this._snapshotData));
2752
+ this._counters = new Map();
2753
+ this._index = 0;
2754
+ this.expand = options.expand || false;
2755
+ this.added = 0;
2756
+ this.matched = 0;
2757
+ this.unmatched = 0;
2758
+ this._updateSnapshot = options.updateSnapshot;
2759
+ this.updated = 0;
2760
+ this._snapshotFormat = options.snapshotFormat || {};
2761
+ }
2762
+ markSnapshotsAsCheckedForTest(testName) {
2763
+ this._uncheckedKeys.forEach((uncheckedKey) => {
2764
+ if (keyToTestName(uncheckedKey) === testName)
2765
+ this._uncheckedKeys.delete(uncheckedKey);
2766
+ });
2767
+ }
2768
+ _addSnapshot(key, receivedSerialized, options) {
2769
+ this._dirty = true;
2770
+ this._snapshotData[key] = receivedSerialized;
2771
+ }
2772
+ clear() {
2773
+ this._snapshotData = this._initialData;
2774
+ this._counters = new Map();
2775
+ this._index = 0;
2776
+ this.added = 0;
2777
+ this.matched = 0;
2778
+ this.unmatched = 0;
2779
+ this.updated = 0;
2780
+ }
2781
+ save() {
2782
+ const hasExternalSnapshots = Object.keys(this._snapshotData).length;
2783
+ const isEmpty = !hasExternalSnapshots;
2784
+ const status = {
2785
+ deleted: false,
2786
+ saved: false
2787
+ };
2788
+ if ((this._dirty || this._uncheckedKeys.size) && !isEmpty) {
2789
+ if (hasExternalSnapshots)
2790
+ saveSnapshotFile(this._snapshotData, this._snapshotPath);
2791
+ status.saved = true;
2792
+ } else if (!hasExternalSnapshots && fs.existsSync(this._snapshotPath)) {
2793
+ if (this._updateSnapshot === "all")
2794
+ fs.unlinkSync(this._snapshotPath);
2795
+ status.deleted = true;
2796
+ }
2797
+ return status;
2798
+ }
2799
+ getUncheckedCount() {
2800
+ return this._uncheckedKeys.size || 0;
2801
+ }
2802
+ getUncheckedKeys() {
2803
+ return Array.from(this._uncheckedKeys);
2804
+ }
2805
+ removeUncheckedKeys() {
2806
+ if (this._updateSnapshot === "all" && this._uncheckedKeys.size) {
2807
+ this._dirty = true;
2808
+ this._uncheckedKeys.forEach((key) => delete this._snapshotData[key]);
2809
+ this._uncheckedKeys.clear();
2810
+ }
2811
+ }
2812
+ match({
2813
+ testName,
2814
+ received,
2815
+ key,
2816
+ inlineSnapshot,
2817
+ isInline,
2818
+ error
2819
+ }) {
2820
+ this._counters.set(testName, (this._counters.get(testName) || 0) + 1);
2821
+ const count = Number(this._counters.get(testName));
2822
+ if (!key)
2823
+ key = testNameToKey(testName, count);
2824
+ if (!(isInline && this._snapshotData[key] !== void 0))
2825
+ this._uncheckedKeys.delete(key);
2826
+ const receivedSerialized = addExtraLineBreaks(serialize(received, void 0, this._snapshotFormat));
2827
+ const expected = isInline ? inlineSnapshot : this._snapshotData[key];
2828
+ const pass = expected === receivedSerialized;
2829
+ const hasSnapshot = expected !== void 0;
2830
+ const snapshotIsPersisted = isInline || fs.existsSync(this._snapshotPath);
2831
+ if (pass && !isInline) {
2832
+ this._snapshotData[key] = receivedSerialized;
2833
+ }
2834
+ if (hasSnapshot && this._updateSnapshot === "all" || (!hasSnapshot || !snapshotIsPersisted) && (this._updateSnapshot === "new" || this._updateSnapshot === "all")) {
2835
+ if (this._updateSnapshot === "all") {
2836
+ if (!pass) {
2837
+ if (hasSnapshot)
2838
+ this.updated++;
2839
+ else
2840
+ this.added++;
2841
+ this._addSnapshot(key, receivedSerialized, { error, isInline });
2842
+ } else {
2843
+ this.matched++;
2844
+ }
2845
+ } else {
2846
+ this._addSnapshot(key, receivedSerialized, { error, isInline });
2847
+ this.added++;
2848
+ }
2849
+ return {
2850
+ actual: "",
2851
+ count,
2852
+ expected: "",
2853
+ key,
2854
+ pass: true
2855
+ };
2856
+ } else {
2857
+ if (!pass) {
2858
+ this.unmatched++;
2859
+ return {
2860
+ actual: removeExtraLineBreaks(receivedSerialized),
2861
+ count,
2862
+ expected: expected !== void 0 ? removeExtraLineBreaks(expected) : void 0,
2863
+ key,
2864
+ pass: false
2865
+ };
2866
+ } else {
2867
+ this.matched++;
2868
+ return {
2869
+ actual: "",
2870
+ count,
2871
+ expected: "",
2872
+ key,
2873
+ pass: true
2874
+ };
2875
+ }
2876
+ }
2877
+ }
2878
+ fail(testName, _received, key) {
2879
+ this._counters.set(testName, (this._counters.get(testName) || 0) + 1);
2880
+ const count = Number(this._counters.get(testName));
2881
+ if (!key)
2882
+ key = testNameToKey(testName, count);
2883
+ this._uncheckedKeys.delete(key);
2884
+ this.unmatched++;
2885
+ return key;
2886
+ }
2887
+ }
2888
+
2889
+ const resolveSnapshotPath = (testPath) => path.join(path.join(path.dirname(testPath), "__snapshots__"), `${path.basename(testPath)}.snap`);
2890
+ class SnapshotClient {
2891
+ constructor() {
2892
+ this.testFile = "";
2893
+ }
2894
+ setTest(test) {
2895
+ this.test = test;
2896
+ if (this.testFile !== this.test.file.filepath) {
2897
+ if (this.snapshotState)
2898
+ this.saveSnap();
2899
+ this.testFile = this.test.file.filepath;
2900
+ this.snapshotState = new SnapshotState(resolveSnapshotPath(this.testFile), process.__vitest_worker__.config.snapshotOptions);
2901
+ }
2902
+ }
2903
+ clearTest() {
2904
+ this.test = void 0;
2905
+ }
2906
+ assert(received, message) {
2907
+ if (!this.test)
2908
+ throw new Error("Snapshot can't not be used outside of test");
2909
+ const { actual, expected, key, pass } = this.snapshotState.match({
2910
+ testName: getNames(this.test).slice(1).join(" > "),
2911
+ received,
2912
+ isInline: false
2913
+ });
2914
+ if (!pass) {
2915
+ expect(actual.trim()).equals(expected ? expected.trim() : "", message || `Snapshot name: \`${key}\``);
2916
+ }
2917
+ }
2918
+ async saveSnap() {
2919
+ if (!this.testFile || !this.snapshotState)
2920
+ return;
2921
+ const result = packSnapshotState(this.testFile, this.snapshotState);
2922
+ await rpc("snapshotSaved", result);
2923
+ this.testFile = "";
2924
+ this.snapshotState = void 0;
2925
+ }
2926
+ }
2927
+ function packSnapshotState(filepath, state) {
2928
+ const snapshot = {
2929
+ filepath,
2930
+ added: 0,
2931
+ fileDeleted: false,
2932
+ matched: 0,
2933
+ unchecked: 0,
2934
+ uncheckedKeys: [],
2935
+ unmatched: 0,
2936
+ updated: 0
2937
+ };
2938
+ const uncheckedCount = state.getUncheckedCount();
2939
+ const uncheckedKeys = state.getUncheckedKeys();
2940
+ if (uncheckedCount)
2941
+ state.removeUncheckedKeys();
2942
+ const status = state.save();
2943
+ snapshot.fileDeleted = status.deleted;
2944
+ snapshot.added = state.added;
2945
+ snapshot.matched = state.matched;
2946
+ snapshot.unmatched = state.unmatched;
2947
+ snapshot.updated = state.updated;
2948
+ snapshot.unchecked = !status.deleted ? uncheckedCount : 0;
2949
+ snapshot.uncheckedKeys = Array.from(uncheckedKeys);
2950
+ return snapshot;
2951
+ }
2952
+
2953
+ let _client;
2954
+ function getSnapshotClient() {
2955
+ if (!_client)
2956
+ _client = new SnapshotClient();
2957
+ return _client;
2958
+ }
2959
+ function SnapshotPlugin() {
2960
+ return function(chai, utils) {
2961
+ for (const key of ["matchSnapshot", "toMatchSnapshot"]) {
2962
+ utils.addMethod(chai.Assertion.prototype, key, function(message) {
2963
+ const expected = utils.flag(this, "object");
2964
+ getSnapshotClient().assert(expected, message);
2965
+ });
2966
+ }
2967
+ };
2968
+ }
2969
+
2970
+ function JestChaiExpect() {
2971
+ return (chai, utils) => {
2972
+ function def(name, fn) {
2973
+ const addMethod = (n) => {
2974
+ utils.addMethod(chai.Assertion.prototype, n, fn);
2975
+ };
2976
+ if (Array.isArray(name))
2977
+ name.forEach((n) => addMethod(n));
2978
+ else
2979
+ addMethod(name);
2980
+ }
2981
+ def("toEqual", function(expected) {
2982
+ return this.eql(expected);
2983
+ });
2984
+ def("toStrictEqual", function(expected) {
2985
+ return this.equal(expected);
2986
+ });
2987
+ def("toBe", function(expected) {
2988
+ return this.equal(expected);
2989
+ });
2990
+ def("toMatchObject", function(expected) {
2991
+ return this.containSubset(expected);
2992
+ });
2993
+ def("toMatch", function(expected) {
2994
+ if (typeof expected === "string")
2995
+ return this.include(expected);
2996
+ else
2997
+ return this.match(expected);
2998
+ });
2999
+ def("toContain", function(item) {
3000
+ return this.contain(item);
3001
+ });
3002
+ def("toContainEqual", function(expected) {
3003
+ const obj = utils.flag(this, "object");
3004
+ const index = Array.from(obj).findIndex((item) => {
3005
+ try {
3006
+ chai.assert.deepEqual(item, expected);
3007
+ } catch {
3008
+ return false;
3009
+ }
3010
+ return true;
3011
+ });
3012
+ this.assert(index !== -1, "expected #{this} to deep equally contain #{exp}", "expected #{this} to not deep equally contain #{exp}", expected);
3013
+ });
3014
+ def("toBeTruthy", function() {
3015
+ const obj = utils.flag(this, "object");
3016
+ this.assert(Boolean(obj), "expected #{this} to be truthy", "expected #{this} to not be truthy", obj);
3017
+ });
3018
+ def("toBeFalsy", function() {
3019
+ const obj = utils.flag(this, "object");
3020
+ this.assert(!obj, "expected #{this} to be falsy", "expected #{this} to not be falsy", obj);
3021
+ });
3022
+ def("toBeGreaterThan", function(expected) {
3023
+ return this.to.greaterThan(expected);
3024
+ });
3025
+ def("toBeGreaterThanOrEqual", function(expected) {
3026
+ return this.to.greaterThanOrEqual(expected);
3027
+ });
3028
+ def("toBeLessThan", function(expected) {
3029
+ return this.to.lessThan(expected);
3030
+ });
3031
+ def("toBeLessThanOrEqual", function(expected) {
3032
+ return this.to.lessThanOrEqual(expected);
3033
+ });
3034
+ def("toBeNaN", function() {
3035
+ return this.be.NaN;
3036
+ });
3037
+ def("toBeUndefined", function() {
3038
+ return this.be.undefined;
3039
+ });
3040
+ def("toBeNull", function() {
3041
+ return this.be.null;
3042
+ });
3043
+ def("toBeDefined", function() {
3044
+ return this.not.be.undefined;
3045
+ });
3046
+ def("toBeInstanceOf", function(obj) {
3047
+ return this.instanceOf(obj);
3048
+ });
3049
+ def("toHaveLength", function(length) {
3050
+ return this.have.length(length);
3051
+ });
3052
+ def("toBeCloseTo", function(number, numDigits = 2) {
3053
+ utils.expectTypes(this, ["number"]);
3054
+ return this.closeTo(number, numDigits);
3055
+ });
3056
+ function isSpy(putativeSpy) {
3057
+ return typeof putativeSpy === "function" && typeof putativeSpy.getCall === "function" && typeof putativeSpy.calledWithExactly === "function";
3058
+ }
3059
+ function isCall(putativeCall) {
3060
+ return putativeCall && isSpy(putativeCall.proxy);
3061
+ }
3062
+ const assertIsMock = (assertion) => {
3063
+ if (!isSpy(assertion._obj) && !isCall(assertion._obj))
3064
+ throw new TypeError(`${utils.inspect(assertion._obj)} is not a spy or a call to a spy!`);
3065
+ };
3066
+ def(["toHaveBeenCalledTimes", "toBeCalledTimes"], function(number) {
3067
+ assertIsMock(this);
3068
+ return this.callCount(number);
3069
+ });
3070
+ def("toHaveBeenCalledOnce", function() {
3071
+ assertIsMock(this);
3072
+ return this.callCount(1);
3073
+ });
3074
+ def(["toHaveBeenCalled", "toBeCalled"], function() {
3075
+ assertIsMock(this);
3076
+ return this.called;
3077
+ });
3078
+ def(["toHaveBeenCalledWith", "toBeCalledWith"], function(...args) {
3079
+ assertIsMock(this);
3080
+ return this.calledWith(...args);
3081
+ });
3082
+ const ordinalOf = (i) => {
3083
+ const j = i % 10;
3084
+ const k = i % 100;
3085
+ if (j === 1 && k !== 11)
3086
+ return `${i}st`;
3087
+ if (j === 2 && k !== 12)
3088
+ return `${i}nd`;
3089
+ if (j === 3 && k !== 13)
3090
+ return `${i}rd`;
3091
+ return `${i}th`;
3092
+ };
3093
+ def(["toHaveBeenNthCalledWith", "nthCalledWith"], function(times, ...args) {
3094
+ assertIsMock(this);
3095
+ const spy = utils.flag(this, "object");
3096
+ const nthCall = spy.getCall(times - 1);
3097
+ this.assert(nthCall.calledWith(...args), `expected ${ordinalOf(times)} spy call to have been called with #{exp}`, `expected ${ordinalOf(times)} spy call not to have been called with #{exp}`, args, nthCall.args);
3098
+ });
3099
+ def(["toHaveBeenLastCalledWith", "lastCalledWith"], function(...args) {
3100
+ assertIsMock(this);
3101
+ const spy = utils.flag(this, "object");
3102
+ const lastCall = spy.getCall(spy.returnValues.length - 1);
3103
+ this.assert(lastCall.calledWith(...args), "expected last spy call to have been called with #{exp}", "expected last spy call not to have been called with #{exp}", args, lastCall.args);
3104
+ });
3105
+ def(["toThrow", "toThrowError"], function(expected) {
3106
+ const negate = utils.flag(this, "negate");
3107
+ if (negate)
3108
+ this.not.to.throw(expected);
3109
+ else
3110
+ this.to.throw(expected);
3111
+ });
3112
+ def(["toHaveReturned", "toReturn"], function() {
3113
+ assertIsMock(this);
3114
+ const spy = utils.flag(this, "object");
3115
+ const calledAndNotThrew = spy.called && !spy.alwaysThrew();
3116
+ this.assert(calledAndNotThrew, "expected spy to be successfully called at least once", "expected spy not to be successfully called", calledAndNotThrew, !calledAndNotThrew);
3117
+ });
3118
+ def(["toHaveReturnedTimes", "toReturnTimes"], function(times) {
3119
+ assertIsMock(this);
3120
+ const spy = utils.flag(this, "object");
3121
+ const successfullReturns = spy.getCalls().reduce((success, call) => call.threw() ? success : ++success, 0);
3122
+ this.assert(successfullReturns === times, `expected spy to be successfully called ${times} times`, `expected spy not to be successfully called ${times} times`, `expected number of returns: ${times}`, `recieved number of returns: ${successfullReturns}`);
3123
+ });
3124
+ def(["toHaveReturnedWith", "toReturnWith"], function(value) {
3125
+ assertIsMock(this);
3126
+ return this.returned(value);
3127
+ });
3128
+ def(["toHaveLastReturnedWith", "lastReturnedWith"], function(value) {
3129
+ assertIsMock(this);
3130
+ const spy = utils.flag(this, "object");
3131
+ const lastReturn = spy.lastCall.returned(value);
3132
+ this.assert(lastReturn, "expected last spy call to return #{exp}", "expected last spy call not to return #{exp}", value, spy.lastCall.returnValue);
3133
+ });
3134
+ def(["toHaveNthReturnedWith", "nthReturnedWith"], function(nthCall, value) {
3135
+ assertIsMock(this);
3136
+ const spy = utils.flag(this, "object");
3137
+ const isNot = utils.flag(this, "negate");
3138
+ const call = spy.getCall(nthCall - 1);
3139
+ const ordinalCall = `${ordinalOf(nthCall)} call`;
3140
+ if (!isNot && call.threw())
3141
+ chai.assert.fail(`expected ${ordinalCall} to return #{exp}, but instead it threw an error`);
3142
+ const nthCallReturn = call.returned(value);
3143
+ this.assert(nthCallReturn, `expected ${ordinalCall} spy call to return #{exp}`, `expected ${ordinalCall} spy call not to return #{exp}`, value, call.returnValue);
3144
+ });
3145
+ };
3146
+ }
3147
+
3148
+ let installed = false;
3149
+ async function setupChai() {
3150
+ if (installed)
3151
+ return;
3152
+ chai.use(SinonChai);
3153
+ chai.use(JestChaiExpect());
3154
+ chai.use(Subset);
3155
+ chai.use(SnapshotPlugin());
3156
+ installed = true;
3157
+ }
3158
+
3159
+ async function setupGlobalEnv(config) {
3160
+ await setupChai();
3161
+ if (config.global)
3162
+ (await import('./global-e40b54d6.js')).registerApiGlobally();
3163
+ }
3164
+ async function withEnv(name, fn) {
3165
+ const env = await environments[name].setup(globalThis);
3166
+ try {
3167
+ await fn();
3168
+ } finally {
3169
+ await env.teardown(globalThis);
3170
+ }
3171
+ }
3172
+
3173
+ function processError(err) {
3174
+ if (!err)
3175
+ return err;
3176
+ if (err.stack)
3177
+ err.stackStr = String(err.stack);
3178
+ if (err.name)
3179
+ err.nameStr = String(err.name);
3180
+ return err;
3181
+ }
3182
+
3183
+ async function collectTests(paths) {
3184
+ const files = [];
3185
+ for (const filepath of paths) {
3186
+ const file = {
3187
+ id: nanoid(),
3188
+ name: basename(filepath),
3189
+ type: "suite",
3190
+ mode: "run",
3191
+ computeMode: "serial",
3192
+ filepath,
3193
+ tasks: []
3194
+ };
3195
+ setHooks(file, createSuiteHooks());
3196
+ clearContext();
3197
+ try {
3198
+ await import(filepath);
3199
+ for (const c of [defaultSuite, ...context.tasks]) {
3200
+ if (c.type === "test") {
3201
+ file.tasks.push(c);
3202
+ } else {
3203
+ const suite = await c.collect(file);
3204
+ if (suite.name || suite.tasks.length)
3205
+ file.tasks.push(suite);
3206
+ }
3207
+ }
3208
+ } catch (e) {
3209
+ file.result = {
3210
+ start: performance.now(),
3211
+ state: "fail",
3212
+ error: processError(e)
3213
+ };
3214
+ process.stdout.write("\0");
3215
+ }
3216
+ files.push(file);
3217
+ }
3218
+ const tasks = files.reduce((tasks2, file) => tasks2.concat(file.tasks), []);
3219
+ interpretOnlyMode(tasks);
3220
+ tasks.forEach((i) => {
3221
+ if (i.type === "suite") {
3222
+ if (i.mode === "skip")
3223
+ i.tasks.forEach((c) => c.mode === "run" && (c.mode = "skip"));
3224
+ else
3225
+ interpretOnlyMode(i.tasks);
3226
+ }
3227
+ });
3228
+ return files;
3229
+ }
3230
+
3231
+ async function callHook(suite, name, args) {
3232
+ await Promise.all(getHooks(suite)[name].map((fn) => fn(...args)));
3233
+ }
3234
+ function updateTask(task) {
3235
+ return rpc("onTaskUpdate", [task.id, task.result]);
3236
+ }
3237
+ async function runTest(test) {
3238
+ if (test.mode !== "run")
3239
+ return;
3240
+ test.result = {
3241
+ start: performance.now(),
3242
+ state: "run"
3243
+ };
3244
+ updateTask(test);
3245
+ getSnapshotClient().setTest(test);
3246
+ try {
3247
+ await callHook(test.suite, "beforeEach", [test, test.suite]);
3248
+ await getFn(test)();
3249
+ test.result.state = "pass";
3250
+ } catch (e) {
3251
+ test.result.state = "fail";
3252
+ test.result.error = processError(e);
3253
+ }
3254
+ try {
3255
+ await callHook(test.suite, "afterEach", [test, test.suite]);
3256
+ } catch (e) {
3257
+ test.result.state = "fail";
3258
+ test.result.error = processError(e);
3259
+ }
3260
+ getSnapshotClient().clearTest();
3261
+ test.result.end = performance.now();
3262
+ updateTask(test);
3263
+ }
3264
+ async function runSuite(suite) {
3265
+ var _a;
3266
+ if (((_a = suite.result) == null ? void 0 : _a.state) === "fail")
3267
+ return;
3268
+ suite.result = {
3269
+ start: performance.now(),
3270
+ state: "run"
3271
+ };
3272
+ updateTask(suite);
3273
+ if (suite.mode === "skip") {
3274
+ suite.result.state = "skip";
3275
+ } else if (suite.mode === "todo") {
3276
+ suite.result.state = "todo";
3277
+ } else {
3278
+ try {
3279
+ await callHook(suite, "beforeAll", [suite]);
3280
+ for (const tasksGroup of partitionSuiteChildren(suite)) {
3281
+ const computeMode = tasksGroup[0].computeMode;
3282
+ if (computeMode === "serial") {
3283
+ for (const c of tasksGroup)
3284
+ await runSuiteChild(c);
3285
+ } else if (computeMode === "concurrent") {
3286
+ await Promise.all(tasksGroup.map((c) => runSuiteChild(c)));
3287
+ }
3288
+ }
3289
+ await callHook(suite, "afterAll", [suite]);
3290
+ } catch (e) {
3291
+ suite.result.state = "fail";
3292
+ suite.result.error = processError(e);
3293
+ }
3294
+ }
3295
+ suite.result.end = performance.now();
3296
+ if (suite.mode === "run") {
3297
+ if (!hasTests(suite)) {
3298
+ suite.result.state = "fail";
3299
+ if (!suite.result.error)
3300
+ suite.result.error = new Error(`No tests found in suite ${suite.name}`);
3301
+ } else if (hasFailed(suite)) {
3302
+ suite.result.state = "fail";
3303
+ } else {
3304
+ suite.result.state = "pass";
3305
+ }
3306
+ }
3307
+ updateTask(suite);
3308
+ }
3309
+ async function runSuiteChild(c) {
3310
+ return c.type === "test" ? runTest(c) : runSuite(c);
3311
+ }
3312
+ async function runSuites(suites) {
3313
+ for (const suite of suites)
3314
+ await runSuite(suite);
3315
+ }
3316
+ async function startTests(paths) {
3317
+ const files = await collectTests(paths);
3318
+ send("onCollected", files);
3319
+ await runSuites(files);
3320
+ await getSnapshotClient().saveSnap();
3321
+ }
3322
+
3323
+ async function run(files, config) {
3324
+ await setupGlobalEnv(config);
3325
+ await withEnv(config.environment, async () => {
3326
+ await startTests(files);
3327
+ });
3328
+ }
3329
+
3330
+ export { run };