vitest 0.0.119 → 0.0.123

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 CHANGED
@@ -1,17 +1,17 @@
1
1
  import fs, { promises } from 'fs';
2
- import { f as equals, h as iterableEquality, j as subsetEquality, k as isA, J as JestChaiExpect, l as clearContext, m as defaultSuite, n as setHooks, o as getHooks, p as context, s as setState, q as getFn, b as getState, e as vi } from './vi-092f86e3.js';
2
+ import { f as format_1, h as getSerializers, p as plugins_1, b as getState, j as equals, k as iterableEquality, l as subsetEquality, m as isA, J as JestChaiExpect, n as clearContext, o as defaultSuite, q as setHooks, r as getHooks, u as context, s as setState, x as getFn, e as vi } from './vi-aef0a94d.js';
3
3
  import { Console } from 'console';
4
4
  import { Writable } from 'stream';
5
5
  import { importModule } from 'local-pkg';
6
6
  import chai$1, { expect, util } from 'chai';
7
7
  import { a as commonjsRequire, c as commonjsGlobal } from './_commonjsHelpers-c9e3b764.js';
8
- import { u as index, s as slash, v as getNames, c as c$1, t as toArray, r as relative, w as partitionSuiteChildren, x as hasTests, h as hasFailed } from './index-090545ef.js';
8
+ import { u as index, s as slash, v as getNames, c, t as toArray, r as relative, w as partitionSuiteChildren, x as hasTests, h as hasFailed } from './index-250bdca0.js';
9
9
  import { r as rpc } from './rpc-8c7cc374.js';
10
- import { l as getOriginalPos, m as posToNumber, n as parseStack, u as unifiedDiff } from './diff-a295cb37.js';
11
- import { performance } from 'perf_hooks';
10
+ import { l as getOriginalPos, m as posToNumber, n as parseStack, u as unifiedDiff } from './diff-a0cbb825.js';
11
+ import { performance as performance$1 } from 'perf_hooks';
12
12
  import { createHash } from 'crypto';
13
- import { format as format$1 } from 'util';
14
- import './jest-mock-4a754991.js';
13
+ import { format } from 'util';
14
+ import './jest-mock-038a01b3.js';
15
15
  import 'tinyspy';
16
16
  import 'url';
17
17
  import 'tty';
