vitest 0.8.4 → 0.8.5

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.
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'fs';
2
- import { c as createBirpc } from './chunk-vite-node-utils.3c7ce184.js';
2
+ import { c as createBirpc } from './chunk-vite-node-utils.a6890356.js';
3
3
  import require$$0$1 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$3 from 'net';
@@ -9,11 +9,11 @@ import require$$2 from 'events';
9
9
  import require$$1 from 'https';
10
10
  import require$$2$1 from 'http';
11
11
  import url from 'url';
12
- import { A as API_PATH } from './chunk-constants.6062c404.js';
13
- import { k as interpretSourcePos, a as parseStacktrace } from './chunk-utils-timers.7bdeea22.js';
12
+ import { A as API_PATH } from './chunk-constants.76cf224a.js';
13
+ import { k as interpretSourcePos, a as parseStacktrace } from './chunk-utils-timers.5657f2a4.js';
14
14
  import 'module';
15
15
  import 'vm';
16
- import './chunk-utils-base.8408f73a.js';
16
+ import './chunk-utils-base.aff0a195.js';
17
17
  import 'path';
18
18
  import 'tty';
19
19
  import 'local-pkg';
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { u as resolve } from './chunk-utils-base.8408f73a.js';
2
+ import { u as resolve } from './chunk-utils-base.aff0a195.js';
3
3
 
4
4
  const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
5
5
  const defaultPort = 51204;
@@ -1,7 +1,7 @@
1
1
  import { existsSync, promises } from 'fs';
2
2
  import { createRequire } from 'module';
3
3
  import { pathToFileURL } from 'url';
4
- import { t as toArray, u as resolve } from './chunk-utils-base.8408f73a.js';
4
+ import { t as toArray, u as resolve } from './chunk-utils-base.aff0a195.js';
5
5
 
6
6
  const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
7
7
  const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
@@ -28,7 +28,7 @@ const coverageConfigDefaults = {
28
28
  allowExternal: false,
29
29
  extension: [".js", ".cjs", ".mjs", ".ts", ".tsx", ".jsx", ".vue", ".svelte"]
30
30
  };
