vitest 0.0.66 → 0.0.70

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