@@ -484,2325 +484,6 @@ try {
484
484
 
485
485
  var naturalCompare$1 = naturalCompare$2.exports;
486
486
 
487
- var build = {};
488
-
489
- var ansiStyles = {exports: {}};
490
-
491
- (function (module) {
492
-
493
- const ANSI_BACKGROUND_OFFSET = 10;
494
-
495
- const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
496
-
497
- const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
498
-
499
- function assembleStyles() {
500
- const codes = new Map();
501
- const styles = {
502
- modifier: {
503
- reset: [0, 0],
504
- // 21 isn't widely supported and 22 does the same thing
505
- bold: [1, 22],
506
- dim: [2, 22],
507
- italic: [3, 23],
508
- underline: [4, 24],
509
- overline: [53, 55],
510
- inverse: [7, 27],
511
- hidden: [8, 28],
512
- strikethrough: [9, 29]
513
- },
514
- color: {
515
- black: [30, 39],
516
- red: [31, 39],
517
- green: [32, 39],
518
- yellow: [33, 39],
519
- blue: [34, 39],
520
- magenta: [35, 39],
521
- cyan: [36, 39],
522
- white: [37, 39],
523
-
524
- // Bright color
525
- blackBright: [90, 39],
526
- redBright: [91, 39],
527
- greenBright: [92, 39],
528
- yellowBright: [93, 39],
529
- blueBright: [94, 39],
530
- magentaBright: [95, 39],
531
- cyanBright: [96, 39],
532
- whiteBright: [97, 39]
533
- },
534
- bgColor: {
535
- bgBlack: [40, 49],
536
- bgRed: [41, 49],
537
- bgGreen: [42, 49],
538
- bgYellow: [43, 49],
539
- bgBlue: [44, 49],
540
- bgMagenta: [45, 49],
541
- bgCyan: [46, 49],
542
- bgWhite: [47, 49],
543
-
544
- // Bright color
545
- bgBlackBright: [100, 49],
546
- bgRedBright: [101, 49],
547
- bgGreenBright: [102, 49],
548
- bgYellowBright: [103, 49],
549
- bgBlueBright: [104, 49],
550
- bgMagentaBright: [105, 49],
551
- bgCyanBright: [106, 49],
552
- bgWhiteBright: [107, 49]
553
- }
554
- };
555
-
556
- // Alias bright black as gray (and grey)
557
- styles.color.gray = styles.color.blackBright;
558
- styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
559
- styles.color.grey = styles.color.blackBright;
560
- styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
561
-
562
- for (const [groupName, group] of Object.entries(styles)) {
563
- for (const [styleName, style] of Object.entries(group)) {
564
- styles[styleName] = {
565
- open: `\u001B[${style[0]}m`,
566
- close: `\u001B[${style[1]}m`
567
- };
568
-
569
- group[styleName] = styles[styleName];
570
-
571
- codes.set(style[0], style[1]);
572
- }
573
-
574
- Object.defineProperty(styles, groupName, {
575
- value: group,
576
- enumerable: false
577
- });
578
- }
579
-
580
- Object.defineProperty(styles, 'codes', {
581
- value: codes,
582
- enumerable: false
583
- });
584
-
585
- styles.color.close = '\u001B[39m';
586
- styles.bgColor.close = '\u001B[49m';
587
-
588
- styles.color.ansi256 = wrapAnsi256();
589
- styles.color.ansi16m = wrapAnsi16m();
590
- styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
591
- styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
592
-
593
- // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
594
- Object.defineProperties(styles, {
595
- rgbToAnsi256: {
596
- value: (red, green, blue) => {
597
- // We use the extended greyscale palette here, with the exception of
598
- // black and white. normal palette only has 4 greyscale shades.
599
- if (red === green && green === blue) {
600
- if (red < 8) {
601
- return 16;
602
- }
603
-
604
- if (red > 248) {
605
- return 231;
606
- }
607
-
608
- return Math.round(((red - 8) / 247) * 24) + 232;
609
- }
610
-
611
- return 16 +
612
- (36 * Math.round(red / 255 * 5)) +
613
- (6 * Math.round(green / 255 * 5)) +
614
- Math.round(blue / 255 * 5);
615
- },
616
- enumerable: false
617
- },
618
- hexToRgb: {
619
- value: hex => {
620
- const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
621
- if (!matches) {
622
- return [0, 0, 0];
623
- }
624
-
625
- let {colorString} = matches.groups;
626
-
627
- if (colorString.length === 3) {
628
- colorString = colorString.split('').map(character => character + character).join('');
629
- }
630
-
631
- const integer = Number.parseInt(colorString, 16);
632
-
633
- return [
634
- (integer >> 16) & 0xFF,
635
- (integer >> 8) & 0xFF,
636
- integer & 0xFF
637
- ];
638
- },
639
- enumerable: false
640
- },
641
- hexToAnsi256: {
642
- value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
643
- enumerable: false
644
- }
645
- });
646
-
647
- return styles;
648
- }
649
-
650
- // Make the export immutable
651
- Object.defineProperty(module, 'exports', {
652
- enumerable: true,
653
- get: assembleStyles
654
- });
655
- }(ansiStyles));
656
-
657
- var collections = {};
658
-
659
- Object.defineProperty(collections, '__esModule', {
660
- value: true
661
- });
662
- collections.printIteratorEntries = printIteratorEntries;
663
- collections.printIteratorValues = printIteratorValues;
664
- collections.printListItems = printListItems;
665
- collections.printObjectProperties = printObjectProperties;
666
-
667
- /**
668
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
669
- *
670
- * This source code is licensed under the MIT license found in the
671
- * LICENSE file in the root directory of this source tree.
672
- *
673
- */
674
- const getKeysOfEnumerableProperties = (object, compareKeys) => {
675
- const keys = Object.keys(object).sort(compareKeys);
676
-
677
- if (Object.getOwnPropertySymbols) {
678
- Object.getOwnPropertySymbols(object).forEach(symbol => {
679
- if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
680
- keys.push(symbol);
681
- }
682
- });
683
- }
684
-
685
- return keys;
686
- };
687
- /**
688
- * Return entries (for example, of a map)
689
- * with spacing, indentation, and comma
690
- * without surrounding punctuation (for example, braces)
691
- */
692
-
693
- function printIteratorEntries(
694
- iterator,
695
- config,
696
- indentation,
697
- depth,
698
- refs,
699
- printer, // Too bad, so sad that separator for ECMAScript Map has been ' => '
700
- // What a distracting diff if you change a data structure to/from
701
- // ECMAScript Object or Immutable.Map/OrderedMap which use the default.
702
- separator = ': '
703
- ) {
704
- let result = '';
705
- let current = iterator.next();
706
-
707
- if (!current.done) {
708
- result += config.spacingOuter;
709
- const indentationNext = indentation + config.indent;
710
-
711
- while (!current.done) {
712
- const name = printer(
713
- current.value[0],
714
- config,
715
- indentationNext,
716
- depth,
717
- refs
718
- );
719
- const value = printer(
720
- current.value[1],
721
- config,
722
- indentationNext,
723
- depth,
724
- refs
725
- );
726
- result += indentationNext + name + separator + value;
727
- current = iterator.next();
728
-
729
- if (!current.done) {
730
- result += ',' + config.spacingInner;
731
- } else if (!config.min) {
732
- result += ',';
733
- }
734
- }
735
-
736
- result += config.spacingOuter + indentation;
737
- }
738
-
739
- return result;
740
- }
741
- /**
742
- * Return values (for example, of a set)
743
- * with spacing, indentation, and comma
744
- * without surrounding punctuation (braces or brackets)
745
- */
746
-
747
- function printIteratorValues(
748
- iterator,
749
- config,
750
- indentation,
751
- depth,
752
- refs,
753
- printer
754
- ) {
755
- let result = '';
756
- let current = iterator.next();
757
-
758
- if (!current.done) {
759
- result += config.spacingOuter;
760
- const indentationNext = indentation + config.indent;
761
-
762
- while (!current.done) {
763
- result +=
764
- indentationNext +
765
- printer(current.value, config, indentationNext, depth, refs);
766
- current = iterator.next();
767
-
768
- if (!current.done) {
769
- result += ',' + config.spacingInner;
770
- } else if (!config.min) {
771
- result += ',';
772
- }
773
- }
774
-
775
- result += config.spacingOuter + indentation;
776
- }
777
-
778
- return result;
779
- }
780
- /**
781
- * Return items (for example, of an array)
782
- * with spacing, indentation, and comma
783
- * without surrounding punctuation (for example, brackets)
784
- **/
785
-
786
- function printListItems(list, config, indentation, depth, refs, printer) {
787
- let result = '';
788
-
789
- if (list.length) {
790
- result += config.spacingOuter;
791
- const indentationNext = indentation + config.indent;
792
-
793
- for (let i = 0; i < list.length; i++) {
794
- result += indentationNext;
795
-
796
- if (i in list) {
797
- result += printer(list[i], config, indentationNext, depth, refs);
798
- }
799
-
800
- if (i < list.length - 1) {
801
- result += ',' + config.spacingInner;
802
- } else if (!config.min) {
803
- result += ',';
804
- }
805
- }
806
-
807
- result += config.spacingOuter + indentation;
808
- }
809
-
810
- return result;
811
- }
812
- /**
813
- * Return properties of an object
814
- * with spacing, indentation, and comma
815
- * without surrounding punctuation (for example, braces)
816
- */
817
-
818
- function printObjectProperties(val, config, indentation, depth, refs, printer) {
819
- let result = '';
820
- const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
821
-
822
- if (keys.length) {
823
- result += config.spacingOuter;
824
- const indentationNext = indentation + config.indent;
825
-
826
- for (let i = 0; i < keys.length; i++) {
827
- const key = keys[i];
828
- const name = printer(key, config, indentationNext, depth, refs);
829
- const value = printer(val[key], config, indentationNext, depth, refs);
830
- result += indentationNext + name + ': ' + value;
831
-
832
- if (i < keys.length - 1) {
833
- result += ',' + config.spacingInner;
834
- } else if (!config.min) {
835
- result += ',';
836
- }
837
- }
838
-
839
- result += config.spacingOuter + indentation;
840
- }
841
-
842
- return result;
843
- }
844
-
845
- var AsymmetricMatcher$3 = {};
846
-
847
- Object.defineProperty(AsymmetricMatcher$3, '__esModule', {
848
- value: true
849
- });
850
- AsymmetricMatcher$3.default = AsymmetricMatcher$3.test = AsymmetricMatcher$3.serialize = void 0;
851
-
852
- var _collections$3 = collections;
853
-
854
- var global$1 = (function () {
855
- if (typeof globalThis !== 'undefined') {
856
- return globalThis;
857
- } else if (typeof global$1 !== 'undefined') {
858
- return global$1;
859
- } else if (typeof self !== 'undefined') {
860
- return self;
861
- } else if (typeof window !== 'undefined') {
862
- return window;
863
- } else {
864
- return Function('return this')();
865
- }
866
- })();
867
-
868
- var Symbol$2 = global$1['jest-symbol-do-not-touch'] || global$1.Symbol;
869
- const asymmetricMatcher =
870
- typeof Symbol$2 === 'function' && Symbol$2.for
871
- ? Symbol$2.for('jest.asymmetricMatcher')
872
- : 0x1357a5;
873
- const SPACE$2 = ' ';
874
-
875
- const serialize$7 = (val, config, indentation, depth, refs, printer) => {
876
- const stringedValue = val.toString();
877
-
878
- if (
879
- stringedValue === 'ArrayContaining' ||
880
- stringedValue === 'ArrayNotContaining'
881
- ) {
882
- if (++depth > config.maxDepth) {
883
- return '[' + stringedValue + ']';
884
- }
885
-
886
- return (
887
- stringedValue +
888
- SPACE$2 +
889
- '[' +
890
- (0, _collections$3.printListItems)(
891
- val.sample,
892
- config,
893
- indentation,
894
- depth,
895
- refs,
896
- printer
897
- ) +
898
- ']'
899
- );
900
- }
901
-
902
- if (
903
- stringedValue === 'ObjectContaining' ||
904
- stringedValue === 'ObjectNotContaining'
905
- ) {
906
- if (++depth > config.maxDepth) {
907
- return '[' + stringedValue + ']';
908
- }
909
-
910
- return (
911
- stringedValue +
912
- SPACE$2 +
913
- '{' +
914
- (0, _collections$3.printObjectProperties)(
915
- val.sample,
916
- config,
917
- indentation,
918
- depth,
919
- refs,
920
- printer
921
- ) +
922
- '}'
923
- );
924
- }
925
-
926
- if (
927
- stringedValue === 'StringMatching' ||
928
- stringedValue === 'StringNotMatching'
929
- ) {
930
- return (
931
- stringedValue +
932
- SPACE$2 +
933
- printer(val.sample, config, indentation, depth, refs)
934
- );
935
- }
936
-
937
- if (
938
- stringedValue === 'StringContaining' ||
939
- stringedValue === 'StringNotContaining'
940
- ) {
941
- return (
942
- stringedValue +
943
- SPACE$2 +
944
- printer(val.sample, config, indentation, depth, refs)
945
- );
946
- }
947
-
948
- return val.toAsymmetricMatcher();
949
- };
950
-
951
- AsymmetricMatcher$3.serialize = serialize$7;
952
-
953
- const test$6 = val => val && val.$$typeof === asymmetricMatcher;
954
-
955
- AsymmetricMatcher$3.test = test$6;
956
- const plugin$6 = {
957
- serialize: serialize$7,
958
- test: test$6
959
- };
960
- var _default$7 = plugin$6;
961
- AsymmetricMatcher$3.default = _default$7;
962
-
963
- var ConvertAnsi = {};
964
-
965
- var ansiRegex = ({onlyFirst = false} = {}) => {
966
- const pattern = [
967
- '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
968
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
969
- ].join('|');
970
-
971
- return new RegExp(pattern, onlyFirst ? undefined : 'g');
972
- };
973
-
974
- Object.defineProperty(ConvertAnsi, '__esModule', {
975
- value: true
976
- });
977
- ConvertAnsi.default = ConvertAnsi.serialize = ConvertAnsi.test = void 0;
978
-
979
- var _ansiRegex = _interopRequireDefault$2(ansiRegex);
980
-
981
- var _ansiStyles$1 = _interopRequireDefault$2(ansiStyles.exports);
982
-
983
- function _interopRequireDefault$2(obj) {
984
- return obj && obj.__esModule ? obj : {default: obj};
985
- }
986
-
987
- /**
988
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
989
- *
990
- * This source code is licensed under the MIT license found in the
991
- * LICENSE file in the root directory of this source tree.
992
- */
993
- const toHumanReadableAnsi = text =>
994
- text.replace((0, _ansiRegex.default)(), match => {
995
- switch (match) {
996
- case _ansiStyles$1.default.red.close:
997
- case _ansiStyles$1.default.green.close:
998
- case _ansiStyles$1.default.cyan.close:
999
- case _ansiStyles$1.default.gray.close:
1000
- case _ansiStyles$1.default.white.close:
1001
- case _ansiStyles$1.default.yellow.close:
1002
- case _ansiStyles$1.default.bgRed.close:
1003
- case _ansiStyles$1.default.bgGreen.close:
1004
- case _ansiStyles$1.default.bgYellow.close:
1005
- case _ansiStyles$1.default.inverse.close:
1006
- case _ansiStyles$1.default.dim.close:
1007
- case _ansiStyles$1.default.bold.close:
1008
- case _ansiStyles$1.default.reset.open:
1009
- case _ansiStyles$1.default.reset.close:
1010
- return '</>';
1011
-
1012
- case _ansiStyles$1.default.red.open:
1013
- return '<red>';
1014
-
1015
- case _ansiStyles$1.default.green.open:
1016
- return '<green>';
1017
-
1018
- case _ansiStyles$1.default.cyan.open:
1019
- return '<cyan>';
1020
-
1021
- case _ansiStyles$1.default.gray.open:
1022
- return '<gray>';
1023
-
1024
- case _ansiStyles$1.default.white.open:
1025
- return '<white>';
1026
-
1027
- case _ansiStyles$1.default.yellow.open:
1028
- return '<yellow>';
1029
-
1030
- case _ansiStyles$1.default.bgRed.open:
1031
- return '<bgRed>';
1032
-
1033
- case _ansiStyles$1.default.bgGreen.open:
1034
- return '<bgGreen>';
1035
-
1036
- case _ansiStyles$1.default.bgYellow.open:
1037
- return '<bgYellow>';
1038
-
1039
- case _ansiStyles$1.default.inverse.open:
1040
- return '<inverse>';
1041
-
1042
- case _ansiStyles$1.default.dim.open:
1043
- return '<dim>';
1044
-
1045
- case _ansiStyles$1.default.bold.open:
1046
- return '<bold>';
1047
-
1048
- default:
1049
- return '';
1050
- }
1051
- });
1052
-
1053
- const test$5 = val =>
1054
- typeof val === 'string' && !!val.match((0, _ansiRegex.default)());
1055
-
1056
- ConvertAnsi.test = test$5;
1057
-
1058
- const serialize$6 = (val, config, indentation, depth, refs, printer) =>
1059
- printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
1060
-
1061
- ConvertAnsi.serialize = serialize$6;
1062
- const plugin$5 = {
1063
- serialize: serialize$6,
1064
- test: test$5
1065
- };
1066
- var _default$6 = plugin$5;
1067
- ConvertAnsi.default = _default$6;
1068
-
1069
- var DOMCollection$2 = {};
1070
-
1071
- Object.defineProperty(DOMCollection$2, '__esModule', {
1072
- value: true
1073
- });
1074
- DOMCollection$2.default = DOMCollection$2.serialize = DOMCollection$2.test = void 0;
1075
-
1076
- var _collections$2 = collections;
1077
-
1078
- /**
1079
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1080
- *
1081
- * This source code is licensed under the MIT license found in the
1082
- * LICENSE file in the root directory of this source tree.
1083
- */
1084
-
1085
- /* eslint-disable local/ban-types-eventually */
1086
- const SPACE$1 = ' ';
1087
- const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
1088
- const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
1089
-
1090
- const testName = name =>
1091
- OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);
1092
-
1093
- const test$4 = val =>
1094
- val &&
1095
- val.constructor &&
1096
- !!val.constructor.name &&
1097
- testName(val.constructor.name);
1098
-
1099
- DOMCollection$2.test = test$4;
1100
-
1101
- const isNamedNodeMap = collection =>
1102
- collection.constructor.name === 'NamedNodeMap';
1103
-
1104
- const serialize$5 = (collection, config, indentation, depth, refs, printer) => {
1105
- const name = collection.constructor.name;
1106
-
1107
- if (++depth > config.maxDepth) {
1108
- return '[' + name + ']';
1109
- }
1110
-
1111
- return (
1112
- (config.min ? '' : name + SPACE$1) +
1113
- (OBJECT_NAMES.indexOf(name) !== -1
1114
- ? '{' +
1115
- (0, _collections$2.printObjectProperties)(
1116
- isNamedNodeMap(collection)
1117
- ? Array.from(collection).reduce((props, attribute) => {
1118
- props[attribute.name] = attribute.value;
1119
- return props;
1120
- }, {})
1121
- : {...collection},
1122
- config,
1123
- indentation,
1124
- depth,
1125
- refs,
1126
- printer
1127
- ) +
1128
- '}'
1129
- : '[' +
1130
- (0, _collections$2.printListItems)(
1131
- Array.from(collection),
1132
- config,
1133
- indentation,
1134
- depth,
1135
- refs,
1136
- printer
1137
- ) +
1138
- ']')
1139
- );
1140
- };
1141
-
1142
- DOMCollection$2.serialize = serialize$5;
1143
- const plugin$4 = {
1144
- serialize: serialize$5,
1145
- test: test$4
1146
- };
1147
- var _default$5 = plugin$4;
1148
- DOMCollection$2.default = _default$5;
1149
-
1150
- var DOMElement$2 = {};
1151
-
1152
- var markup = {};
1153
-
1154
- var escapeHTML$1 = {};
1155
-
1156
- Object.defineProperty(escapeHTML$1, '__esModule', {
1157
- value: true
1158
- });
1159
- escapeHTML$1.default = escapeHTML;
1160
-
1161
- /**
1162
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1163
- *
1164
- * This source code is licensed under the MIT license found in the
1165
- * LICENSE file in the root directory of this source tree.
1166
- */
1167
- function escapeHTML(str) {
1168
- return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
1169
- }
1170
-
1171
- Object.defineProperty(markup, '__esModule', {
1172
- value: true
1173
- });
1174
- markup.printElementAsLeaf =
1175
- markup.printElement =
1176
- markup.printComment =
1177
- markup.printText =
1178
- markup.printChildren =
1179
- markup.printProps =
1180
- void 0;
1181
-
1182
- var _escapeHTML = _interopRequireDefault$1(escapeHTML$1);
1183
-
1184
- function _interopRequireDefault$1(obj) {
1185
- return obj && obj.__esModule ? obj : {default: obj};
1186
- }
1187
-
1188
- /**
1189
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1190
- *
1191
- * This source code is licensed under the MIT license found in the
1192
- * LICENSE file in the root directory of this source tree.
1193
- */
1194
- // Return empty string if keys is empty.
1195
- const printProps = (keys, props, config, indentation, depth, refs, printer) => {
1196
- const indentationNext = indentation + config.indent;
1197
- const colors = config.colors;
1198
- return keys
1199
- .map(key => {
1200
- const value = props[key];
1201
- let printed = printer(value, config, indentationNext, depth, refs);
1202
-
1203
- if (typeof value !== 'string') {
1204
- if (printed.indexOf('\n') !== -1) {
1205
- printed =
1206
- config.spacingOuter +
1207
- indentationNext +
1208
- printed +
1209
- config.spacingOuter +
1210
- indentation;
1211
- }
1212
-
1213
- printed = '{' + printed + '}';
1214
- }
1215
-
1216
- return (
1217
- config.spacingInner +
1218
- indentation +
1219
- colors.prop.open +
1220
- key +
1221
- colors.prop.close +
1222
- '=' +
1223
- colors.value.open +
1224
- printed +
1225
- colors.value.close
1226
- );
1227
- })
1228
- .join('');
1229
- }; // Return empty string if children is empty.
1230
-
1231
- markup.printProps = printProps;
1232
-
1233
- const printChildren = (children, config, indentation, depth, refs, printer) =>
1234
- children
1235
- .map(
1236
- child =>
1237
- config.spacingOuter +
1238
- indentation +
1239
- (typeof child === 'string'
1240
- ? printText(child, config)
1241
- : printer(child, config, indentation, depth, refs))
1242
- )
1243
- .join('');
1244
-
1245
- markup.printChildren = printChildren;
1246
-
1247
- const printText = (text, config) => {
1248
- const contentColor = config.colors.content;
1249
- return (
1250
- contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close
1251
- );
1252
- };
1253
-
1254
- markup.printText = printText;
1255
-
1256
- const printComment = (comment, config) => {
1257
- const commentColor = config.colors.comment;
1258
- return (
1259
- commentColor.open +
1260
- '<!--' +
1261
- (0, _escapeHTML.default)(comment) +
1262
- '-->' +
1263
- commentColor.close
1264
- );
1265
- }; // Separate the functions to format props, children, and element,
1266
- // so a plugin could override a particular function, if needed.
1267
- // Too bad, so sad: the traditional (but unnecessary) space
1268
- // in a self-closing tagColor requires a second test of printedProps.
1269
-
1270
- markup.printComment = printComment;
1271
-
1272
- const printElement = (
1273
- type,
1274
- printedProps,
1275
- printedChildren,
1276
- config,
1277
- indentation
1278
- ) => {
1279
- const tagColor = config.colors.tag;
1280
- return (
1281
- tagColor.open +
1282
- '<' +
1283
- type +
1284
- (printedProps &&
1285
- tagColor.close +
1286
- printedProps +
1287
- config.spacingOuter +
1288
- indentation +
1289
- tagColor.open) +
1290
- (printedChildren
1291
- ? '>' +
1292
- tagColor.close +
1293
- printedChildren +
1294
- config.spacingOuter +
1295
- indentation +
1296
- tagColor.open +
1297
- '</' +
1298
- type
1299
- : (printedProps && !config.min ? '' : ' ') + '/') +
1300
- '>' +
1301
- tagColor.close
1302
- );
1303
- };
1304
-
1305
- markup.printElement = printElement;
1306
-
1307
- const printElementAsLeaf = (type, config) => {
1308
- const tagColor = config.colors.tag;
1309
- return (
1310
- tagColor.open +
1311
- '<' +
1312
- type +
1313
- tagColor.close +
1314
- ' …' +
1315
- tagColor.open +
1316
- ' />' +
1317
- tagColor.close
1318
- );
1319
- };
1320
-
1321
- markup.printElementAsLeaf = printElementAsLeaf;
1322
-
1323
- Object.defineProperty(DOMElement$2, '__esModule', {
1324
- value: true
1325
- });
1326
- DOMElement$2.default = DOMElement$2.serialize = DOMElement$2.test = void 0;
1327
-
1328
- var _markup$2 = markup;
1329
-
1330
- /**
1331
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1332
- *
1333
- * This source code is licensed under the MIT license found in the
1334
- * LICENSE file in the root directory of this source tree.
1335
- */
1336
- const ELEMENT_NODE = 1;
1337
- const TEXT_NODE = 3;
1338
- const COMMENT_NODE = 8;
1339
- const FRAGMENT_NODE = 11;
1340
- const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
1341
-
1342
- const testHasAttribute = val => {
1343
- try {
1344
- return typeof val.hasAttribute === 'function' && val.hasAttribute('is');
1345
- } catch {
1346
- return false;
1347
- }
1348
- };
1349
-
1350
- const testNode = val => {
1351
- const constructorName = val.constructor.name;
1352
- const {nodeType, tagName} = val;
1353
- const isCustomElement =
1354
- (typeof tagName === 'string' && tagName.includes('-')) ||
1355
- testHasAttribute(val);
1356
- return (
1357
- (nodeType === ELEMENT_NODE &&
1358
- (ELEMENT_REGEXP.test(constructorName) || isCustomElement)) ||
1359
- (nodeType === TEXT_NODE && constructorName === 'Text') ||
1360
- (nodeType === COMMENT_NODE && constructorName === 'Comment') ||
1361
- (nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment')
1362
- );
1363
- };
1364
-
1365
- const test$3 = val => {
1366
- var _val$constructor;
1367
-
1368
- return (
1369
- (val === null || val === void 0
1370
- ? void 0
1371
- : (_val$constructor = val.constructor) === null ||
1372
- _val$constructor === void 0
1373
- ? void 0
1374
- : _val$constructor.name) && testNode(val)
1375
- );
1376
- };
1377
-
1378
- DOMElement$2.test = test$3;
1379
-
1380
- function nodeIsText(node) {
1381
- return node.nodeType === TEXT_NODE;
1382
- }
1383
-
1384
- function nodeIsComment(node) {
1385
- return node.nodeType === COMMENT_NODE;
1386
- }
1387
-
1388
- function nodeIsFragment(node) {
1389
- return node.nodeType === FRAGMENT_NODE;
1390
- }
1391
-
1392
- const serialize$4 = (node, config, indentation, depth, refs, printer) => {
1393
- if (nodeIsText(node)) {
1394
- return (0, _markup$2.printText)(node.data, config);
1395
- }
1396
-
1397
- if (nodeIsComment(node)) {
1398
- return (0, _markup$2.printComment)(node.data, config);
1399
- }
1400
-
1401
- const type = nodeIsFragment(node)
1402
- ? `DocumentFragment`
1403
- : node.tagName.toLowerCase();
1404
-
1405
- if (++depth > config.maxDepth) {
1406
- return (0, _markup$2.printElementAsLeaf)(type, config);
1407
- }
1408
-
1409
- return (0, _markup$2.printElement)(
1410
- type,
1411
- (0, _markup$2.printProps)(
1412
- nodeIsFragment(node)
1413
- ? []
1414
- : Array.from(node.attributes)
1415
- .map(attr => attr.name)
1416
- .sort(),
1417
- nodeIsFragment(node)
1418
- ? {}
1419
- : Array.from(node.attributes).reduce((props, attribute) => {
1420
- props[attribute.name] = attribute.value;
1421
- return props;
1422
- }, {}),
1423
- config,
1424
- indentation + config.indent,
1425
- depth,
1426
- refs,
1427
- printer
1428
- ),
1429
- (0, _markup$2.printChildren)(
1430
- Array.prototype.slice.call(node.childNodes || node.children),
1431
- config,
1432
- indentation + config.indent,
1433
- depth,
1434
- refs,
1435
- printer
1436
- ),
1437
- config,
1438
- indentation
1439
- );
1440
- };
1441
-
1442
- DOMElement$2.serialize = serialize$4;
1443
- const plugin$3 = {
1444
- serialize: serialize$4,
1445
- test: test$3
1446
- };
1447
- var _default$4 = plugin$3;
1448
- DOMElement$2.default = _default$4;
1449
-
1450
- var Immutable$2 = {};
1451
-
1452
- Object.defineProperty(Immutable$2, '__esModule', {
1453
- value: true
1454
- });
1455
- Immutable$2.default = Immutable$2.test = Immutable$2.serialize = void 0;
1456
-
1457
- var _collections$1 = collections;
1458
-
1459
- /**
1460
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1461
- *
1462
- * This source code is licensed under the MIT license found in the
1463
- * LICENSE file in the root directory of this source tree.
1464
- */
1465
- // SENTINEL constants are from https://github.com/facebook/immutable-js
1466
- const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
1467
- const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
1468
- const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
1469
- const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
1470
- const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
1471
- const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
1472
-
1473
- const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
1474
- const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
1475
- const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
1476
-
1477
- const getImmutableName = name => 'Immutable.' + name;
1478
-
1479
- const printAsLeaf = name => '[' + name + ']';
1480
-
1481
- const SPACE = ' ';
1482
- const LAZY = '…'; // Seq is lazy if it calls a method like filter
1483
-
1484
- const printImmutableEntries = (
1485
- val,
1486
- config,
1487
- indentation,
1488
- depth,
1489
- refs,
1490
- printer,
1491
- type
1492
- ) =>
1493
- ++depth > config.maxDepth
1494
- ? printAsLeaf(getImmutableName(type))
1495
- : getImmutableName(type) +
1496
- SPACE +
1497
- '{' +
1498
- (0, _collections$1.printIteratorEntries)(
1499
- val.entries(),
1500
- config,
1501
- indentation,
1502
- depth,
1503
- refs,
1504
- printer
1505
- ) +
1506
- '}'; // Record has an entries method because it is a collection in immutable v3.
1507
- // Return an iterator for Immutable Record from version v3 or v4.
1508
-
1509
- function getRecordEntries(val) {
1510
- let i = 0;
1511
- return {
1512
- next() {
1513
- if (i < val._keys.length) {
1514
- const key = val._keys[i++];
1515
- return {
1516
- done: false,
1517
- value: [key, val.get(key)]
1518
- };
1519
- }
1520
-
1521
- return {
1522
- done: true,
1523
- value: undefined
1524
- };
1525
- }
1526
- };
1527
- }
1528
-
1529
- const printImmutableRecord = (
1530
- val,
1531
- config,
1532
- indentation,
1533
- depth,
1534
- refs,
1535
- printer
1536
- ) => {
1537
- // _name property is defined only for an Immutable Record instance
1538
- // which was constructed with a second optional descriptive name arg
1539
- const name = getImmutableName(val._name || 'Record');
1540
- return ++depth > config.maxDepth
1541
- ? printAsLeaf(name)
1542
- : name +
1543
- SPACE +
1544
- '{' +
1545
- (0, _collections$1.printIteratorEntries)(
1546
- getRecordEntries(val),
1547
- config,
1548
- indentation,
1549
- depth,
1550
- refs,
1551
- printer
1552
- ) +
1553
- '}';
1554
- };
1555
-
1556
- const printImmutableSeq = (val, config, indentation, depth, refs, printer) => {
1557
- const name = getImmutableName('Seq');
1558
-
1559
- if (++depth > config.maxDepth) {
1560
- return printAsLeaf(name);
1561
- }
1562
-
1563
- if (val[IS_KEYED_SENTINEL]) {
1564
- return (
1565
- name +
1566
- SPACE +
1567
- '{' +
1568
- (val._iter || val._object
1569
- ? (0, _collections$1.printIteratorEntries)(
1570
- val.entries(),
1571
- config,
1572
- indentation,
1573
- depth,
1574
- refs,
1575
- printer
1576
- )
1577
- : LAZY) +
1578
- '}'
1579
- );
1580
- }
1581
-
1582
- return (
1583
- name +
1584
- SPACE +
1585
- '[' +
1586
- (val._iter || // from Immutable collection of values
1587
- val._array || // from ECMAScript array
1588
- val._collection || // from ECMAScript collection in immutable v4
1589
- val._iterable // from ECMAScript collection in immutable v3
1590
- ? (0, _collections$1.printIteratorValues)(
1591
- val.values(),
1592
- config,
1593
- indentation,
1594
- depth,
1595
- refs,
1596
- printer
1597
- )
1598
- : LAZY) +
1599
- ']'
1600
- );
1601
- };
1602
-
1603
- const printImmutableValues = (
1604
- val,
1605
- config,
1606
- indentation,
1607
- depth,
1608
- refs,
1609
- printer,
1610
- type
1611
- ) =>
1612
- ++depth > config.maxDepth
1613
- ? printAsLeaf(getImmutableName(type))
1614
- : getImmutableName(type) +
1615
- SPACE +
1616
- '[' +
1617
- (0, _collections$1.printIteratorValues)(
1618
- val.values(),
1619
- config,
1620
- indentation,
1621
- depth,
1622
- refs,
1623
- printer
1624
- ) +
1625
- ']';
1626
-
1627
- const serialize$3 = (val, config, indentation, depth, refs, printer) => {
1628
- if (val[IS_MAP_SENTINEL]) {
1629
- return printImmutableEntries(
1630
- val,
1631
- config,
1632
- indentation,
1633
- depth,
1634
- refs,
1635
- printer,
1636
- val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map'
1637
- );
1638
- }
1639
-
1640
- if (val[IS_LIST_SENTINEL]) {
1641
- return printImmutableValues(
1642
- val,
1643
- config,
1644
- indentation,
1645
- depth,
1646
- refs,
1647
- printer,
1648
- 'List'
1649
- );
1650
- }
1651
-
1652
- if (val[IS_SET_SENTINEL]) {
1653
- return printImmutableValues(
1654
- val,
1655
- config,
1656
- indentation,
1657
- depth,
1658
- refs,
1659
- printer,
1660
- val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set'
1661
- );
1662
- }
1663
-
1664
- if (val[IS_STACK_SENTINEL]) {
1665
- return printImmutableValues(
1666
- val,
1667
- config,
1668
- indentation,
1669
- depth,
1670
- refs,
1671
- printer,
1672
- 'Stack'
1673
- );
1674
- }
1675
-
1676
- if (val[IS_SEQ_SENTINEL]) {
1677
- return printImmutableSeq(val, config, indentation, depth, refs, printer);
1678
- } // For compatibility with immutable v3 and v4, let record be the default.
1679
-
1680
- return printImmutableRecord(val, config, indentation, depth, refs, printer);
1681
- }; // Explicitly comparing sentinel properties to true avoids false positive
1682
- // when mock identity-obj-proxy returns the key as the value for any key.
1683
-
1684
- Immutable$2.serialize = serialize$3;
1685
-
1686
- const test$2 = val =>
1687
- val &&
1688
- (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
1689
-
1690
- Immutable$2.test = test$2;
1691
- const plugin$2 = {
1692
- serialize: serialize$3,
1693
- test: test$2
1694
- };
1695
- var _default$3 = plugin$2;
1696
- Immutable$2.default = _default$3;
1697
-
1698
- var ReactElement$2 = {};
1699
-
1700
- var reactIs = {exports: {}};
1701
-
1702
- var reactIs_production_min = {};
1703
-
1704
- /** @license React v17.0.2
1705
- * react-is.production.min.js
1706
- *
1707
- * Copyright (c) Facebook, Inc. and its affiliates.
1708
- *
1709
- * This source code is licensed under the MIT license found in the
1710
- * LICENSE file in the root directory of this source tree.
1711
- */
1712
- 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;
1713
- 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");}
1714
- 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;
1715
- 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};
1716
- 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};
1717
- reactIs_production_min.typeOf=y;
1718
-
1719
- var reactIs_development = {};
1720
-
1721
- /** @license React v17.0.2
1722
- * react-is.development.js
1723
- *
1724
- * Copyright (c) Facebook, Inc. and its affiliates.
1725
- *
1726
- * This source code is licensed under the MIT license found in the
1727
- * LICENSE file in the root directory of this source tree.
1728
- */
1729
-
1730
- if (process.env.NODE_ENV !== "production") {
1731
- (function() {
1732
-
1733
- // ATTENTION
1734
- // When adding new symbols to this file,
1735
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
1736
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
1737
- // nor polyfill, then a plain number is used for performance.
1738
- var REACT_ELEMENT_TYPE = 0xeac7;
1739
- var REACT_PORTAL_TYPE = 0xeaca;
1740
- var REACT_FRAGMENT_TYPE = 0xeacb;
1741
- var REACT_STRICT_MODE_TYPE = 0xeacc;
1742
- var REACT_PROFILER_TYPE = 0xead2;
1743
- var REACT_PROVIDER_TYPE = 0xeacd;
1744
- var REACT_CONTEXT_TYPE = 0xeace;
1745
- var REACT_FORWARD_REF_TYPE = 0xead0;
1746
- var REACT_SUSPENSE_TYPE = 0xead1;
1747
- var REACT_SUSPENSE_LIST_TYPE = 0xead8;
1748
- var REACT_MEMO_TYPE = 0xead3;
1749
- var REACT_LAZY_TYPE = 0xead4;
1750
- var REACT_BLOCK_TYPE = 0xead9;
1751
- var REACT_SERVER_BLOCK_TYPE = 0xeada;
1752
- var REACT_FUNDAMENTAL_TYPE = 0xead5;
1753
- var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
1754
- var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
1755
-
1756
- if (typeof Symbol === 'function' && Symbol.for) {
1757
- var symbolFor = Symbol.for;
1758
- REACT_ELEMENT_TYPE = symbolFor('react.element');
1759
- REACT_PORTAL_TYPE = symbolFor('react.portal');
1760
- REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
1761
- REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
1762
- REACT_PROFILER_TYPE = symbolFor('react.profiler');
1763
- REACT_PROVIDER_TYPE = symbolFor('react.provider');
1764
- REACT_CONTEXT_TYPE = symbolFor('react.context');
1765
- REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
1766
- REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
1767
- REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
1768
- REACT_MEMO_TYPE = symbolFor('react.memo');
1769
- REACT_LAZY_TYPE = symbolFor('react.lazy');
1770
- REACT_BLOCK_TYPE = symbolFor('react.block');
1771
- REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
1772
- REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
1773
- symbolFor('react.scope');
1774
- symbolFor('react.opaque.id');
1775
- REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
1776
- symbolFor('react.offscreen');
1777
- REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
1778
- }
1779
-
1780
- // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1781
-
1782
- var enableScopeAPI = false; // Experimental Create Event Handle API.
1783
-
1784
- function isValidElementType(type) {
1785
- if (typeof type === 'string' || typeof type === 'function') {
1786
- return true;
1787
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1788
-
1789
-
1790
- 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 ) {
1791
- return true;
1792
- }
1793
-
1794
- if (typeof type === 'object' && type !== null) {
1795
- 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) {
1796
- return true;
1797
- }
1798
- }
1799
-
1800
- return false;
1801
- }
1802
-
1803
- function typeOf(object) {
1804
- if (typeof object === 'object' && object !== null) {
1805
- var $$typeof = object.$$typeof;
1806
-
1807
- switch ($$typeof) {
1808
- case REACT_ELEMENT_TYPE:
1809
- var type = object.type;
1810
-
1811
- switch (type) {
1812
- case REACT_FRAGMENT_TYPE:
1813
- case REACT_PROFILER_TYPE:
1814
- case REACT_STRICT_MODE_TYPE:
1815
- case REACT_SUSPENSE_TYPE:
1816
- case REACT_SUSPENSE_LIST_TYPE:
1817
- return type;
1818
-
1819
- default:
1820
- var $$typeofType = type && type.$$typeof;
1821
-
1822
- switch ($$typeofType) {
1823
- case REACT_CONTEXT_TYPE:
1824
- case REACT_FORWARD_REF_TYPE:
1825
- case REACT_LAZY_TYPE:
1826
- case REACT_MEMO_TYPE:
1827
- case REACT_PROVIDER_TYPE:
1828
- return $$typeofType;
1829
-
1830
- default:
1831
- return $$typeof;
1832
- }
1833
-
1834
- }
1835
-
1836
- case REACT_PORTAL_TYPE:
1837
- return $$typeof;
1838
- }
1839
- }
1840
-
1841
- return undefined;
1842
- }
1843
- var ContextConsumer = REACT_CONTEXT_TYPE;
1844
- var ContextProvider = REACT_PROVIDER_TYPE;
1845
- var Element = REACT_ELEMENT_TYPE;
1846
- var ForwardRef = REACT_FORWARD_REF_TYPE;
1847
- var Fragment = REACT_FRAGMENT_TYPE;
1848
- var Lazy = REACT_LAZY_TYPE;
1849
- var Memo = REACT_MEMO_TYPE;
1850
- var Portal = REACT_PORTAL_TYPE;
1851
- var Profiler = REACT_PROFILER_TYPE;
1852
- var StrictMode = REACT_STRICT_MODE_TYPE;
1853
- var Suspense = REACT_SUSPENSE_TYPE;
1854
- var hasWarnedAboutDeprecatedIsAsyncMode = false;
1855
- var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
1856
-
1857
- function isAsyncMode(object) {
1858
- {
1859
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
1860
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
1861
-
1862
- console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
1863
- }
1864
- }
1865
-
1866
- return false;
1867
- }
1868
- function isConcurrentMode(object) {
1869
- {
1870
- if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
1871
- hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
1872
-
1873
- console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
1874
- }
1875
- }
1876
-
1877
- return false;
1878
- }
1879
- function isContextConsumer(object) {
1880
- return typeOf(object) === REACT_CONTEXT_TYPE;
1881
- }
1882
- function isContextProvider(object) {
1883
- return typeOf(object) === REACT_PROVIDER_TYPE;
1884
- }
1885
- function isElement(object) {
1886
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1887
- }
1888
- function isForwardRef(object) {
1889
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
1890
- }
1891
- function isFragment(object) {
1892
- return typeOf(object) === REACT_FRAGMENT_TYPE;
1893
- }
1894
- function isLazy(object) {
1895
- return typeOf(object) === REACT_LAZY_TYPE;
1896
- }
1897
- function isMemo(object) {
1898
- return typeOf(object) === REACT_MEMO_TYPE;
1899
- }
1900
- function isPortal(object) {
1901
- return typeOf(object) === REACT_PORTAL_TYPE;
1902
- }
1903
- function isProfiler(object) {
1904
- return typeOf(object) === REACT_PROFILER_TYPE;
1905
- }
1906
- function isStrictMode(object) {
1907
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
1908
- }
1909
- function isSuspense(object) {
1910
- return typeOf(object) === REACT_SUSPENSE_TYPE;
1911
- }
1912
-
1913
- reactIs_development.ContextConsumer = ContextConsumer;
1914
- reactIs_development.ContextProvider = ContextProvider;
1915
- reactIs_development.Element = Element;
1916
- reactIs_development.ForwardRef = ForwardRef;
1917
- reactIs_development.Fragment = Fragment;
1918
- reactIs_development.Lazy = Lazy;
1919
- reactIs_development.Memo = Memo;
1920
- reactIs_development.Portal = Portal;
1921
- reactIs_development.Profiler = Profiler;
1922
- reactIs_development.StrictMode = StrictMode;
1923
- reactIs_development.Suspense = Suspense;
1924
- reactIs_development.isAsyncMode = isAsyncMode;
1925
- reactIs_development.isConcurrentMode = isConcurrentMode;
1926
- reactIs_development.isContextConsumer = isContextConsumer;
1927
- reactIs_development.isContextProvider = isContextProvider;
1928
- reactIs_development.isElement = isElement;
1929
- reactIs_development.isForwardRef = isForwardRef;
1930
- reactIs_development.isFragment = isFragment;
1931
- reactIs_development.isLazy = isLazy;
1932
- reactIs_development.isMemo = isMemo;
1933
- reactIs_development.isPortal = isPortal;
1934
- reactIs_development.isProfiler = isProfiler;
1935
- reactIs_development.isStrictMode = isStrictMode;
1936
- reactIs_development.isSuspense = isSuspense;
1937
- reactIs_development.isValidElementType = isValidElementType;
1938
- reactIs_development.typeOf = typeOf;
1939
- })();
1940
- }
1941
-
1942
- if (process.env.NODE_ENV === 'production') {
1943
- reactIs.exports = reactIs_production_min;
1944
- } else {
1945
- reactIs.exports = reactIs_development;
1946
- }
1947
-
1948
- Object.defineProperty(ReactElement$2, '__esModule', {
1949
- value: true
1950
- });
1951
- ReactElement$2.default = ReactElement$2.test = ReactElement$2.serialize = void 0;
1952
-
1953
- var ReactIs = _interopRequireWildcard(reactIs.exports);
1954
-
1955
- var _markup$1 = markup;
1956
-
1957
- function _getRequireWildcardCache(nodeInterop) {
1958
- if (typeof WeakMap !== 'function') return null;
1959
- var cacheBabelInterop = new WeakMap();
1960
- var cacheNodeInterop = new WeakMap();
1961
- return (_getRequireWildcardCache = function (nodeInterop) {
1962
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
1963
- })(nodeInterop);
1964
- }
1965
-
1966
- function _interopRequireWildcard(obj, nodeInterop) {
1967
- if (!nodeInterop && obj && obj.__esModule) {
1968
- return obj;
1969
- }
1970
- if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
1971
- return {default: obj};
1972
- }
1973
- var cache = _getRequireWildcardCache(nodeInterop);
1974
- if (cache && cache.has(obj)) {
1975
- return cache.get(obj);
1976
- }
1977
- var newObj = {};
1978
- var hasPropertyDescriptor =
1979
- Object.defineProperty && Object.getOwnPropertyDescriptor;
1980
- for (var key in obj) {
1981
- if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
1982
- var desc = hasPropertyDescriptor
1983
- ? Object.getOwnPropertyDescriptor(obj, key)
1984
- : null;
1985
- if (desc && (desc.get || desc.set)) {
1986
- Object.defineProperty(newObj, key, desc);
1987
- } else {
1988
- newObj[key] = obj[key];
1989
- }
1990
- }
1991
- }
1992
- newObj.default = obj;
1993
- if (cache) {
1994
- cache.set(obj, newObj);
1995
- }
1996
- return newObj;
1997
- }
1998
-
1999
- /**
2000
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2001
- *
2002
- * This source code is licensed under the MIT license found in the
2003
- * LICENSE file in the root directory of this source tree.
2004
- */
2005
- // Given element.props.children, or subtree during recursive traversal,
2006
- // return flattened array of children.
2007
- const getChildren = (arg, children = []) => {
2008
- if (Array.isArray(arg)) {
2009
- arg.forEach(item => {
2010
- getChildren(item, children);
2011
- });
2012
- } else if (arg != null && arg !== false) {
2013
- children.push(arg);
2014
- }
2015
-
2016
- return children;
2017
- };
2018
-
2019
- const getType = element => {
2020
- const type = element.type;
2021
-
2022
- if (typeof type === 'string') {
2023
- return type;
2024
- }
2025
-
2026
- if (typeof type === 'function') {
2027
- return type.displayName || type.name || 'Unknown';
2028
- }
2029
-
2030
- if (ReactIs.isFragment(element)) {
2031
- return 'React.Fragment';
2032
- }
2033
-
2034
- if (ReactIs.isSuspense(element)) {
2035
- return 'React.Suspense';
2036
- }
2037
-
2038
- if (typeof type === 'object' && type !== null) {
2039
- if (ReactIs.isContextProvider(element)) {
2040
- return 'Context.Provider';
2041
- }
2042
-
2043
- if (ReactIs.isContextConsumer(element)) {
2044
- return 'Context.Consumer';
2045
- }
2046
-
2047
- if (ReactIs.isForwardRef(element)) {
2048
- if (type.displayName) {
2049
- return type.displayName;
2050
- }
2051
-
2052
- const functionName = type.render.displayName || type.render.name || '';
2053
- return functionName !== ''
2054
- ? 'ForwardRef(' + functionName + ')'
2055
- : 'ForwardRef';
2056
- }
2057
-
2058
- if (ReactIs.isMemo(element)) {
2059
- const functionName =
2060
- type.displayName || type.type.displayName || type.type.name || '';
2061
- return functionName !== '' ? 'Memo(' + functionName + ')' : 'Memo';
2062
- }
2063
- }
2064
-
2065
- return 'UNDEFINED';
2066
- };
2067
-
2068
- const getPropKeys$1 = element => {
2069
- const {props} = element;
2070
- return Object.keys(props)
2071
- .filter(key => key !== 'children' && props[key] !== undefined)
2072
- .sort();
2073
- };
2074
-
2075
- const serialize$2 = (element, config, indentation, depth, refs, printer) =>
2076
- ++depth > config.maxDepth
2077
- ? (0, _markup$1.printElementAsLeaf)(getType(element), config)
2078
- : (0, _markup$1.printElement)(
2079
- getType(element),
2080
- (0, _markup$1.printProps)(
2081
- getPropKeys$1(element),
2082
- element.props,
2083
- config,
2084
- indentation + config.indent,
2085
- depth,
2086
- refs,
2087
- printer
2088
- ),
2089
- (0, _markup$1.printChildren)(
2090
- getChildren(element.props.children),
2091
- config,
2092
- indentation + config.indent,
2093
- depth,
2094
- refs,
2095
- printer
2096
- ),
2097
- config,
2098
- indentation
2099
- );
2100
-
2101
- ReactElement$2.serialize = serialize$2;
2102
-
2103
- const test$1 = val => val != null && ReactIs.isElement(val);
2104
-
2105
- ReactElement$2.test = test$1;
2106
- const plugin$1 = {
2107
- serialize: serialize$2,
2108
- test: test$1
2109
- };
2110
- var _default$2 = plugin$1;
2111
- ReactElement$2.default = _default$2;
2112
-
2113
- var ReactTestComponent$2 = {};
2114
-
2115
- Object.defineProperty(ReactTestComponent$2, '__esModule', {
2116
- value: true
2117
- });
2118
- ReactTestComponent$2.default = ReactTestComponent$2.test = ReactTestComponent$2.serialize = void 0;
2119
-
2120
- var _markup = markup;
2121
-
2122
- var global = (function () {
2123
- if (typeof globalThis !== 'undefined') {
2124
- return globalThis;
2125
- } else if (typeof global !== 'undefined') {
2126
- return global;
2127
- } else if (typeof self !== 'undefined') {
2128
- return self;
2129
- } else if (typeof window !== 'undefined') {
2130
- return window;
2131
- } else {
2132
- return Function('return this')();
2133
- }
2134
- })();
2135
-
2136
- var Symbol$1 = global['jest-symbol-do-not-touch'] || global.Symbol;
2137
- const testSymbol =
2138
- typeof Symbol$1 === 'function' && Symbol$1.for
2139
- ? Symbol$1.for('react.test.json')
2140
- : 0xea71357;
2141
-
2142
- const getPropKeys = object => {
2143
- const {props} = object;
2144
- return props
2145
- ? Object.keys(props)
2146
- .filter(key => props[key] !== undefined)
2147
- .sort()
2148
- : [];
2149
- };
2150
-
2151
- const serialize$1 = (object, config, indentation, depth, refs, printer) =>
2152
- ++depth > config.maxDepth
2153
- ? (0, _markup.printElementAsLeaf)(object.type, config)
2154
- : (0, _markup.printElement)(
2155
- object.type,
2156
- object.props
2157
- ? (0, _markup.printProps)(
2158
- getPropKeys(object),
2159
- object.props,
2160
- config,
2161
- indentation + config.indent,
2162
- depth,
2163
- refs,
2164
- printer
2165
- )
2166
- : '',
2167
- object.children
2168
- ? (0, _markup.printChildren)(
2169
- object.children,
2170
- config,
2171
- indentation + config.indent,
2172
- depth,
2173
- refs,
2174
- printer
2175
- )
2176
- : '',
2177
- config,
2178
- indentation
2179
- );
2180
-
2181
- ReactTestComponent$2.serialize = serialize$1;
2182
-
2183
- const test = val => val && val.$$typeof === testSymbol;
2184
-
2185
- ReactTestComponent$2.test = test;
2186
- const plugin = {
2187
- serialize: serialize$1,
2188
- test
2189
- };
2190
- var _default$1 = plugin;
2191
- ReactTestComponent$2.default = _default$1;
2192
-
2193
- Object.defineProperty(build, '__esModule', {
2194
- value: true
2195
- });
2196
- var format_1 = build.format = format;
2197
- build.default = plugins_1 = build.plugins = build.DEFAULT_OPTIONS = void 0;
2198
-
2199
- var _ansiStyles = _interopRequireDefault(ansiStyles.exports);
2200
-
2201
- var _collections = collections;
2202
-
2203
- var _AsymmetricMatcher = _interopRequireDefault(
2204
- AsymmetricMatcher$3
2205
- );
2206
-
2207
- var _ConvertAnsi = _interopRequireDefault(ConvertAnsi);
2208
-
2209
- var _DOMCollection = _interopRequireDefault(DOMCollection$2);
2210
-
2211
- var _DOMElement = _interopRequireDefault(DOMElement$2);
2212
-
2213
- var _Immutable = _interopRequireDefault(Immutable$2);
2214
-
2215
- var _ReactElement = _interopRequireDefault(ReactElement$2);
2216
-
2217
- var _ReactTestComponent = _interopRequireDefault(
2218
- ReactTestComponent$2
2219
- );
2220
-
2221
- function _interopRequireDefault(obj) {
2222
- return obj && obj.__esModule ? obj : {default: obj};
2223
- }
2224
-
2225
- /**
2226
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2227
- *
2228
- * This source code is licensed under the MIT license found in the
2229
- * LICENSE file in the root directory of this source tree.
2230
- */
2231
-
2232
- /* eslint-disable local/ban-types-eventually */
2233
- const toString = Object.prototype.toString;
2234
- const toISOString = Date.prototype.toISOString;
2235
- const errorToString = Error.prototype.toString;
2236
- const regExpToString = RegExp.prototype.toString;
2237
- /**
2238
- * Explicitly comparing typeof constructor to function avoids undefined as name
2239
- * when mock identity-obj-proxy returns the key as the value for any key.
2240
- */
2241
-
2242
- const getConstructorName = val =>
2243
- (typeof val.constructor === 'function' && val.constructor.name) || 'Object';
2244
- /* global window */
2245
-
2246
- /** Is val is equal to global window object? Works even if it does not exist :) */
2247
-
2248
- const isWindow = val => typeof window !== 'undefined' && val === window;
2249
-
2250
- const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
2251
- const NEWLINE_REGEXP = /\n/gi;
2252
-
2253
- class PrettyFormatPluginError extends Error {
2254
- constructor(message, stack) {
2255
- super(message);
2256
- this.stack = stack;
2257
- this.name = this.constructor.name;
2258
- }
2259
- }
2260
-
2261
- function isToStringedArrayType(toStringed) {
2262
- return (
2263
- toStringed === '[object Array]' ||
2264
- toStringed === '[object ArrayBuffer]' ||
2265
- toStringed === '[object DataView]' ||
2266
- toStringed === '[object Float32Array]' ||
2267
- toStringed === '[object Float64Array]' ||
2268
- toStringed === '[object Int8Array]' ||
2269
- toStringed === '[object Int16Array]' ||
2270
- toStringed === '[object Int32Array]' ||
2271
- toStringed === '[object Uint8Array]' ||
2272
- toStringed === '[object Uint8ClampedArray]' ||
2273
- toStringed === '[object Uint16Array]' ||
2274
- toStringed === '[object Uint32Array]'
2275
- );
2276
- }
2277
-
2278
- function printNumber(val) {
2279
- return Object.is(val, -0) ? '-0' : String(val);
2280
- }
2281
-
2282
- function printBigInt(val) {
2283
- return String(`${val}n`);
2284
- }
2285
-
2286
- function printFunction(val, printFunctionName) {
2287
- if (!printFunctionName) {
2288
- return '[Function]';
2289
- }
2290
-
2291
- return '[Function ' + (val.name || 'anonymous') + ']';
2292
- }
2293
-
2294
- function printSymbol(val) {
2295
- return String(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
2296
- }
2297
-
2298
- function printError(val) {
2299
- return '[' + errorToString.call(val) + ']';
2300
- }
2301
- /**
2302
- * The first port of call for printing an object, handles most of the
2303
- * data-types in JS.
2304
- */
2305
-
2306
- function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
2307
- if (val === true || val === false) {
2308
- return '' + val;
2309
- }
2310
-
2311
- if (val === undefined) {
2312
- return 'undefined';
2313
- }
2314
-
2315
- if (val === null) {
2316
- return 'null';
2317
- }
2318
-
2319
- const typeOf = typeof val;
2320
-
2321
- if (typeOf === 'number') {
2322
- return printNumber(val);
2323
- }
2324
-
2325
- if (typeOf === 'bigint') {
2326
- return printBigInt(val);
2327
- }
2328
-
2329
- if (typeOf === 'string') {
2330
- if (escapeString) {
2331
- return '"' + val.replace(/"|\\/g, '\\$&') + '"';
2332
- }
2333
-
2334
- return '"' + val + '"';
2335
- }
2336
-
2337
- if (typeOf === 'function') {
2338
- return printFunction(val, printFunctionName);
2339
- }
2340
-
2341
- if (typeOf === 'symbol') {
2342
- return printSymbol(val);
2343
- }
2344
-
2345
- const toStringed = toString.call(val);
2346
-
2347
- if (toStringed === '[object WeakMap]') {
2348
- return 'WeakMap {}';
2349
- }
2350
-
2351
- if (toStringed === '[object WeakSet]') {
2352
- return 'WeakSet {}';
2353
- }
2354
-
2355
- if (
2356
- toStringed === '[object Function]' ||
2357
- toStringed === '[object GeneratorFunction]'
2358
- ) {
2359
- return printFunction(val, printFunctionName);
2360
- }
2361
-
2362
- if (toStringed === '[object Symbol]') {
2363
- return printSymbol(val);
2364
- }
2365
-
2366
- if (toStringed === '[object Date]') {
2367
- return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
2368
- }
2369
-
2370
- if (toStringed === '[object Error]') {
2371
- return printError(val);
2372
- }
2373
-
2374
- if (toStringed === '[object RegExp]') {
2375
- if (escapeRegex) {
2376
- // https://github.com/benjamingr/RegExp.escape/blob/main/polyfill.js
2377
- return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
2378
- }
2379
-
2380
- return regExpToString.call(val);
2381
- }
2382
-
2383
- if (val instanceof Error) {
2384
- return printError(val);
2385
- }
2386
-
2387
- return null;
2388
- }
2389
- /**
2390
- * Handles more complex objects ( such as objects with circular references.
2391
- * maps and sets etc )
2392
- */
2393
-
2394
- function printComplexValue(
2395
- val,
2396
- config,
2397
- indentation,
2398
- depth,
2399
- refs,
2400
- hasCalledToJSON
2401
- ) {
2402
- if (refs.indexOf(val) !== -1) {
2403
- return '[Circular]';
2404
- }
2405
-
2406
- refs = refs.slice();
2407
- refs.push(val);
2408
- const hitMaxDepth = ++depth > config.maxDepth;
2409
- const min = config.min;
2410
-
2411
- if (
2412
- config.callToJSON &&
2413
- !hitMaxDepth &&
2414
- val.toJSON &&
2415
- typeof val.toJSON === 'function' &&
2416
- !hasCalledToJSON
2417
- ) {
2418
- return printer(val.toJSON(), config, indentation, depth, refs, true);
2419
- }
2420
-
2421
- const toStringed = toString.call(val);
2422
-
2423
- if (toStringed === '[object Arguments]') {
2424
- return hitMaxDepth
2425
- ? '[Arguments]'
2426
- : (min ? '' : 'Arguments ') +
2427
- '[' +
2428
- (0, _collections.printListItems)(
2429
- val,
2430
- config,
2431
- indentation,
2432
- depth,
2433
- refs,
2434
- printer
2435
- ) +
2436
- ']';
2437
- }
2438
-
2439
- if (isToStringedArrayType(toStringed)) {
2440
- return hitMaxDepth
2441
- ? '[' + val.constructor.name + ']'
2442
- : (min
2443
- ? ''
2444
- : !config.printBasicPrototype && val.constructor.name === 'Array'
2445
- ? ''
2446
- : val.constructor.name + ' ') +
2447
- '[' +
2448
- (0, _collections.printListItems)(
2449
- val,
2450
- config,
2451
- indentation,
2452
- depth,
2453
- refs,
2454
- printer
2455
- ) +
2456
- ']';
2457
- }
2458
-
2459
- if (toStringed === '[object Map]') {
2460
- return hitMaxDepth
2461
- ? '[Map]'
2462
- : 'Map {' +
2463
- (0, _collections.printIteratorEntries)(
2464
- val.entries(),
2465
- config,
2466
- indentation,
2467
- depth,
2468
- refs,
2469
- printer,
2470
- ' => '
2471
- ) +
2472
- '}';
2473
- }
2474
-
2475
- if (toStringed === '[object Set]') {
2476
- return hitMaxDepth
2477
- ? '[Set]'
2478
- : 'Set {' +
2479
- (0, _collections.printIteratorValues)(
2480
- val.values(),
2481
- config,
2482
- indentation,
2483
- depth,
2484
- refs,
2485
- printer
2486
- ) +
2487
- '}';
2488
- } // Avoid failure to serialize global window object in jsdom test environment.
2489
- // For example, not even relevant if window is prop of React element.
2490
-
2491
- return hitMaxDepth || isWindow(val)
2492
- ? '[' + getConstructorName(val) + ']'
2493
- : (min
2494
- ? ''
2495
- : !config.printBasicPrototype && getConstructorName(val) === 'Object'
2496
- ? ''
2497
- : getConstructorName(val) + ' ') +
2498
- '{' +
2499
- (0, _collections.printObjectProperties)(
2500
- val,
2501
- config,
2502
- indentation,
2503
- depth,
2504
- refs,
2505
- printer
2506
- ) +
2507
- '}';
2508
- }
2509
-
2510
- function isNewPlugin(plugin) {
2511
- return plugin.serialize != null;
2512
- }
2513
-
2514
- function printPlugin(plugin, val, config, indentation, depth, refs) {
2515
- let printed;
2516
-
2517
- try {
2518
- printed = isNewPlugin(plugin)
2519
- ? plugin.serialize(val, config, indentation, depth, refs, printer)
2520
- : plugin.print(
2521
- val,
2522
- valChild => printer(valChild, config, indentation, depth, refs),
2523
- str => {
2524
- const indentationNext = indentation + config.indent;
2525
- return (
2526
- indentationNext +
2527
- str.replace(NEWLINE_REGEXP, '\n' + indentationNext)
2528
- );
2529
- },
2530
- {
2531
- edgeSpacing: config.spacingOuter,
2532
- min: config.min,
2533
- spacing: config.spacingInner
2534
- },
2535
- config.colors
2536
- );
2537
- } catch (error) {
2538
- throw new PrettyFormatPluginError(error.message, error.stack);
2539
- }
2540
-
2541
- if (typeof printed !== 'string') {
2542
- throw new Error(
2543
- `pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`
2544
- );
2545
- }
2546
-
2547
- return printed;
2548
- }
2549
-
2550
- function findPlugin(plugins, val) {
2551
- for (let p = 0; p < plugins.length; p++) {
2552
- try {
2553
- if (plugins[p].test(val)) {
2554
- return plugins[p];
2555
- }
2556
- } catch (error) {
2557
- throw new PrettyFormatPluginError(error.message, error.stack);
2558
- }
2559
- }
2560
-
2561
- return null;
2562
- }
2563
-
2564
- function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
2565
- const plugin = findPlugin(config.plugins, val);
2566
-
2567
- if (plugin !== null) {
2568
- return printPlugin(plugin, val, config, indentation, depth, refs);
2569
- }
2570
-
2571
- const basicResult = printBasicValue(
2572
- val,
2573
- config.printFunctionName,
2574
- config.escapeRegex,
2575
- config.escapeString
2576
- );
2577
-
2578
- if (basicResult !== null) {
2579
- return basicResult;
2580
- }
2581
-
2582
- return printComplexValue(
2583
- val,
2584
- config,
2585
- indentation,
2586
- depth,
2587
- refs,
2588
- hasCalledToJSON
2589
- );
2590
- }
2591
-
2592
- const DEFAULT_THEME = {
2593
- comment: 'gray',
2594
- content: 'reset',
2595
- prop: 'yellow',
2596
- tag: 'cyan',
2597
- value: 'green'
2598
- };
2599
- const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
2600
- const DEFAULT_OPTIONS = {
2601
- callToJSON: true,
2602
- compareKeys: undefined,
2603
- escapeRegex: false,
2604
- escapeString: true,
2605
- highlight: false,
2606
- indent: 2,
2607
- maxDepth: Infinity,
2608
- min: false,
2609
- plugins: [],
2610
- printBasicPrototype: true,
2611
- printFunctionName: true,
2612
- theme: DEFAULT_THEME
2613
- };
2614
- build.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
2615
-
2616
- function validateOptions(options) {
2617
- Object.keys(options).forEach(key => {
2618
- if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
2619
- throw new Error(`pretty-format: Unknown option "${key}".`);
2620
- }
2621
- });
2622
-
2623
- if (options.min && options.indent !== undefined && options.indent !== 0) {
2624
- throw new Error(
2625
- 'pretty-format: Options "min" and "indent" cannot be used together.'
2626
- );
2627
- }
2628
-
2629
- if (options.theme !== undefined) {
2630
- if (options.theme === null) {
2631
- throw new Error(`pretty-format: Option "theme" must not be null.`);
2632
- }
2633
-
2634
- if (typeof options.theme !== 'object') {
2635
- throw new Error(
2636
- `pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`
2637
- );
2638
- }
2639
- }
2640
- }
2641
-
2642
- const getColorsHighlight = options =>
2643
- DEFAULT_THEME_KEYS.reduce((colors, key) => {
2644
- const value =
2645
- options.theme && options.theme[key] !== undefined
2646
- ? options.theme[key]
2647
- : DEFAULT_THEME[key];
2648
- const color = value && _ansiStyles.default[value];
2649
-
2650
- if (
2651
- color &&
2652
- typeof color.close === 'string' &&
2653
- typeof color.open === 'string'
2654
- ) {
2655
- colors[key] = color;
2656
- } else {
2657
- throw new Error(
2658
- `pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`
2659
- );
2660
- }
2661
-
2662
- return colors;
2663
- }, Object.create(null));
2664
-
2665
- const getColorsEmpty = () =>
2666
- DEFAULT_THEME_KEYS.reduce((colors, key) => {
2667
- colors[key] = {
2668
- close: '',
2669
- open: ''
2670
- };
2671
- return colors;
2672
- }, Object.create(null));
2673
-
2674
- const getPrintFunctionName = options =>
2675
- options && options.printFunctionName !== undefined
2676
- ? options.printFunctionName
2677
- : DEFAULT_OPTIONS.printFunctionName;
2678
-
2679
- const getEscapeRegex = options =>
2680
- options && options.escapeRegex !== undefined
2681
- ? options.escapeRegex
2682
- : DEFAULT_OPTIONS.escapeRegex;
2683
-
2684
- const getEscapeString = options =>
2685
- options && options.escapeString !== undefined
2686
- ? options.escapeString
2687
- : DEFAULT_OPTIONS.escapeString;
2688
-
2689
- const getConfig = options => {
2690
- var _options$printBasicPr;
2691
-
2692
- return {
2693
- callToJSON:
2694
- options && options.callToJSON !== undefined
2695
- ? options.callToJSON
2696
- : DEFAULT_OPTIONS.callToJSON,
2697
- colors:
2698
- options && options.highlight
2699
- ? getColorsHighlight(options)
2700
- : getColorsEmpty(),
2701
- compareKeys:
2702
- options && typeof options.compareKeys === 'function'
2703
- ? options.compareKeys
2704
- : DEFAULT_OPTIONS.compareKeys,
2705
- escapeRegex: getEscapeRegex(options),
2706
- escapeString: getEscapeString(options),
2707
- indent:
2708
- options && options.min
2709
- ? ''
2710
- : createIndent(
2711
- options && options.indent !== undefined
2712
- ? options.indent
2713
- : DEFAULT_OPTIONS.indent
2714
- ),
2715
- maxDepth:
2716
- options && options.maxDepth !== undefined
2717
- ? options.maxDepth
2718
- : DEFAULT_OPTIONS.maxDepth,
2719
- min:
2720
- options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
2721
- plugins:
2722
- options && options.plugins !== undefined
2723
- ? options.plugins
2724
- : DEFAULT_OPTIONS.plugins,
2725
- printBasicPrototype:
2726
- (_options$printBasicPr =
2727
- options === null || options === void 0
2728
- ? void 0
2729
- : options.printBasicPrototype) !== null &&
2730
- _options$printBasicPr !== void 0
2731
- ? _options$printBasicPr
2732
- : true,
2733
- printFunctionName: getPrintFunctionName(options),
2734
- spacingInner: options && options.min ? ' ' : '\n',
2735
- spacingOuter: options && options.min ? '' : '\n'
2736
- };
2737
- };
2738
-
2739
- function createIndent(indent) {
2740
- return new Array(indent + 1).join(' ');
2741
- }
2742
- /**
2743
- * Returns a presentation string of your `val` object
2744
- * @param val any potential JavaScript object
2745
- * @param options Custom settings
2746
- */
2747
-
2748
- function format(val, options) {
2749
- if (options) {
2750
- validateOptions(options);
2751
-
2752
- if (options.plugins) {
2753
- const plugin = findPlugin(options.plugins, val);
2754
-
2755
- if (plugin !== null) {
2756
- return printPlugin(plugin, val, getConfig(options), '', 0, []);
2757
- }
2758
- }
2759
- }
2760
-
2761
- const basicResult = printBasicValue(
2762
- val,
2763
- getPrintFunctionName(options),
2764
- getEscapeRegex(options),
2765
- getEscapeString(options)
2766
- );
2767
-
2768
- if (basicResult !== null) {
2769
- return basicResult;
2770
- }
2771
-
2772
- return printComplexValue(val, getConfig(options), '', 0, []);
2773
- }
2774
-
2775
- const plugins = {
2776
- AsymmetricMatcher: _AsymmetricMatcher.default,
2777
- ConvertAnsi: _ConvertAnsi.default,
2778
- DOMCollection: _DOMCollection.default,
2779
- DOMElement: _DOMElement.default,
2780
- Immutable: _Immutable.default,
2781
- ReactElement: _ReactElement.default,
2782
- ReactTestComponent: _ReactTestComponent.default
2783
- };
2784
- var plugins_1 = build.plugins = plugins;
2785
- var _default = format;
2786
- build.default = _default;
2787
-
2788
- const {
2789
- DOMCollection: DOMCollection$1,
2790
- DOMElement: DOMElement$1,
2791
- Immutable: Immutable$1,
2792
- ReactElement: ReactElement$1,
2793
- ReactTestComponent: ReactTestComponent$1,
2794
- AsymmetricMatcher: AsymmetricMatcher$2
2795
- } = plugins_1;
2796
- let PLUGINS$1 = [
2797
- ReactTestComponent$1,
2798
- ReactElement$1,
2799
- DOMElement$1,
2800
- DOMCollection$1,
2801
- Immutable$1,
2802
- AsymmetricMatcher$2
2803
- ];
2804
- const getSerializers = () => PLUGINS$1;
2805
-
2806
487
  var __defProp$2 = Object.defineProperty;