31
- const configDefaults = Object.freeze({
31
+ const config = {
32
32
  allowOnly: !process.env.CI,
33
33
  watch: !process.env.CI,
34
34
  globals: false,
@@ -51,7 +51,8 @@ const configDefaults = Object.freeze({
51
51
  uiBase: "/__vitest__/",
52
52
  open: true,
53
53
  coverage: coverageConfigDefaults
54
- });
54
+ };
55
+ const configDefaults = Object.freeze(config);
55
56
 
56
57
  var __defProp = Object.defineProperty;
57
58
  var __defProps = Object.defineProperties;
@@ -1,18 +1,18 @@
1
- import { g as globalApis } from './chunk-constants.6062c404.js';
2
- import { i as index } from './chunk-runtime-chain.766f27fd.js';
1
+ import { g as globalApis } from './chunk-constants.76cf224a.js';
2
+ import { i as index } from './chunk-runtime-chain.c86f1eb0.js';
3
3
  import 'url';
4
- import './chunk-utils-base.8408f73a.js';
4
+ import './chunk-utils-base.aff0a195.js';
5
5
  import 'path';
6
6
  import 'tty';
7
7
  import 'local-pkg';
8
8
  import 'util';
9
9
  import './chunk-utils-global.7bcfa03c.js';
10
- import './chunk-utils-timers.7bdeea22.js';
10
+ import './chunk-utils-timers.5657f2a4.js';
11
11
  import 'chai';
12
12
  import './vendor-_commonjsHelpers.34b404ce.js';
13
- import './chunk-runtime-rpc.e8aa1ebe.js';
13
+ import './chunk-runtime-rpc.5263102e.js';
14
14
  import 'fs';
15
- import './jest-mock.js';
15
+ import './spy.js';
16
16
  import 'tinyspy';
17
17
 
18
18
  function registerApiGlobally() {
@@ -1,28 +1,28 @@
1
1
  import require$$0, { format as format$1 } from 'util';
2
- import { i as isObject, t as toArray, n as noop, a as index$1, g as getCallLastIndex, s as slash, b as getNames, c as assertTypes, d as c$1 } from './chunk-utils-base.8408f73a.js';
2
+ import { i as isObject, t as toArray, n as noop, a as index$1, g as getCallLastIndex, s as slash, b as getNames, c as c$1, d as assertTypes } from './chunk-utils-base.aff0a195.js';
3
3
  import { g as getWorkerState } from './chunk-utils-global.7bcfa03c.js';
4
- import { s as setTimeout, c as clearTimeout, g as getOriginalPos, p as posToNumber, n as numberToPos, l as lineSplitRE, a as parseStacktrace, u as unifiedDiff } from './chunk-utils-timers.7bdeea22.js';
4
+ import { s as setTimeout, c as clearTimeout, g as getOriginalPos, p as posToNumber, n as numberToPos, l as lineSplitRE, a as parseStacktrace, u as unifiedDiff } from './chunk-utils-timers.5657f2a4.js';
5
5
  import chai$1, { expect as expect$1, util, assert, should } from 'chai';
6
6
  import { c as commonjsRequire, a as commonjsGlobal } from './vendor-_commonjsHelpers.34b404ce.js';
7
- import { r as rpc } from './chunk-runtime-rpc.e8aa1ebe.js';
7
+ import { r as rpc } from './chunk-runtime-rpc.5263102e.js';
8
8
  import fs, { promises } from 'fs';
9
- import { isMockFunction, spyOn, fn, spies } from './jest-mock.js';
9
+ import { isMockFunction, spyOn, fn, spies } from './spy.js';
10
10
 
11
- var __defProp$4 = Object.defineProperty;
11
+ var __defProp$5 = Object.defineProperty;
12
12
  var __defProps$2 = Object.defineProperties;
13
13
  var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
14
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
15
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
16
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
17
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
- var __spreadValues$4 = (a, b) => {
14
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
15
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
16
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
17
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
+ var __spreadValues$5 = (a, b) => {
19
19
  for (var prop in b || (b = {}))
20
- if (__hasOwnProp$4.call(b, prop))
21
- __defNormalProp$4(a, prop, b[prop]);
22
- if (__getOwnPropSymbols$4)
23
- for (var prop of __getOwnPropSymbols$4(b)) {
24
- if (__propIsEnum$4.call(b, prop))
25
- __defNormalProp$4(a, prop, b[prop]);
20
+ if (__hasOwnProp$5.call(b, prop))
21
+ __defNormalProp$5(a, prop, b[prop]);
22
+ if (__getOwnPropSymbols$5)
23
+ for (var prop of __getOwnPropSymbols$5(b)) {
24
+ if (__propIsEnum$5.call(b, prop))
25
+ __defNormalProp$5(a, prop, b[prop]);
26
26
  }
27
27
  return a;
28
28
  };
@@ -35,7 +35,7 @@ function createChainable(keys, fn) {
35
35
  for (const key of keys) {
36
36
  Object.defineProperty(chain2, key, {
37
37
  get() {
38
- return create(__spreadProps$2(__spreadValues$4({}, obj), { [key]: true }));
38
+ return create(__spreadProps$2(__spreadValues$5({}, obj), { [key]: true }));
39
39
  }
40
40
  });
41
41
  }
@@ -2980,19 +2980,19 @@ const addSerializer = (plugin) => {
2980
2980
  };
2981
2981
  const getSerializers = () => PLUGINS$1;
2982
2982
 
2983
- var __defProp$3 = Object.defineProperty;
2984
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
2985
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
2986
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
2987
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2988
- var __spreadValues$3 = (a, b) => {
2983
+ var __defProp$4 = Object.defineProperty;
2984
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
2985
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
2986
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
2987
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2988
+ var __spreadValues$4 = (a, b) => {
2989
2989
  for (var prop in b || (b = {}))
2990
- if (__hasOwnProp$3.call(b, prop))
2991
- __defNormalProp$3(a, prop, b[prop]);
2992
- if (__getOwnPropSymbols$3)
2993
- for (var prop of __getOwnPropSymbols$3(b)) {
2994
- if (__propIsEnum$3.call(b, prop))
2995
- __defNormalProp$3(a, prop, b[prop]);
2990
+ if (__hasOwnProp$4.call(b, prop))
2991
+ __defNormalProp$4(a, prop, b[prop]);
2992
+ if (__getOwnPropSymbols$4)
2993
+ for (var prop of __getOwnPropSymbols$4(b)) {
2994
+ if (__propIsEnum$4.call(b, prop))
2995
+ __defNormalProp$4(a, prop, b[prop]);
2996
2996
  }
2997
2997
  return a;
2998
2998
  };
@@ -3028,7 +3028,7 @@ const removeExtraLineBreaks = (string) => string.length > 2 && string.startsWith
3028
3028
  const escapeRegex = true;
3029
3029
  const printFunctionName = false;
3030
3030
  function serialize(val, indent = 2, formatOverrides = {}) {
3031
- return normalizeNewlines(format_1(val, __spreadValues$3({
3031
+ return normalizeNewlines(format_1(val, __spreadValues$4({
3032
3032
  escapeRegex,
3033
3033
  indent,
3034
3034
  plugins: getSerializers(),
@@ -3087,7 +3087,7 @@ function deepMergeArray(target = [], source = []) {
3087
3087
  }
3088
3088
  function deepMergeSnapshot(target, source) {
3089
3089
  if (isObject(target) && isObject(source)) {
3090
- const mergedOutput = __spreadValues$3({}, target);
3090
+ const mergedOutput = __spreadValues$4({}, target);
3091
3091
  Object.keys(source).forEach((key) => {
3092
3092
  if (isObject(source[key]) && !source[key].$$typeof) {
3093
3093
  if (!(key in target))
@@ -3197,19 +3197,19 @@ function stripSnapshotIndentation(inlineSnapshot) {
3197
3197
  return inlineSnapshot;
3198
3198
  }
3199
3199
 
3200
- var __defProp$2 = Object.defineProperty;
3201
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
3202
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
3203
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
3204
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3205
- var __spreadValues$2 = (a, b) => {
3200
+ var __defProp$3 = Object.defineProperty;
3201
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
3202
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
3203
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
3204
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3205
+ var __spreadValues$3 = (a, b) => {
3206
3206
  for (var prop in b || (b = {}))
3207
- if (__hasOwnProp$2.call(b, prop))
3208
- __defNormalProp$2(a, prop, b[prop]);
3209
- if (__getOwnPropSymbols$2)
3210
- for (var prop of __getOwnPropSymbols$2(b)) {
3211
- if (__propIsEnum$2.call(b, prop))
3212
- __defNormalProp$2(a, prop, b[prop]);
3207
+ if (__hasOwnProp$3.call(b, prop))
3208
+ __defNormalProp$3(a, prop, b[prop]);
3209
+ if (__getOwnPropSymbols$3)
3210
+ for (var prop of __getOwnPropSymbols$3(b)) {
3211
+ if (__propIsEnum$3.call(b, prop))
3212
+ __defNormalProp$3(a, prop, b[prop]);
3213
3213
  }
3214
3214
  return a;
3215
3215
  };
@@ -3229,7 +3229,7 @@ class SnapshotState {
3229
3229
  this.unmatched = 0;
3230
3230
  this._updateSnapshot = options.updateSnapshot;
3231
3231
  this.updated = 0;
3232
- this._snapshotFormat = __spreadValues$2({
3232
+ this._snapshotFormat = __spreadValues$3({
3233
3233
  printBasicPrototype: false
3234
3234
  }, options.snapshotFormat);
3235
3235
  }
@@ -3257,7 +3257,7 @@ class SnapshotState {
3257
3257
  throw new Error(`Vitest: Couldn't infer stack frame for inline snapshot.
3258
3258
  ${JSON.stringify(stacks)}`);
3259
3259
  }
3260
- this._inlineSnapshots.push(__spreadValues$2({
3260
+ this._inlineSnapshots.push(__spreadValues$3({
3261
3261
  snapshot: receivedSerialized
3262
3262
  }, stack));
3263
3263
  } else {
@@ -3375,18 +3375,17 @@ ${JSON.stringify(stacks)}`);
3375
3375
  }
3376
3376
  }
3377
3377
 
3378
- const resolveSnapshotPath = (testPath) => index$1.join(index$1.join(index$1.dirname(testPath), "__snapshots__"), `${index$1.basename(testPath)}.snap`);
3379
3378
  class SnapshotClient {
3380
3379
  constructor() {
3381
3380
  this.testFile = "";
3382
3381
  }
3383
- setTest(test) {
3382
+ async setTest(test) {
3384
3383
  this.test = test;
3385
3384
  if (this.testFile !== this.test.file.filepath) {
3386
3385
  if (this.snapshotState)
3387
3386
  this.saveSnap();
3388
3387
  this.testFile = this.test.file.filepath;
3389
- this.snapshotState = new SnapshotState(resolveSnapshotPath(this.testFile), getWorkerState().config.snapshotOptions);
3388
+ this.snapshotState = new SnapshotState(await rpc().resolveSnapshotPath(this.testFile), getWorkerState().config.snapshotOptions);
3390
3389
  }
3391
3390
  }
3392
3391
  clearTest() {
@@ -3514,6 +3513,127 @@ const SnapshotPlugin = (chai, utils) => {
3514
3513
  });
3515
3514
  };
3516
3515
 
3516
+ var __defProp$2 = Object.defineProperty;
3517
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
3518
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
3519
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
3520
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3521
+ var __spreadValues$2 = (a, b) => {
3522
+ for (var prop in b || (b = {}))
3523
+ if (__hasOwnProp$2.call(b, prop))
3524
+ __defNormalProp$2(a, prop, b[prop]);
3525
+ if (__getOwnPropSymbols$2)
3526
+ for (var prop of __getOwnPropSymbols$2(b)) {
3527
+ if (__propIsEnum$2.call(b, prop))
3528
+ __defNormalProp$2(a, prop, b[prop]);
3529
+ }
3530
+ return a;
3531
+ };
3532
+ const EXPECTED_COLOR = c$1.green;
3533
+ const RECEIVED_COLOR = c$1.red;
3534
+ const INVERTED_COLOR = c$1.inverse;
3535
+ const BOLD_WEIGHT = c$1.bold;
3536
+ const DIM_COLOR = c$1.dim;
3537
+ const {
3538
+ AsymmetricMatcher: AsymmetricMatcher$1,
3539
+ DOMCollection,
3540
+ DOMElement,
3541
+ Immutable,
3542
+ ReactElement,
3543
+ ReactTestComponent
3544
+ } = plugins_1;
3545
+ const PLUGINS = [
3546
+ ReactTestComponent,
3547
+ ReactElement,
3548
+ DOMElement,
3549
+ DOMCollection,
3550
+ Immutable,
3551
+ AsymmetricMatcher$1
3552
+ ];
3553
+ function matcherHint(matcherName, received = "received", expected = "expected", options = {}) {
3554
+ const {
3555
+ comment = "",
3556
+ expectedColor = EXPECTED_COLOR,
3557
+ isDirectExpectCall = false,
3558
+ isNot = false,
3559
+ promise = "",
3560
+ receivedColor = RECEIVED_COLOR,
3561
+ secondArgument = "",
3562
+ secondArgumentColor = EXPECTED_COLOR
3563
+ } = options;
3564
+ let hint = "";
3565
+ let dimString = "expect";
3566
+ if (!isDirectExpectCall && received !== "") {
3567
+ hint += DIM_COLOR(`${dimString}(`) + receivedColor(received);
3568
+ dimString = ")";
3569
+ }
3570
+ if (promise !== "") {
3571
+ hint += DIM_COLOR(`${dimString}.`) + promise;
3572
+ dimString = "";
3573
+ }
3574
+ if (isNot) {
3575
+ hint += `${DIM_COLOR(`${dimString}.`)}not`;
3576
+ dimString = "";
3577
+ }
3578
+ if (matcherName.includes(".")) {
3579
+ dimString += matcherName;
3580
+ } else {
3581
+ hint += DIM_COLOR(`${dimString}.`) + matcherName;
3582
+ dimString = "";
3583
+ }
3584
+ if (expected === "") {
3585
+ dimString += "()";
3586
+ } else {
3587
+ hint += DIM_COLOR(`${dimString}(`) + expectedColor(expected);
3588
+ if (secondArgument)
3589
+ hint += DIM_COLOR(", ") + secondArgumentColor(secondArgument);
3590
+ dimString = ")";
3591
+ }
3592
+ if (comment !== "")
3593
+ dimString += ` // ${comment}`;
3594
+ if (dimString !== "")
3595
+ hint += DIM_COLOR(dimString);
3596
+ return hint;
3597
+ }
3598
+ const SPACE_SYMBOL = "\xB7";
3599
+ const replaceTrailingSpaces = (text) => text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
3600
+ const stringify = (object, maxDepth = 10, options) => {
3601
+ const MAX_LENGTH = 1e4;
3602
+ let result;
3603
+ try {
3604
+ result = format_1(object, __spreadValues$2({
3605
+ maxDepth,
3606
+ plugins: PLUGINS
3607
+ }, options));
3608
+ } catch {
3609
+ result = format_1(object, __spreadValues$2({
3610
+ callToJSON: false,
3611
+ maxDepth,
3612
+ plugins: PLUGINS
3613
+ }, options));
3614
+ }
3615
+ return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
3616
+ };
3617
+ const printReceived = (object) => RECEIVED_COLOR(replaceTrailingSpaces(stringify(object)));
3618
+ const printExpected = (value) => EXPECTED_COLOR(replaceTrailingSpaces(stringify(value)));
3619
+ function diff(a, b, options) {
3620
+ return unifiedDiff(stringify(a), stringify(b));
3621
+ }
3622
+
3623
+ var matcherUtils = /*#__PURE__*/Object.freeze({
3624
+ __proto__: null,
3625
+ EXPECTED_COLOR: EXPECTED_COLOR,
3626
+ RECEIVED_COLOR: RECEIVED_COLOR,
3627
+ INVERTED_COLOR: INVERTED_COLOR,
3628
+ BOLD_WEIGHT: BOLD_WEIGHT,
3629
+ DIM_COLOR: DIM_COLOR,
3630
+ matcherHint: matcherHint,
3631
+ stringify: stringify,
3632
+ printReceived: printReceived,
3633
+ printExpected: printExpected,
3634
+ diff: diff
3635
+ });
3636
+
3517
3637
  const MATCHERS_OBJECT = Symbol.for("matchers-object");
3518
3638
  if (!Object.prototype.hasOwnProperty.call(global, MATCHERS_OBJECT)) {
3519
3639
  const defaultState = {
@@ -3684,6 +3804,38 @@ const JestChaiExpect = (chai, utils) => {
3684
3804
  assertIsMock(assertion);
3685
3805
  return assertion._obj;
3686
3806
  };
3807
+ const ordinalOf = (i) => {
3808
+ const j = i % 10;
3809
+ const k = i % 100;
3810
+ if (j === 1 && k !== 11)
3811
+ return `${i}st`;
3812
+ if (j === 2 && k !== 12)
3813
+ return `${i}nd`;
3814
+ if (j === 3 && k !== 13)
3815
+ return `${i}rd`;
3816
+ return `${i}th`;
3817
+ };
3818
+ const formatCalls = (spy, msg, actualCall) => {
3819
+ msg += c$1.gray(`
3820
+
3821
+ Received:
3822
+ ${spy.mock.calls.map((callArg, i) => {
3823
+ let methodCall = c$1.bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call:
3824
+
3825
+ `);
3826
+ if (actualCall)
3827
+ methodCall += unifiedDiff(stringify(callArg), stringify(actualCall), { showLegend: false });
3828
+ else
3829
+ methodCall += stringify(callArg).split("\n").map((line) => ` ${line}`).join("\n");
3830
+ methodCall += "\n";
3831
+ return methodCall;
3832
+ }).join("\n")}`);
3833
+ msg += c$1.gray(`
3834
+
3835
+ Number of calls: ${c$1.bold(spy.mock.calls.length)}
3836
+ `);
3837
+ return msg;
3838
+ };
3687
3839
  def(["toHaveBeenCalledTimes", "toBeCalledTimes"], function(number) {
3688
3840
  const spy = getSpy(this);
3689
3841
  const spyName = spy.getMockName();
@@ -3700,25 +3852,40 @@ const JestChaiExpect = (chai, utils) => {
3700
3852
  const spy = getSpy(this);
3701
3853
  const spyName = spy.getMockName();
3702
3854
  const called = spy.mock.calls.length > 0;
3703
- return this.assert(called, `expected "${spyName}" to be called at least once`, `expected "${spyName}" to not be called at all`, true, called);
3855
+ const isNot = utils.flag(this, "negate");
3856
+ let msg = utils.getMessage(this, [
3857
+ called,
3858
+ `expected "${spyName}" to be called at least once`,
3859
+ `expected "${spyName}" to not be called at all`,
3860
+ true,
3861
+ called
3862
+ ]);
3863
+ if (called && isNot)
3864
+ msg += formatCalls(spy, msg);
3865
+ if (called && isNot || !called && !isNot) {
3866
+ const err = new Error(msg);
3867
+ err.name = "AssertionError";
3868
+ throw err;
3869
+ }
3704
3870
  });
3705
3871
  def(["toHaveBeenCalledWith", "toBeCalledWith"], function(...args) {
3706
3872
  const spy = getSpy(this);
3707
3873
  const spyName = spy.getMockName();
3708
3874
  const pass = spy.mock.calls.some((callArg) => equals(callArg, args, [iterableEquality]));
3709
- return this.assert(pass, `expected "${spyName}" to be called with arguments: #{exp}`, `expected "${spyName}" to not be called with arguments: #{exp}`, args, spy.mock.calls);
3875
+ const isNot = utils.flag(this, "negate");
3876
+ let msg = utils.getMessage(this, [
3877
+ pass,
3878
+ `expected "${spyName}" to be called with arguments: #{exp}`,
3879
+ `expected "${spyName}" to not be called with arguments: #{exp}`,
3880
+ args
3881
+ ]);
3882
+ if (pass && isNot || !pass && !isNot) {
3883
+ msg += formatCalls(spy, msg, args);
3884
+ const err = new Error(msg);
3885
+ err.name = "AssertionError";
3886
+ throw err;
3887
+ }
3710
3888
  });
3711
- const ordinalOf = (i) => {
3712
- const j = i % 10;
3713
- const k = i % 100;
3714
- if (j === 1 && k !== 11)
3715
- return `${i}st`;
3716
- if (j === 2 && k !== 12)
3717
- return `${i}nd`;
3718
- if (j === 3 && k !== 13)
3719
- return `${i}rd`;
3720
- return `${i}th`;
3721
- };
3722
3889
  def(["toHaveBeenNthCalledWith", "nthCalledWith"], function(times, ...args) {
3723
3890
  const spy = getSpy(this);
3724
3891
  const spyName = spy.getMockName();
@@ -3859,111 +4026,6 @@ const JestChaiExpect = (chai, utils) => {
3859
4026
  utils.addMethod(chai.expect, "addSnapshotSerializer", addSerializer);
3860
4027
  };
3861
4028
 
3862
- const EXPECTED_COLOR = c$1.green;
3863
- const RECEIVED_COLOR = c$1.red;
3864
- const INVERTED_COLOR = c$1.inverse;
3865
- const BOLD_WEIGHT = c$1.bold;
3866
- const DIM_COLOR = c$1.dim;
3867
- const {
3868
- AsymmetricMatcher: AsymmetricMatcher$1,
3869
- DOMCollection,
3870
- DOMElement,
3871
- Immutable,
3872
- ReactElement,
3873
- ReactTestComponent
3874
- } = plugins_1;
3875
- const PLUGINS = [
3876
- ReactTestComponent,
3877
- ReactElement,
3878
- DOMElement,
3879
- DOMCollection,
3880
- Immutable,
3881
- AsymmetricMatcher$1
3882
- ];
3883
- function matcherHint(matcherName, received = "received", expected = "expected", options = {}) {
3884
- const {
3885
- comment = "",
3886
- expectedColor = EXPECTED_COLOR,
3887
- isDirectExpectCall = false,
3888
- isNot = false,
3889
- promise = "",
3890
- receivedColor = RECEIVED_COLOR,
3891
- secondArgument = "",
3892
- secondArgumentColor = EXPECTED_COLOR
3893
- } = options;
3894
- let hint = "";
3895
- let dimString = "expect";
3896
- if (!isDirectExpectCall && received !== "") {
3897
- hint += DIM_COLOR(`${dimString}(`) + receivedColor(received);
3898
- dimString = ")";
3899
- }
3900
- if (promise !== "") {
3901
- hint += DIM_COLOR(`${dimString}.`) + promise;
3902
- dimString = "";
3903
- }
3904
- if (isNot) {
3905
- hint += `${DIM_COLOR(`${dimString}.`)}not`;
3906
- dimString = "";
3907
- }
3908
- if (matcherName.includes(".")) {
3909
- dimString += matcherName;
3910
- } else {
3911
- hint += DIM_COLOR(`${dimString}.`) + matcherName;
3912
- dimString = "";
3913
- }
3914
- if (expected === "") {
3915
- dimString += "()";
3916
- } else {
3917
- hint += DIM_COLOR(`${dimString}(`) + expectedColor(expected);
3918
- if (secondArgument)
3919
- hint += DIM_COLOR(", ") + secondArgumentColor(secondArgument);
3920
- dimString = ")";
3921
- }
3922
- if (comment !== "")
3923
- dimString += ` // ${comment}`;
3924
- if (dimString !== "")
3925
- hint += DIM_COLOR(dimString);
3926
- return hint;
3927
- }
3928
- const SPACE_SYMBOL = "\xB7";
3929
- const replaceTrailingSpaces = (text) => text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
3930
- const stringify = (object, maxDepth = 10) => {
3931
- const MAX_LENGTH = 1e4;
3932
- let result;
3933
- try {
3934
- result = format_1(object, {
3935
- maxDepth,
3936
- plugins: PLUGINS
3937
- });
3938
- } catch {
3939
- result = format_1(object, {
3940
- callToJSON: false,
3941
- maxDepth,
3942
- plugins: PLUGINS
3943
- });
3944
- }
3945
- return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
3946
- };
3947
- const printReceived = (object) => RECEIVED_COLOR(replaceTrailingSpaces(stringify(object)));
3948
- const printExpected = (value) => EXPECTED_COLOR(replaceTrailingSpaces(stringify(value)));
3949
- function diff(a, b, options) {
3950
- return unifiedDiff(stringify(a), stringify(b));
3951
- }
3952
-
3953
- var matcherUtils = /*#__PURE__*/Object.freeze({
3954
- __proto__: null,
3955
- EXPECTED_COLOR: EXPECTED_COLOR,
3956
- RECEIVED_COLOR: RECEIVED_COLOR,
3957
- INVERTED_COLOR: INVERTED_COLOR,
3958
- BOLD_WEIGHT: BOLD_WEIGHT,
3959
- DIM_COLOR: DIM_COLOR,
3960
- matcherHint: matcherHint,
3961
- stringify: stringify,
3962
- printReceived: printReceived,
3963
- printExpected: printExpected,
3964
- diff: diff
3965
- });
3966
-
3967
4029
  var __defProp$1 = Object.defineProperty;
3968
4030
  var __defProps$1 = Object.defineProperties;
3969
4031
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
@@ -7060,10 +7122,6 @@ var index = /*#__PURE__*/Object.freeze({
7060
7122
  should: should,
7061
7123
  chai: chai$1,
7062
7124
  expect: expect,
7063
- spies: spies,
7064
- isMockFunction: isMockFunction,
7065
- spyOn: spyOn,
7066
- fn: fn,
7067
7125
  vitest: vitest,
7068
7126
  vi: vi,
7069
7127
  getRunningMode: getRunningMode,
@@ -1,8 +1,8 @@
1
- import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.3c7ce184.js';
1
+ import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.a6890356.js';
2
2
  import { normalizePath } from 'vite';
3
- import { z as isWindows, A as mergeSlashes, h as dirname, k as basename, u as resolve } from './chunk-utils-base.8408f73a.js';
3
+ import { z as isWindows, A as mergeSlashes, h as dirname, f as basename, u as resolve } from './chunk-utils-base.aff0a195.js';
4
4
  import { existsSync, readdirSync } from 'fs';
5
- import { d as distDir } from './chunk-constants.6062c404.js';
5
+ import { d as distDir } from './chunk-constants.76cf224a.js';
6
6
  import { g as getWorkerState } from './chunk-utils-global.7bcfa03c.js';
7
7
 
8
8
  var __defProp = Object.defineProperty;
@@ -28,7 +28,7 @@ function getAllProperties(obj) {
28
28
  const allProps = /* @__PURE__ */ new Set();
29
29
  let curr = obj;
30
30
  do {
31
- if (curr === Object.prototype)
31
+ if (curr === Object.prototype || curr === Function.prototype || curr === RegExp.prototype)
32
32
  break;
33
33
  const props = Object.getOwnPropertyNames(curr);
34
34
  props.forEach((prop) => allProps.add(prop));
@@ -185,7 +185,7 @@ const _VitestMocker = class {
185
185
  async ensureSpy() {
186
186
  if (_VitestMocker.spyModule)
187
187
  return;
188
- _VitestMocker.spyModule = await this.request(resolve(distDir, "jest-mock.js"));
188
+ _VitestMocker.spyModule = await this.request(resolve(distDir, "spy.js"));
189
189
  }
190
190
  async requestWithMock(dep) {
191
191
  var _a;
@@ -1,4 +1,4 @@
1
- import './chunk-utils-base.8408f73a.js';
1
+ import './chunk-utils-base.aff0a195.js';
2
2
  import { g as getWorkerState } from './chunk-utils-global.7bcfa03c.js';
3
3
 
4
4
  const rpc = () => {
@@ -405,4 +405,4 @@ function getCallLastIndex(code) {
405
405
  return null;
406
406
  }
407
407
 
408
- export { mergeSlashes as A, partitionSuiteChildren as B, hasTests as C, index as a, getNames as b, assertTypes as c, c as d, notNullish as e, isAbsolute as f, getCallLastIndex as g, dirname as h, isObject as i, join as j, basename as k, getFullName as l, hasFailed as m, noop as n, hasFailedSnapshot as o, getSuites as p, getTests as q, relative as r, slash as s, toArray as t, resolve as u, deepMerge as v, toNamespacedPath as w, ensurePackageInstalled as x, extname as y, isWindows as z };
408
+ export { mergeSlashes as A, partitionSuiteChildren as B, hasTests as C, index as a, getNames as b, c, assertTypes as d, notNullish as e, basename as f, getCallLastIndex as g, dirname as h, isObject as i, join as j, isAbsolute as k, getFullName as l, hasFailed as m, noop as n, hasFailedSnapshot as o, getSuites as p, getTests as q, relative as r, slash as s, toArray as t, resolve as u, deepMerge as v, toNamespacedPath as w, ensurePackageInstalled as x, extname as y, isWindows as z };