vitest 0.0.70 → 0.0.74

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,13 +1,18 @@
1
+ import { Console } from 'console';
2
+ import { Writable } from 'stream';
1
3
  import { importModule } from 'local-pkg';
2
- import chai, { expect } from 'chai';
4
+ import chai, { expect, util } from 'chai';
3
5
  import SinonChai from 'sinon-chai';
4
6
  import Subset from 'chai-subset';
5
7
  import path, { basename } from 'path';
6
8
  import { g as getNames, i as interpretOnlyMode, p as partitionSuiteChildren, c as hasTests, h as hasFailed } from './utils-9dcc4050.js';
7
9
  import fs from 'fs';
10
+ import { d as c$1, m as generateDiff } from './error-48107470.js';
8
11
  import { performance } from 'perf_hooks';
9
12
  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
13
  import { n as nanoid } from './index-6427e0f2.js';
14
+ import 'tty';
15
+ import 'source-map';
11
16
 
12
17
  var node = {
13
18
  name: "node",
@@ -702,12 +707,12 @@ function printObjectProperties(val, config, indentation, depth, refs, printer) {
702
707
  return result;
703
708
  }
704
709
 
705
- var AsymmetricMatcher$1 = {};
710
+ var AsymmetricMatcher$2 = {};
706
711
 
707
- Object.defineProperty(AsymmetricMatcher$1, '__esModule', {
712
+ Object.defineProperty(AsymmetricMatcher$2, '__esModule', {
708
713
  value: true
709
714
  });
710
- AsymmetricMatcher$1.default = AsymmetricMatcher$1.test = AsymmetricMatcher$1.serialize = void 0;
715
+ AsymmetricMatcher$2.default = AsymmetricMatcher$2.test = AsymmetricMatcher$2.serialize = void 0;
711
716
 
712
717
  var _collections$3 = collections;
713
718
 
@@ -808,17 +813,17 @@ const serialize$7 = (val, config, indentation, depth, refs, printer) => {
808
813
  return val.toAsymmetricMatcher();
809
814
  };
810
815
 
811
- AsymmetricMatcher$1.serialize = serialize$7;
816
+ AsymmetricMatcher$2.serialize = serialize$7;
812
817
 
813
818
  const test$6 = val => val && val.$$typeof === asymmetricMatcher;
814
819
 
815
- AsymmetricMatcher$1.test = test$6;
820
+ AsymmetricMatcher$2.test = test$6;
816
821
  const plugin$6 = {
817
822
  serialize: serialize$7,
818
823
  test: test$6
819
824
  };
820
825
  var _default$7 = plugin$6;
821
- AsymmetricMatcher$1.default = _default$7;
826
+ AsymmetricMatcher$2.default = _default$7;
822
827
 
823
828
  var ConvertAnsi = {};
824
829
 
@@ -926,12 +931,12 @@ const plugin$5 = {
926
931
  var _default$6 = plugin$5;
927
932
  ConvertAnsi.default = _default$6;
928
933
 
929
- var DOMCollection$1 = {};
934
+ var DOMCollection$2 = {};
930
935
 
931
- Object.defineProperty(DOMCollection$1, '__esModule', {
936
+ Object.defineProperty(DOMCollection$2, '__esModule', {
932
937
  value: true
933
938
  });
934
- DOMCollection$1.default = DOMCollection$1.serialize = DOMCollection$1.test = void 0;
939
+ DOMCollection$2.default = DOMCollection$2.serialize = DOMCollection$2.test = void 0;
935
940
 
936
941
  var _collections$2 = collections;
937
942
 
@@ -956,7 +961,7 @@ const test$4 = val =>
956
961
  !!val.constructor.name &&
957
962
  testName(val.constructor.name);
958
963
 
959
- DOMCollection$1.test = test$4;
964
+ DOMCollection$2.test = test$4;
960
965
 
961
966
  const isNamedNodeMap = collection =>
962
967
  collection.constructor.name === 'NamedNodeMap';
@@ -999,15 +1004,15 @@ const serialize$5 = (collection, config, indentation, depth, refs, printer) => {
999
1004
  );
1000
1005
  };
1001
1006
 
1002
- DOMCollection$1.serialize = serialize$5;
1007
+ DOMCollection$2.serialize = serialize$5;
1003
1008
  const plugin$4 = {
1004
1009
  serialize: serialize$5,
1005
1010
  test: test$4
1006
1011
  };
1007
1012
  var _default$5 = plugin$4;
1008
- DOMCollection$1.default = _default$5;
1013
+ DOMCollection$2.default = _default$5;
1009
1014
 
1010
- var DOMElement$1 = {};
1015
+ var DOMElement$2 = {};
1011
1016
 
1012
1017
  var markup = {};
1013
1018
 
@@ -1180,10 +1185,10 @@ const printElementAsLeaf = (type, config) => {
1180
1185
 
1181
1186
  markup.printElementAsLeaf = printElementAsLeaf;
1182
1187
 
1183
- Object.defineProperty(DOMElement$1, '__esModule', {
1188
+ Object.defineProperty(DOMElement$2, '__esModule', {
1184
1189
  value: true
1185
1190
  });
1186
- DOMElement$1.default = DOMElement$1.serialize = DOMElement$1.test = void 0;
1191
+ DOMElement$2.default = DOMElement$2.serialize = DOMElement$2.test = void 0;
1187
1192
 
1188
1193
  var _markup$2 = markup;
1189
1194
 
@@ -1235,7 +1240,7 @@ const test$3 = val => {
1235
1240
  );
1236
1241
  };
1237
1242
 
1238
- DOMElement$1.test = test$3;
1243
+ DOMElement$2.test = test$3;
1239
1244
 
1240
1245
  function nodeIsText(node) {
1241
1246
  return node.nodeType === TEXT_NODE;
@@ -1299,20 +1304,20 @@ const serialize$4 = (node, config, indentation, depth, refs, printer) => {
1299
1304
  );
1300
1305
  };
1301
1306
 
1302
- DOMElement$1.serialize = serialize$4;
1307
+ DOMElement$2.serialize = serialize$4;
1303
1308
  const plugin$3 = {
1304
1309
  serialize: serialize$4,
1305
1310
  test: test$3
1306
1311
  };
1307
1312
  var _default$4 = plugin$3;
1308
- DOMElement$1.default = _default$4;
1313
+ DOMElement$2.default = _default$4;
1309
1314
 
1310
- var Immutable$1 = {};
1315
+ var Immutable$2 = {};
1311
1316
 
1312
- Object.defineProperty(Immutable$1, '__esModule', {
1317
+ Object.defineProperty(Immutable$2, '__esModule', {
1313
1318
  value: true
1314
1319
  });
1315
- Immutable$1.default = Immutable$1.test = Immutable$1.serialize = void 0;
1320
+ Immutable$2.default = Immutable$2.test = Immutable$2.serialize = void 0;
1316
1321
 
1317
1322
  var _collections$1 = collections;
1318
1323
 
@@ -1325,13 +1330,13 @@ var _collections$1 = collections;
1325
1330
  // SENTINEL constants are from https://github.com/facebook/immutable-js
1326
1331
  const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
1327
1332
  const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
1328
- const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
1333
+ const IS_KEYED_SENTINEL$1 = '@@__IMMUTABLE_KEYED__@@';
1329
1334
  const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
1330
- const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
1335
+ const IS_ORDERED_SENTINEL$1 = '@@__IMMUTABLE_ORDERED__@@';
1331
1336
  const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
1332
1337
 
1333
1338
  const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
1334
- const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
1339
+ const IS_SET_SENTINEL$1 = '@@__IMMUTABLE_SET__@@';
1335
1340
  const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
1336
1341
 
1337
1342
  const getImmutableName = name => 'Immutable.' + name;
@@ -1420,7 +1425,7 @@ const printImmutableSeq = (val, config, indentation, depth, refs, printer) => {
1420
1425
  return printAsLeaf(name);
1421
1426
  }
1422
1427
 
1423
- if (val[IS_KEYED_SENTINEL]) {
1428
+ if (val[IS_KEYED_SENTINEL$1]) {
1424
1429
  return (
1425
1430
  name +
1426
1431
  SPACE +
@@ -1493,7 +1498,7 @@ const serialize$3 = (val, config, indentation, depth, refs, printer) => {
1493
1498
  depth,
1494
1499
  refs,
1495
1500
  printer,
1496
- val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map'
1501
+ val[IS_ORDERED_SENTINEL$1] ? 'OrderedMap' : 'Map'
1497
1502
  );
1498
1503
  }
1499
1504
 
@@ -1509,7 +1514,7 @@ const serialize$3 = (val, config, indentation, depth, refs, printer) => {
1509
1514
  );
1510
1515
  }
1511
1516
 
1512
- if (val[IS_SET_SENTINEL]) {
1517
+ if (val[IS_SET_SENTINEL$1]) {
1513
1518
  return printImmutableValues(
1514
1519
  val,
1515
1520
  config,
@@ -1517,7 +1522,7 @@ const serialize$3 = (val, config, indentation, depth, refs, printer) => {
1517
1522
  depth,
1518
1523
  refs,
1519
1524
  printer,
1520
- val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set'
1525
+ val[IS_ORDERED_SENTINEL$1] ? 'OrderedSet' : 'Set'
1521
1526
  );
1522
1527
  }
1523
1528
 
@@ -1541,21 +1546,21 @@ const serialize$3 = (val, config, indentation, depth, refs, printer) => {
1541
1546
  }; // Explicitly comparing sentinel properties to true avoids false positive
1542
1547
  // when mock identity-obj-proxy returns the key as the value for any key.
1543
1548
 
1544
- Immutable$1.serialize = serialize$3;
1549
+ Immutable$2.serialize = serialize$3;
1545
1550
 
1546
1551
  const test$2 = val =>
1547
1552
  val &&
1548
1553
  (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
1549
1554
 
1550
- Immutable$1.test = test$2;
1555
+ Immutable$2.test = test$2;
1551
1556
  const plugin$2 = {
1552
1557
  serialize: serialize$3,
1553
1558
  test: test$2
1554
1559
  };
1555
1560
  var _default$3 = plugin$2;
1556
- Immutable$1.default = _default$3;
1561
+ Immutable$2.default = _default$3;
1557
1562
 
1558
- var ReactElement$1 = {};
1563
+ var ReactElement$2 = {};
1559
1564
 
1560
1565
  var reactIs = {exports: {}};
1561
1566
 
@@ -1805,10 +1810,10 @@ if (process.env.NODE_ENV === 'production') {
1805
1810
  reactIs.exports = reactIs_development;
1806
1811
  }
1807
1812
 
1808
- Object.defineProperty(ReactElement$1, '__esModule', {
1813
+ Object.defineProperty(ReactElement$2, '__esModule', {
1809
1814
  value: true
1810
1815
  });
1811
- ReactElement$1.default = ReactElement$1.test = ReactElement$1.serialize = void 0;
1816
+ ReactElement$2.default = ReactElement$2.test = ReactElement$2.serialize = void 0;
1812
1817
 
1813
1818
  var ReactIs = _interopRequireWildcard(reactIs.exports);
1814
1819
 
@@ -1958,24 +1963,24 @@ const serialize$2 = (element, config, indentation, depth, refs, printer) =>
1958
1963
  indentation
1959
1964
  );
1960
1965
 
1961
- ReactElement$1.serialize = serialize$2;
1966
+ ReactElement$2.serialize = serialize$2;
1962
1967
 
1963
1968
  const test$1 = val => val != null && ReactIs.isElement(val);
1964
1969
 
1965
- ReactElement$1.test = test$1;
1970
+ ReactElement$2.test = test$1;
1966
1971
  const plugin$1 = {
1967
1972
  serialize: serialize$2,
1968
1973
  test: test$1
1969
1974
  };
1970
1975
  var _default$2 = plugin$1;
1971
- ReactElement$1.default = _default$2;
1976
+ ReactElement$2.default = _default$2;
1972
1977
 
1973
- var ReactTestComponent$1 = {};
1978
+ var ReactTestComponent$2 = {};
1974
1979
 
1975
- Object.defineProperty(ReactTestComponent$1, '__esModule', {
1980
+ Object.defineProperty(ReactTestComponent$2, '__esModule', {
1976
1981
  value: true
1977
1982
  });
1978
- ReactTestComponent$1.default = ReactTestComponent$1.test = ReactTestComponent$1.serialize = void 0;
1983
+ ReactTestComponent$2.default = ReactTestComponent$2.test = ReactTestComponent$2.serialize = void 0;
1979
1984
 
1980
1985
  var _markup = markup;
1981
1986
 
@@ -2038,17 +2043,17 @@ const serialize$1 = (object, config, indentation, depth, refs, printer) =>
2038
2043
  indentation
2039
2044
  );
2040
2045
 
2041
- ReactTestComponent$1.serialize = serialize$1;
2046
+ ReactTestComponent$2.serialize = serialize$1;
2042
2047
 
2043
2048
  const test = val => val && val.$$typeof === testSymbol;
2044
2049
 
2045
- ReactTestComponent$1.test = test;
2050
+ ReactTestComponent$2.test = test;
2046
2051
  const plugin = {
2047
2052
  serialize: serialize$1,
2048
2053
  test
2049
2054
  };
2050
2055
  var _default$1 = plugin;
2051
- ReactTestComponent$1.default = _default$1;
2056
+ ReactTestComponent$2.default = _default$1;
2052
2057
 
2053
2058
  Object.defineProperty(build, '__esModule', {
2054
2059
  value: true
@@ -2061,21 +2066,21 @@ var _ansiStyles = _interopRequireDefault(ansiStyles.exports);
2061
2066
  var _collections = collections;
2062
2067
 
2063
2068
  var _AsymmetricMatcher = _interopRequireDefault(
2064
- AsymmetricMatcher$1
2069
+ AsymmetricMatcher$2
2065
2070
  );
2066
2071
 
2067
2072
  var _ConvertAnsi = _interopRequireDefault(ConvertAnsi);
2068
2073
 
2069
- var _DOMCollection = _interopRequireDefault(DOMCollection$1);
2074
+ var _DOMCollection = _interopRequireDefault(DOMCollection$2);
2070
2075
 
2071
- var _DOMElement = _interopRequireDefault(DOMElement$1);
2076
+ var _DOMElement = _interopRequireDefault(DOMElement$2);
2072
2077
 
2073
- var _Immutable = _interopRequireDefault(Immutable$1);
2078
+ var _Immutable = _interopRequireDefault(Immutable$2);
2074
2079
 
2075
- var _ReactElement = _interopRequireDefault(ReactElement$1);
2080
+ var _ReactElement = _interopRequireDefault(ReactElement$2);
2076
2081
 
2077
2082
  var _ReactTestComponent = _interopRequireDefault(
2078
- ReactTestComponent$1
2083
+ ReactTestComponent$2
2079
2084
  );
2080
2085
 
2081
2086
  function _interopRequireDefault(obj) {
@@ -2090,7 +2095,7 @@ function _interopRequireDefault(obj) {
2090
2095
  */
2091
2096
 
2092
2097
  /* eslint-disable local/ban-types-eventually */
2093
- const toString = Object.prototype.toString;
2098
+ const toString$1 = Object.prototype.toString;
2094
2099
  const toISOString = Date.prototype.toISOString;
2095
2100
  const errorToString = Error.prototype.toString;
2096
2101
  const regExpToString = RegExp.prototype.toString;
@@ -2202,7 +2207,7 @@ function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
2202
2207
  return printSymbol(val);
2203
2208
  }
2204
2209
 
2205
- const toStringed = toString.call(val);
2210
+ const toStringed = toString$1.call(val);
2206
2211
 
2207
2212
  if (toStringed === '[object WeakMap]') {
2208
2213
  return 'WeakMap {}';
@@ -2278,7 +2283,7 @@ function printComplexValue(
2278
2283
  return printer(val.toJSON(), config, indentation, depth, refs, true);
2279
2284
  }
2280
2285
 
2281
- const toStringed = toString.call(val);
2286
+ const toStringed = toString$1.call(val);
2282
2287
 
2283
2288
  if (toStringed === '[object Arguments]') {
2284
2289
  return hitMaxDepth
@@ -2646,36 +2651,36 @@ var _default = format;
2646
2651
  build.default = _default;
2647
2652
 
2648
2653
  const {
2649
- DOMCollection,
2650
- DOMElement,
2651
- Immutable,
2652
- ReactElement,
2653
- ReactTestComponent,
2654
- AsymmetricMatcher
2654
+ DOMCollection: DOMCollection$1,
2655
+ DOMElement: DOMElement$1,
2656
+ Immutable: Immutable$1,
2657
+ ReactElement: ReactElement$1,
2658
+ ReactTestComponent: ReactTestComponent$1,
2659
+ AsymmetricMatcher: AsymmetricMatcher$1
2655
2660
  } = plugins_1;
2656
- let PLUGINS = [
2657
- ReactTestComponent,
2658
- ReactElement,
2659
- DOMElement,
2660
- DOMCollection,
2661
- Immutable,
2662
- AsymmetricMatcher
2661
+ let PLUGINS$1 = [
2662
+ ReactTestComponent$1,
2663
+ ReactElement$1,
2664
+ DOMElement$1,
2665
+ DOMCollection$1,
2666
+ Immutable$1,
2667
+ AsymmetricMatcher$1
2663
2668
  ];
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) => {
2669
+ const getSerializers = () => PLUGINS$1;
2670
+
2671
+ var __defProp$1 = Object.defineProperty;
2672
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
2673
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
2674
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
2675
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2676
+ var __spreadValues$1 = (a, b) => {
2672
2677
  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]);
2678
+ if (__hasOwnProp$1.call(b, prop))
2679
+ __defNormalProp$1(a, prop, b[prop]);
2680
+ if (__getOwnPropSymbols$1)
2681
+ for (var prop of __getOwnPropSymbols$1(b)) {
2682
+ if (__propIsEnum$1.call(b, prop))
2683
+ __defNormalProp$1(a, prop, b[prop]);
2679
2684
  }
2680
2685
  return a;
2681
2686
  };
@@ -2711,7 +2716,7 @@ const removeExtraLineBreaks = (string) => string.length > 2 && string.startsWith
2711
2716
  const escapeRegex = true;
2712
2717
  const printFunctionName = false;
2713
2718
  function serialize(val, indent = 2, formatOverrides = {}) {
2714
- return normalizeNewlines(format_1(val, __spreadValues({
2719
+ return normalizeNewlines(format_1(val, __spreadValues$1({
2715
2720
  escapeRegex,
2716
2721
  indent,
2717
2722
  plugins: getSerializers(),
@@ -2968,6 +2973,426 @@ function SnapshotPlugin() {
2968
2973
  };
2969
2974
  }
2970
2975
 
2976
+ const EXPECTED_COLOR = c$1.green;
2977
+ const RECEIVED_COLOR = c$1.red;
2978
+ const INVERTED_COLOR = c$1.inverse;
2979
+ const BOLD_WEIGHT = c$1.bold;
2980
+ const DIM_COLOR = c$1.dim;
2981
+ const {
2982
+ AsymmetricMatcher,
2983
+ DOMCollection,
2984
+ DOMElement,
2985
+ Immutable,
2986
+ ReactElement,
2987
+ ReactTestComponent
2988
+ } = plugins_1;
2989
+ const PLUGINS = [
2990
+ ReactTestComponent,
2991
+ ReactElement,
2992
+ DOMElement,
2993
+ DOMCollection,
2994
+ Immutable,
2995
+ AsymmetricMatcher
2996
+ ];
2997
+ function matcherHint(matcherName, received = "received", expected = "expected", options = {}) {
2998
+ const {
2999
+ comment = "",
3000
+ expectedColor = EXPECTED_COLOR,
3001
+ isDirectExpectCall = false,
3002
+ isNot = false,
3003
+ promise = "",
3004
+ receivedColor = RECEIVED_COLOR,
3005
+ secondArgument = "",
3006
+ secondArgumentColor = EXPECTED_COLOR
3007
+ } = options;
3008
+ let hint = "";
3009
+ let dimString = "expect";
3010
+ if (!isDirectExpectCall && received !== "") {
3011
+ hint += DIM_COLOR(`${dimString}(`) + receivedColor(received);
3012
+ dimString = ")";
3013
+ }
3014
+ if (promise !== "") {
3015
+ hint += DIM_COLOR(`${dimString}.`) + promise;
3016
+ dimString = "";
3017
+ }
3018
+ if (isNot) {
3019
+ hint += `${DIM_COLOR(`${dimString}.`)}not`;
3020
+ dimString = "";
3021
+ }
3022
+ if (matcherName.includes(".")) {
3023
+ dimString += matcherName;
3024
+ } else {
3025
+ hint += DIM_COLOR(`${dimString}.`) + matcherName;
3026
+ dimString = "";
3027
+ }
3028
+ if (expected === "") {
3029
+ dimString += "()";
3030
+ } else {
3031
+ hint += DIM_COLOR(`${dimString}(`) + expectedColor(expected);
3032
+ if (secondArgument)
3033
+ hint += DIM_COLOR(", ") + secondArgumentColor(secondArgument);
3034
+ dimString = ")";
3035
+ }
3036
+ if (comment !== "")
3037
+ dimString += ` // ${comment}`;
3038
+ if (dimString !== "")
3039
+ hint += DIM_COLOR(dimString);
3040
+ return hint;
3041
+ }
3042
+ const SPACE_SYMBOL = "\xB7";
3043
+ const replaceTrailingSpaces = (text) => text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
3044
+ const stringify = (object, maxDepth = 10) => {
3045
+ const MAX_LENGTH = 1e4;
3046
+ let result;
3047
+ try {
3048
+ result = format_1(object, {
3049
+ maxDepth,
3050
+ min: true,
3051
+ plugins: PLUGINS
3052
+ });
3053
+ } catch {
3054
+ result = format_1(object, {
3055
+ callToJSON: false,
3056
+ maxDepth,
3057
+ min: true,
3058
+ plugins: PLUGINS
3059
+ });
3060
+ }
3061
+ return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
3062
+ };
3063
+ const printReceived = (object) => RECEIVED_COLOR(replaceTrailingSpaces(stringify(object)));
3064
+ const printExpected = (value) => EXPECTED_COLOR(replaceTrailingSpaces(stringify(value)));
3065
+ function diff(a, b, options) {
3066
+ return generateDiff(stringify(a), stringify(b));
3067
+ }
3068
+
3069
+ var matcherUtils = /*#__PURE__*/Object.freeze({
3070
+ __proto__: null,
3071
+ EXPECTED_COLOR: EXPECTED_COLOR,
3072
+ RECEIVED_COLOR: RECEIVED_COLOR,
3073
+ INVERTED_COLOR: INVERTED_COLOR,
3074
+ BOLD_WEIGHT: BOLD_WEIGHT,
3075
+ DIM_COLOR: DIM_COLOR,
3076
+ matcherHint: matcherHint,
3077
+ stringify: stringify,
3078
+ printReceived: printReceived,
3079
+ printExpected: printExpected,
3080
+ diff: diff
3081
+ });
3082
+
3083
+ // src/math.ts
3084
+ var isObject = (val) => toString.call(val) === "[object Object]";
3085
+
3086
+ function equals(a, b, customTesters, strictCheck) {
3087
+ customTesters = customTesters || [];
3088
+ return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
3089
+ }
3090
+ function isAsymmetric(obj) {
3091
+ return !!obj && isA("Function", obj.asymmetricMatch);
3092
+ }
3093
+ function asymmetricMatch(a, b) {
3094
+ var asymmetricA = isAsymmetric(a), asymmetricB = isAsymmetric(b);
3095
+ if (asymmetricA && asymmetricB) {
3096
+ return void 0;
3097
+ }
3098
+ if (asymmetricA) {
3099
+ return a.asymmetricMatch(b);
3100
+ }
3101
+ if (asymmetricB) {
3102
+ return b.asymmetricMatch(a);
3103
+ }
3104
+ }
3105
+ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
3106
+ var result = true;
3107
+ var asymmetricResult = asymmetricMatch(a, b);
3108
+ if (asymmetricResult !== void 0) {
3109
+ return asymmetricResult;
3110
+ }
3111
+ for (var i = 0; i < customTesters.length; i++) {
3112
+ var customTesterResult = customTesters[i](a, b);
3113
+ if (customTesterResult !== void 0) {
3114
+ return customTesterResult;
3115
+ }
3116
+ }
3117
+ if (a instanceof Error && b instanceof Error) {
3118
+ return a.message == b.message;
3119
+ }
3120
+ if (Object.is(a, b)) {
3121
+ return true;
3122
+ }
3123
+ if (a === null || b === null) {
3124
+ return a === b;
3125
+ }
3126
+ var className = Object.prototype.toString.call(a);
3127
+ if (className != Object.prototype.toString.call(b)) {
3128
+ return false;
3129
+ }
3130
+ switch (className) {
3131
+ case "[object Boolean]":
3132
+ case "[object String]":
3133
+ case "[object Number]":
3134
+ if (typeof a !== typeof b) {
3135
+ return false;
3136
+ } else if (typeof a !== "object" && typeof b !== "object") {
3137
+ return Object.is(a, b);
3138
+ } else {
3139
+ return Object.is(a.valueOf(), b.valueOf());
3140
+ }
3141
+ case "[object Date]":
3142
+ return +a == +b;
3143
+ case "[object RegExp]":
3144
+ return a.source === b.source && a.flags === b.flags;
3145
+ }
3146
+ if (typeof a !== "object" || typeof b !== "object") {
3147
+ return false;
3148
+ }
3149
+ if (isDomNode(a) && isDomNode(b)) {
3150
+ return a.isEqualNode(b);
3151
+ }
3152
+ var length = aStack.length;
3153
+ while (length--) {
3154
+ if (aStack[length] === a) {
3155
+ return bStack[length] === b;
3156
+ } else if (bStack[length] === b) {
3157
+ return false;
3158
+ }
3159
+ }
3160
+ aStack.push(a);
3161
+ bStack.push(b);
3162
+ if (className == "[object Array]" && a.length !== b.length) {
3163
+ return false;
3164
+ }
3165
+ var aKeys = keys(a, hasKey2), key;
3166
+ var size = aKeys.length;
3167
+ if (keys(b, hasKey2).length !== size) {
3168
+ return false;
3169
+ }
3170
+ while (size--) {
3171
+ key = aKeys[size];
3172
+ result = hasKey2(b, key) && eq(a[key], b[key], aStack, bStack, customTesters, hasKey2);
3173
+ if (!result) {
3174
+ return false;
3175
+ }
3176
+ }
3177
+ aStack.pop();
3178
+ bStack.pop();
3179
+ return result;
3180
+ }
3181
+ function keys(obj, hasKey2) {
3182
+ var keys2 = [];
3183
+ for (var key in obj) {
3184
+ if (hasKey2(obj, key)) {
3185
+ keys2.push(key);
3186
+ }
3187
+ }
3188
+ return keys2.concat(Object.getOwnPropertySymbols(obj).filter((symbol) => Object.getOwnPropertyDescriptor(obj, symbol).enumerable));
3189
+ }
3190
+ function hasDefinedKey(obj, key) {
3191
+ return hasKey(obj, key) && obj[key] !== void 0;
3192
+ }
3193
+ function hasKey(obj, key) {
3194
+ return Object.prototype.hasOwnProperty.call(obj, key);
3195
+ }
3196
+ function isA(typeName, value) {
3197
+ return Object.prototype.toString.apply(value) === "[object " + typeName + "]";
3198
+ }
3199
+ function isDomNode(obj) {
3200
+ return obj !== null && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string" && typeof obj.isEqualNode === "function";
3201
+ }
3202
+ const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
3203
+ const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
3204
+ const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
3205
+ function isImmutableUnorderedKeyed(maybeKeyed) {
3206
+ return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL] && !maybeKeyed[IS_ORDERED_SENTINEL]);
3207
+ }
3208
+ function isImmutableUnorderedSet(maybeSet) {
3209
+ return !!(maybeSet && maybeSet[IS_SET_SENTINEL] && !maybeSet[IS_ORDERED_SENTINEL]);
3210
+ }
3211
+ const IteratorSymbol = Symbol.iterator;
3212
+ const hasIterator = (object) => !!(object != null && object[IteratorSymbol]);
3213
+ const iterableEquality = (a, b, aStack = [], bStack = []) => {
3214
+ if (typeof a !== "object" || typeof b !== "object" || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) {
3215
+ return void 0;
3216
+ }
3217
+ if (a.constructor !== b.constructor) {
3218
+ return false;
3219
+ }
3220
+ let length = aStack.length;
3221
+ while (length--) {
3222
+ if (aStack[length] === a) {
3223
+ return bStack[length] === b;
3224
+ }
3225
+ }
3226
+ aStack.push(a);
3227
+ bStack.push(b);
3228
+ const iterableEqualityWithStack = (a2, b2) => iterableEquality(a2, b2, [...aStack], [...bStack]);
3229
+ if (a.size !== void 0) {
3230
+ if (a.size !== b.size) {
3231
+ return false;
3232
+ } else if (isA("Set", a) || isImmutableUnorderedSet(a)) {
3233
+ let allFound = true;
3234
+ for (const aValue of a) {
3235
+ if (!b.has(aValue)) {
3236
+ let has = false;
3237
+ for (const bValue of b) {
3238
+ const isEqual = equals(aValue, bValue, [iterableEqualityWithStack]);
3239
+ if (isEqual === true) {
3240
+ has = true;
3241
+ }
3242
+ }
3243
+ if (has === false) {
3244
+ allFound = false;
3245
+ break;
3246
+ }
3247
+ }
3248
+ }
3249
+ aStack.pop();
3250
+ bStack.pop();
3251
+ return allFound;
3252
+ } else if (isA("Map", a) || isImmutableUnorderedKeyed(a)) {
3253
+ let allFound = true;
3254
+ for (const aEntry of a) {
3255
+ if (!b.has(aEntry[0]) || !equals(aEntry[1], b.get(aEntry[0]), [iterableEqualityWithStack])) {
3256
+ let has = false;
3257
+ for (const bEntry of b) {
3258
+ const matchedKey = equals(aEntry[0], bEntry[0], [
3259
+ iterableEqualityWithStack
3260
+ ]);
3261
+ let matchedValue = false;
3262
+ if (matchedKey === true) {
3263
+ matchedValue = equals(aEntry[1], bEntry[1], [
3264
+ iterableEqualityWithStack
3265
+ ]);
3266
+ }
3267
+ if (matchedValue === true) {
3268
+ has = true;
3269
+ }
3270
+ }
3271
+ if (has === false) {
3272
+ allFound = false;
3273
+ break;
3274
+ }
3275
+ }
3276
+ }
3277
+ aStack.pop();
3278
+ bStack.pop();
3279
+ return allFound;
3280
+ }
3281
+ }
3282
+ const bIterator = b[IteratorSymbol]();
3283
+ for (const aValue of a) {
3284
+ const nextB = bIterator.next();
3285
+ if (nextB.done || !equals(aValue, nextB.value, [iterableEqualityWithStack])) {
3286
+ return false;
3287
+ }
3288
+ }
3289
+ if (!bIterator.next().done) {
3290
+ return false;
3291
+ }
3292
+ aStack.pop();
3293
+ bStack.pop();
3294
+ return true;
3295
+ };
3296
+ const hasPropertyInObject = (object, key) => {
3297
+ const shouldTerminate = !object || typeof object !== "object" || object === Object.prototype;
3298
+ if (shouldTerminate) {
3299
+ return false;
3300
+ }
3301
+ return Object.prototype.hasOwnProperty.call(object, key) || hasPropertyInObject(Object.getPrototypeOf(object), key);
3302
+ };
3303
+ const isObjectWithKeys = (a) => isObject(a) && !(a instanceof Error) && !(a instanceof Array) && !(a instanceof Date);
3304
+ const subsetEquality = (object, subset) => {
3305
+ const subsetEqualityWithContext = (seenReferences = new WeakMap()) => (object2, subset2) => {
3306
+ if (!isObjectWithKeys(subset2)) {
3307
+ return void 0;
3308
+ }
3309
+ return Object.keys(subset2).every((key) => {
3310
+ if (isObjectWithKeys(subset2[key])) {
3311
+ if (seenReferences.has(subset2[key])) {
3312
+ return equals(object2[key], subset2[key], [iterableEquality]);
3313
+ }
3314
+ seenReferences.set(subset2[key], true);
3315
+ }
3316
+ const result = object2 != null && hasPropertyInObject(object2, key) && equals(object2[key], subset2[key], [
3317
+ iterableEquality,
3318
+ subsetEqualityWithContext(seenReferences)
3319
+ ]);
3320
+ seenReferences.delete(subset2[key]);
3321
+ return result;
3322
+ });
3323
+ };
3324
+ return subsetEqualityWithContext()(object, subset);
3325
+ };
3326
+
3327
+ var __defProp = Object.defineProperty;
3328
+ var __defProps = Object.defineProperties;
3329
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
3330
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3331
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3332
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
3333
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3334
+ var __spreadValues = (a, b) => {
3335
+ for (var prop in b || (b = {}))
3336
+ if (__hasOwnProp.call(b, prop))
3337
+ __defNormalProp(a, prop, b[prop]);
3338
+ if (__getOwnPropSymbols)
3339
+ for (var prop of __getOwnPropSymbols(b)) {
3340
+ if (__propIsEnum.call(b, prop))
3341
+ __defNormalProp(a, prop, b[prop]);
3342
+ }
3343
+ return a;
3344
+ };
3345
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
3346
+ const isAsyncFunction = (fn) => typeof fn === "function" && fn[Symbol.toStringTag] === "AsyncFunction";
3347
+ const getMatcherState = (assertion) => {
3348
+ const actual = assertion._obj;
3349
+ const isNot = util.flag(assertion, "negate");
3350
+ const jestUtils = __spreadProps(__spreadValues({}, matcherUtils), {
3351
+ iterableEquality,
3352
+ subsetEquality
3353
+ });
3354
+ const matcherState = {
3355
+ isNot,
3356
+ utils: jestUtils,
3357
+ assertionCalls: 0,
3358
+ promise: "",
3359
+ equals,
3360
+ suppressedErrors: []
3361
+ };
3362
+ return {
3363
+ state: matcherState,
3364
+ isNot,
3365
+ actual
3366
+ };
3367
+ };
3368
+ function JestExtendPlugin(expects) {
3369
+ return (c, utils) => {
3370
+ Object.entries(expects).forEach(([expectAssertionName, expectAssertion]) => {
3371
+ function expectSyncWrapper(...args) {
3372
+ const { state, isNot, actual } = getMatcherState(this);
3373
+ const { pass, message } = expectAssertion.call(state, actual, ...args);
3374
+ if (pass && isNot || !pass && !isNot)
3375
+ c.expect.fail(message());
3376
+ }
3377
+ async function expectAsyncWrapper(...args) {
3378
+ const { state, isNot, actual } = getMatcherState(this);
3379
+ const { pass, message } = await expectAssertion.call(state, actual, ...args);
3380
+ if (pass && isNot || !pass && !isNot)
3381
+ c.expect.fail(message());
3382
+ }
3383
+ const expectAssertionWrapper = isAsyncFunction(expectAssertion) ? expectAsyncWrapper : expectSyncWrapper;
3384
+ utils.addMethod(chai.Assertion.prototype, expectAssertionName, expectAssertionWrapper);
3385
+ });
3386
+ };
3387
+ }
3388
+ function JestExtend() {
3389
+ return (chai2, utils) => {
3390
+ utils.addMethod(chai2.expect, "extend", (expects) => {
3391
+ chai2.use(JestExtendPlugin(expects));
3392
+ });
3393
+ };
3394
+ }
3395
+
2971
3396
  function JestChaiExpect() {
2972
3397
  return (chai, utils) => {
2973
3398
  function def(name, fn) {
@@ -3050,6 +3475,9 @@ function JestChaiExpect() {
3050
3475
  def("toHaveLength", function(length) {
3051
3476
  return this.have.length(length);
3052
3477
  });
3478
+ def("toHaveProperty", function(...args) {
3479
+ return this.have.deep.nested.property(...args);
3480
+ });
3053
3481
  def("toBeCloseTo", function(number, numDigits = 2) {
3054
3482
  utils.expectTypes(this, ["number"]);
3055
3483
  return this.closeTo(number, numDigits);
@@ -3151,17 +3579,54 @@ async function setupChai() {
3151
3579
  if (installed)
3152
3580
  return;
3153
3581
  chai.use(SinonChai);
3582
+ chai.use(JestExtend());
3154
3583
  chai.use(JestChaiExpect());
3155
3584
  chai.use(Subset);
3156
3585
  chai.use(SnapshotPlugin());
3157
3586
  installed = true;
3158
3587
  }
3159
3588
 
3589
+ let globalSetup = false;
3160
3590
  async function setupGlobalEnv(config) {
3591
+ if (globalSetup)
3592
+ return;
3593
+ globalSetup = true;
3594
+ setupConsoleLogSpy();
3161
3595
  await setupChai();
3162
3596
  if (config.global)
3163
3597
  (await import('./global-e40b54d6.js')).registerApiGlobally();
3164
3598
  }
3599
+ function setupConsoleLogSpy() {
3600
+ const stdout = new Writable({
3601
+ write(data, encoding, callback) {
3602
+ var _a;
3603
+ send("log", {
3604
+ type: "stdout",
3605
+ content: String(data),
3606
+ taskId: (_a = process.__vitest_worker__.current) == null ? void 0 : _a.id
3607
+ });
3608
+ callback();
3609
+ }
3610
+ });
3611
+ const stderr = new Writable({
3612
+ write(data, encoding, callback) {
3613
+ var _a;
3614
+ send("log", {
3615
+ type: "stderr",
3616
+ content: String(data),
3617
+ taskId: (_a = process.__vitest_worker__.current) == null ? void 0 : _a.id
3618
+ });
3619
+ callback();
3620
+ }
3621
+ });
3622
+ const newConsole = new Console({
3623
+ stdout,
3624
+ stderr,
3625
+ colorMode: true,
3626
+ groupIndentation: 2
3627
+ });
3628
+ globalThis.console = newConsole;
3629
+ }
3165
3630
  async function withEnv(name, fn) {
3166
3631
  const env = await environments[name].setup(globalThis);
3167
3632
  try {
@@ -3244,6 +3709,7 @@ async function runTest(test) {
3244
3709
  };
3245
3710
  updateTask(test);
3246
3711
  getSnapshotClient().setTest(test);
3712
+ process.__vitest_worker__.current = test;
3247
3713
  try {
3248
3714
  await callHook(test.suite, "beforeEach", [test, test.suite]);
3249
3715
  await getFn(test)();
@@ -3260,6 +3726,7 @@ async function runTest(test) {
3260
3726
  }
3261
3727
  getSnapshotClient().clearTest();
3262
3728
  test.result.end = performance.now();
3729
+ process.__vitest_worker__.current = void 0;
3263
3730
  updateTask(test);
3264
3731
  }
3265
3732
  async function runSuite(suite) {