2807
488
  var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
2808
489
  var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
@@ -2907,7 +588,7 @@ class SnapshotState {
2907
588
  this._dirty = dirty;
2908
589
  this._inlineSnapshots = [];
2909
590
  this._uncheckedKeys = new Set(Object.keys(this._snapshotData));
2910
- this._counters = /* @__PURE__ */ new Map();
591
+ this._counters = new Map();
2911
592
  this._index = 0;
2912
593
  this.expand = options.expand || false;
2913
594
  this.added = 0;
@@ -2944,7 +625,7 @@ class SnapshotState {
2944
625
  }
2945
626
  clear() {
2946
627
  this._snapshotData = this._initialData;
2947
- this._counters = /* @__PURE__ */ new Map();
628
+ this._counters = new Map();
2948
629
  this._index = 0;
2949
630
  this.added = 0;
2950
631
  this.matched = 0;
@@ -3142,6 +823,16 @@ function getSnapshotClient() {
3142
823
  _client = new SnapshotClient();
3143
824
  return _client;
3144
825
  }
826
+ const getErrorString = (expected) => {
827
+ try {
828
+ expected();
829
+ } catch (e) {
830
+ if (e instanceof Error)
831
+ return e.message;
832
+ return e;
833
+ }
834
+ throw new Error("snapshot function didn't threw");
835
+ };
3145
836
  const SnapshotPlugin = (chai, utils) => {
3146
837
  for (const key of ["matchSnapshot", "toMatchSnapshot"]) {
3147
838
  utils.addMethod(chai.Assertion.prototype, key, function(message) {
@@ -3153,13 +844,21 @@ const SnapshotPlugin = (chai, utils) => {
3153
844
  const expected = utils.flag(this, "object");
3154
845
  getSnapshotClient().assert(expected, message, true, inlineSnapshot);
3155
846
  });
847
+ utils.addMethod(chai.Assertion.prototype, "toThrowErrorMatchingSnapshot", function(message) {
848
+ const expected = utils.flag(this, "object");
849
+ getSnapshotClient().assert(getErrorString(expected), message);
850
+ });
851
+ utils.addMethod(chai.Assertion.prototype, "toThrowErrorMatchingInlineSnapshot", function(inlineSnapshot, message) {
852
+ const expected = utils.flag(this, "object");
853
+ getSnapshotClient().assert(getErrorString(expected), message, true, inlineSnapshot);
854
+ });
3156
855
  };
3157
856
 
3158
- const EXPECTED_COLOR = c$1.green;
3159
- const RECEIVED_COLOR = c$1.red;
3160
- const INVERTED_COLOR = c$1.inverse;
3161
- const BOLD_WEIGHT = c$1.bold;
3162
- const DIM_COLOR = c$1.dim;
857
+ const EXPECTED_COLOR = c.green;
858
+ const RECEIVED_COLOR = c.red;
859
+ const INVERTED_COLOR = c.inverse;
860
+ const BOLD_WEIGHT = c.bold;
861
+ const DIM_COLOR = c.dim;
3163
862
  const {
3164
863
  AsymmetricMatcher: AsymmetricMatcher$1,
3165
864
  DOMCollection,
@@ -3283,18 +982,19 @@ const isAsyncFunction = (fn) => typeof fn === "function" && fn[Symbol.toStringTa
3283
982
  const getMatcherState = (assertion) => {
3284
983
  const actual = assertion._obj;
3285
984
  const isNot = util.flag(assertion, "negate");
985
+ const promise = util.flag(assertion, "promise") || "";
3286
986
  const jestUtils = __spreadProps(__spreadValues({}, matcherUtils), {
3287
987
  iterableEquality,
3288
988
  subsetEquality
3289
989
  });
3290
- const matcherState = {
990
+ const matcherState = __spreadProps(__spreadValues({
3291
991
  isNot,
3292
992
  utils: jestUtils,
3293
- assertionCalls: 0,
3294
- promise: "",
3295
- equals,
993
+ promise,
994
+ equals
995
+ }, getState()), {
3296
996
  suppressedErrors: []
3297
- };
997
+ });
3298
998
  return {
3299
999
  state: matcherState,
3300
1000
  isNot,
@@ -3494,22 +1194,18 @@ class StringMatching extends AsymmetricMatcher {
3494
1194
  }
3495
1195
  }
3496
1196
  const JestAsymmetricMatchers = (chai, utils) => {
1197
+ utils.addMethod(chai.expect, "anything", () => new Anything());
1198
+ utils.addMethod(chai.expect, "any", (expected) => new Any(expected));
3497
1199
  utils.addMethod(chai.expect, "stringContaining", (expected) => new StringContaining(expected));
3498
- utils.addMethod(chai.expect, "anything", () => {
3499
- return new Anything();
3500
- });
3501
- utils.addMethod(chai.expect, "objectContaining", (expected) => {
3502
- return new ObjectContaining(expected);
3503
- });
3504
- utils.addMethod(chai.expect, "any", (expected) => {
3505
- return new Any(expected);
3506
- });
3507
- utils.addMethod(chai.expect, "arrayContaining", (expected) => {
3508
- return new ArrayContaining(expected);
3509
- });
3510
- utils.addMethod(chai.expect, "stringMatching", (expected) => {
3511
- return new StringMatching(expected);
3512
- });
1200
+ utils.addMethod(chai.expect, "objectContaining", (expected) => new ObjectContaining(expected));
1201
+ utils.addMethod(chai.expect, "arrayContaining", (expected) => new ArrayContaining(expected));
1202
+ utils.addMethod(chai.expect, "stringMatching", (expected) => new StringMatching(expected));
1203
+ chai.expect.not = {
1204
+ stringContaining: (expected) => new StringContaining(expected, true),
1205
+ objectContaining: (expected) => new ObjectContaining(expected, true),
1206
+ arrayContaining: (expected) => new ArrayContaining(expected, true),
1207
+ stringMatching: (expected) => new StringMatching(expected, true)
1208
+ };
3513
1209
  };
3514
1210
 
3515
1211
  let installed = false;
@@ -3532,7 +1228,7 @@ async function setupGlobalEnv(config) {
3532
1228
  setupConsoleLogSpy();
3533
1229
  await setupChai();
3534
1230
  if (config.global)
3535
- (await import('./global-8f03a13e.js')).registerApiGlobally();
1231
+ (await import('./global-f9288768.js')).registerApiGlobally();
3536
1232
  }
3537
1233
  function setupConsoleLogSpy() {
3538
1234
  const stdout = new Writable({
@@ -3580,7 +1276,7 @@ async function runSetupFiles(config) {
3580
1276
  }));
3581
1277
  }
3582
1278
 
3583
- function serializeError(val, seen = /* @__PURE__ */ new WeakSet()) {
1279
+ function serializeError(val, seen = new WeakSet()) {
3584
1280
  if (!val || typeof val === "string")
3585
1281
  return val;
3586
1282
  if (typeof val === "function")
@@ -3592,7 +1288,7 @@ function serializeError(val, seen = /* @__PURE__ */ new WeakSet()) {
3592
1288
  if (typeof Element !== "undefined" && val instanceof Element)
3593
1289
  return val.tagName;
3594
1290
  if (typeof val.asymmetricMatch === "function")
3595
- return `${val.toString()} ${format$1(val.sample)}`;
1291
+ return `${val.toString()} ${format(val.sample)}`;
3596
1292
  if (seen.has(val))
3597
1293
  return val;
3598
1294
  seen.add(val);
@@ -3624,6 +1320,9 @@ function processError(err) {
3624
1320
  function hash(str, length = 10) {
3625
1321
  return createHash("md5").update(str).digest("hex").slice(0, length);
3626
1322
  }
1323
+ function inModuleGraph(files) {
1324
+ return files.some((file) => process.__vitest_worker__.moduleCache.has(file));
1325
+ }
3627
1326
  async function collectTests(paths, config) {
3628
1327
  const files = [];
3629
1328
  for (const filepath of paths) {
@@ -3633,7 +1332,6 @@ async function collectTests(paths, config) {
3633
1332
  name: path,
3634
1333
  type: "suite",
3635
1334
  mode: "run",
3636
- computeMode: "serial",
3637
1335
  filepath,
3638
1336
  tasks: []
3639
1337
  };
@@ -3641,6 +1339,8 @@ async function collectTests(paths, config) {
3641
1339
  try {
3642
1340
  await runSetupFiles(config);
3643
1341
  await import(filepath);
1342
+ if (config.findRelatedTests && !inModuleGraph(config.findRelatedTests))
1343
+ continue;
3644
1344
  const defaultTasks = await defaultSuite.collect(file);
3645
1345
  setHooks(file, getHooks(defaultTasks));
3646
1346
  for (const c of [...defaultTasks.tasks, ...context.tasks]) {
@@ -3649,14 +1349,15 @@ async function collectTests(paths, config) {
3649
1349
  } else if (c.type === "suite") {
3650
1350
  file.tasks.push(c);
3651
1351
  } else {
1352
+ const start = performance.now();
3652
1353
  const suite = await c.collect(file);
1354
+ file.collectDuration = performance.now() - start;
3653
1355
  if (suite.name || suite.tasks.length)
3654
1356
  file.tasks.push(suite);
3655
1357
  }
3656
1358
  }
3657
1359
  } catch (e) {
3658
1360
  file.result = {
3659
- start: performance.now(),
3660
1361
  state: "fail",
3661
1362
  error: processError(e)
3662
1363
  };
@@ -3745,8 +1446,8 @@ async function sendTasksUpdate() {
3745
1446
  async function runTest(test) {
3746
1447
  if (test.mode !== "run")
3747
1448
  return;
1449
+ const start = performance$1.now();
3748
1450
  test.result = {
3749
- start: performance.now(),
3750
1451
  state: "run"
3751
1452
  };
3752
1453
  updateTask(test);
@@ -3755,11 +1456,19 @@ async function runTest(test) {
3755
1456
  process.__vitest_worker__.current = test;
3756
1457
  try {
3757
1458
  await callSuiteHook(test.suite, "beforeEach", [test, test.suite]);
3758
- setState({ assertionCalls: 0, expectedAssertionsNumber: null, expectedAssertionsNumberError: null });
1459
+ setState({
1460
+ assertionCalls: 0,
1461
+ isExpectingAssertions: false,
1462
+ isExpectingAssertionsError: null,
1463
+ expectedAssertionsNumber: null,
1464
+ expectedAssertionsNumberError: null
1465
+ });
3759
1466
  await getFn(test)();
3760
- const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberError } = getState();
1467
+ const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberError, isExpectingAssertions, isExpectingAssertionsError } = getState();
3761
1468
  if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber)
3762
1469
  throw expectedAssertionsNumberError;
1470
+ if (isExpectingAssertions === true && assertionCalls === 0)
1471
+ throw isExpectingAssertionsError;
3763
1472
  test.result.state = "pass";
3764
1473
  } catch (e) {
3765
1474
  test.result.state = "fail";
@@ -3781,7 +1490,7 @@ async function runTest(test) {
3781
1490
  }
3782
1491
  }
3783
1492
  getSnapshotClient().clearTest();
3784
- test.result.end = performance.now();
1493
+ test.result.duration = performance$1.now() - start;
3785
1494
  process.__vitest_worker__.current = void 0;
3786
1495
  updateTask(test);
3787
1496
  }
@@ -3789,8 +1498,8 @@ async function runSuite(suite) {
3789
1498
  var _a;
3790
1499
  if (((_a = suite.result) == null ? void 0 : _a.state) === "fail")
3791
1500
  return;
1501
+ const start = performance$1.now();
3792
1502
  suite.result = {
3793
- start: performance.now(),
3794
1503
  state: "run"
3795
1504
  };
3796
1505
  updateTask(suite);
@@ -3802,12 +1511,11 @@ async function runSuite(suite) {
3802
1511
  try {
3803
1512
  await callSuiteHook(suite, "beforeAll", [suite]);
3804
1513
  for (const tasksGroup of partitionSuiteChildren(suite)) {
3805
- const computeMode = tasksGroup[0].computeMode;
3806
- if (computeMode === "serial") {
1514
+ if (tasksGroup[0].concurrent === true) {
1515
+ await Promise.all(tasksGroup.map((c) => runSuiteChild(c)));
1516
+ } else {
3807
1517
  for (const c of tasksGroup)
3808
1518
  await runSuiteChild(c);
3809
- } else if (computeMode === "concurrent") {
3810
- await Promise.all(tasksGroup.map((c) => runSuiteChild(c)));
3811
1519
  }
3812
1520
  }
3813
1521
  await callSuiteHook(suite, "afterAll", [suite]);
@@ -3816,7 +1524,7 @@ async function runSuite(suite) {
3816
1524
  suite.result.error = processError(e);
3817
1525
  }
3818
1526
  }
3819
- suite.result.end = performance.now();
1527
+ suite.result.duration = performance$1.now() - start;
3820
1528
  if (suite.mode === "run") {
3821
1529
  if (!hasTests(suite)) {
3822
1530
  suite.result.state = "fail";