vitest 0.0.70 → 0.0.71

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