vitest 0.20.1 → 0.21.0

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.
Files changed (32) hide show
  1. package/dist/browser.d.ts +9 -1882
  2. package/dist/browser.mjs +7 -7
  3. package/dist/{chunk-api-setup.7c4c8879.mjs → chunk-api-setup.89eb0e7a.mjs} +5 -5
  4. package/dist/{chunk-constants.16825f0c.mjs → chunk-constants.9da1ef26.mjs} +1 -1
  5. package/dist/{chunk-defaults.1c51d585.mjs → chunk-defaults.8390340d.mjs} +2 -2
  6. package/dist/{chunk-integrations-globals.56a11010.mjs → chunk-integrations-globals.a798d352.mjs} +6 -6
  7. package/dist/{chunk-mock-date.9160e13b.mjs → chunk-mock-date.ea3b3121.mjs} +10 -7
  8. package/dist/{chunk-node-git.43dbdd42.mjs → chunk-node-git.e0dc0a7e.mjs} +1 -1
  9. package/dist/{chunk-runtime-chain.b6c2cdbc.mjs → chunk-runtime-chain.44b4224d.mjs} +30 -21
  10. package/dist/{chunk-runtime-error.0aa0dc06.mjs → chunk-runtime-error.95e53764.mjs} +12 -11
  11. package/dist/{chunk-runtime-hooks.3ee34848.mjs → chunk-runtime-hooks.291644ec.mjs} +4 -4
  12. package/dist/{chunk-runtime-mocker.0a8f7c5e.mjs → chunk-runtime-mocker.6190d6a3.mjs} +19 -11
  13. package/dist/{chunk-runtime-rpc.dbf0b31d.mjs → chunk-runtime-rpc.fc50dcc0.mjs} +1 -1
  14. package/dist/{chunk-utils-source-map.8198ebd9.mjs → chunk-utils-source-map.d307e4ea.mjs} +1 -1
  15. package/dist/{chunk-vite-node-client.a247c2c2.mjs → chunk-vite-node-client.b59ba135.mjs} +2 -2
  16. package/dist/{chunk-vite-node-debug.c5887932.mjs → chunk-vite-node-debug.dbce2e1f.mjs} +1 -1
  17. package/dist/{chunk-vite-node-externalize.fce5b934.mjs → chunk-vite-node-externalize.80bed9b3.mjs} +36 -19
  18. package/dist/{chunk-vite-node-utils.9dfd1e3f.mjs → chunk-vite-node-utils.96438e82.mjs} +2 -2
  19. package/dist/cli.mjs +7 -7
  20. package/dist/config.d.ts +2 -67
  21. package/dist/entry.mjs +7 -7
  22. package/dist/global-644546f7.d.ts +1777 -0
  23. package/dist/index-3f764034.d.ts +164 -0
  24. package/dist/index.d.ts +29 -1898
  25. package/dist/index.mjs +5 -5
  26. package/dist/loader.mjs +72 -15
  27. package/dist/mocker-5e2a8e41.d.ts +3 -0
  28. package/dist/node.d.ts +7 -1662
  29. package/dist/node.mjs +8 -8
  30. package/dist/suite.mjs +4 -4
  31. package/dist/worker.mjs +6 -6
  32. package/package.json +10 -10
package/dist/browser.mjs CHANGED
@@ -1,22 +1,22 @@
1
- export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.b6c2cdbc.mjs';
2
- export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.3ee34848.mjs';
3
- export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.0aa0dc06.mjs';
1
+ export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.44b4224d.mjs';
2
+ export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.291644ec.mjs';
3
+ export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.95e53764.mjs';
4
4
  import * as chai from 'chai';
5
5
  export { chai };
6
6
  export { assert, should } from 'chai';
7
7
  import 'util';
8
- import './chunk-mock-date.9160e13b.mjs';
8
+ import './chunk-mock-date.ea3b3121.mjs';
9
9
  import 'path';
10
10
  import 'tty';
11
11
  import 'local-pkg';
12
12
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
13
- import './chunk-runtime-rpc.dbf0b31d.mjs';
13
+ import './chunk-runtime-rpc.fc50dcc0.mjs';
14
14
  import './chunk-utils-global.fa20c2f6.mjs';
15
15
  import './chunk-utils-timers.b48455ed.mjs';
16
16
  import 'fs';
17
- import './chunk-utils-source-map.8198ebd9.mjs';
17
+ import './chunk-utils-source-map.d307e4ea.mjs';
18
18
  import './spy.mjs';
19
19
  import 'tinyspy';
20
- import './chunk-defaults.1c51d585.mjs';
20
+ import './chunk-defaults.8390340d.mjs';
21
21
  import 'module';
22
22
  import 'url';
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'fs';
2
- import { c as createBirpc } from './chunk-vite-node-client.a247c2c2.mjs';
2
+ import { c as createBirpc } from './chunk-vite-node-client.b59ba135.mjs';
3
3
  import require$$0$1 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$3 from 'net';
@@ -9,15 +9,15 @@ 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.16825f0c.mjs';
13
- import { j as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.8198ebd9.mjs';
12
+ import { A as API_PATH } from './chunk-constants.9da1ef26.mjs';
13
+ import { j as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.d307e4ea.mjs';
14
14
  import 'module';
15
15
  import 'vm';
16
- import './chunk-mock-date.9160e13b.mjs';
16
+ import './chunk-mock-date.ea3b3121.mjs';
17
17
  import 'path';
18
18
  import 'tty';
19
19
  import 'local-pkg';
20
- import './chunk-vite-node-utils.9dfd1e3f.mjs';
20
+ import './chunk-vite-node-utils.96438e82.mjs';
21
21
  import 'assert';
22
22
  import 'util';
23
23
  import 'debug';
@@ -1,5 +1,5 @@
1
1
  import _url from 'url';
2
- import { y as resolve } from './chunk-mock-date.9160e13b.mjs';
2
+ import { y as resolve } from './chunk-mock-date.ea3b3121.mjs';
3
3
 
4
4
  const rootDir = resolve(_url.fileURLToPath(import.meta.url), "../../");
5
5
  const distDir = resolve(_url.fileURLToPath(import.meta.url), "../../dist");
@@ -1,7 +1,7 @@
1
1
  import { existsSync, promises } from 'fs';
2
2
  import { createRequire } from 'module';
3
3
  import _url from 'url';
4
- import { t as toArray, y as resolve } from './chunk-mock-date.9160e13b.mjs';
4
+ import { t as toArray, y as resolve } from './chunk-mock-date.ea3b3121.mjs';
5
5
  import { importModule } from 'local-pkg';
6
6
 
7
7
  /*
@@ -551,7 +551,7 @@ function isClassLikeName(name) {
551
551
  function populateGlobal(global, win, options = {}) {
552
552
  const { bindFunctions = false } = options;
553
553
  const keys = getWindowKeys(global, win);
554
- const originals = new Map(allowRewrite.map(([key]) => [key, global[key]]));
554
+ const originals = new Map(allowRewrite.filter((key) => key in global).map((key) => [key, global[key]]));
555
555
  const overrideObject = /* @__PURE__ */ new Map();
556
556
  for (const key of keys) {
557
557
  const boundFunction = bindFunctions && typeof win[key] === "function" && !isClassLikeName(key) && win[key].bind(win);
@@ -1,19 +1,19 @@
1
- import { g as globalApis } from './chunk-constants.16825f0c.mjs';
2
- import { i as index } from './chunk-runtime-hooks.3ee34848.mjs';
1
+ import { g as globalApis } from './chunk-constants.9da1ef26.mjs';
2
+ import { i as index } from './chunk-runtime-hooks.291644ec.mjs';
3
3
  import 'url';
4
- import './chunk-mock-date.9160e13b.mjs';
4
+ import './chunk-mock-date.ea3b3121.mjs';
5
5
  import 'path';
6
6
  import 'tty';
7
7
  import 'local-pkg';
8
- import './chunk-runtime-chain.b6c2cdbc.mjs';
8
+ import './chunk-runtime-chain.44b4224d.mjs';
9
9
  import 'util';
10
10
  import 'chai';
11
11
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
12
- import './chunk-runtime-rpc.dbf0b31d.mjs';
12
+ import './chunk-runtime-rpc.fc50dcc0.mjs';
13
13
  import './chunk-utils-global.fa20c2f6.mjs';
14
14
  import './chunk-utils-timers.b48455ed.mjs';
15
15
  import 'fs';
16
- import './chunk-utils-source-map.8198ebd9.mjs';
16
+ import './chunk-utils-source-map.d307e4ea.mjs';
17
17
  import './spy.mjs';
18
18
  import 'tinyspy';
19
19
 
@@ -299,18 +299,21 @@ function isFinalObj(obj) {
299
299
  return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
300
300
  }
301
301
  function collectOwnProperties(obj, collector) {
302
- const props = Object.getOwnPropertyNames(obj);
303
- const symbols = Object.getOwnPropertySymbols(obj);
304
- props.forEach((prop) => collector.add(prop));
305
- symbols.forEach((symbol) => collector.add(symbol));
302
+ const collect = typeof collector === "function" ? collector : (key) => collector.add(key);
303
+ Object.getOwnPropertyNames(obj).forEach(collect);
304
+ Object.getOwnPropertySymbols(obj).forEach(collect);
306
305
  }
307
- function getAllProperties(obj) {
306
+ function getAllMockableProperties(obj) {
308
307
  const allProps = /* @__PURE__ */ new Set();
309
308
  let curr = obj;
310
309
  do {
311
310
  if (isFinalObj(curr))
312
311
  break;
313
- collectOwnProperties(curr, allProps);
312
+ collectOwnProperties(curr, (key) => {
313
+ const descriptor = Object.getOwnPropertyDescriptor(curr, key);
314
+ if (descriptor)
315
+ allProps.add({ key, descriptor });
316
+ });
314
317
  } while (curr = Object.getPrototypeOf(curr));
315
318
  return Array.from(allProps);
316
319
  }
@@ -549,4 +552,4 @@ class AggregateErrorPonyfill extends Error {
549
552
  }
550
553
  }
551
554
 
552
- export { AggregateErrorPonyfill as A, isAbsolute as B, relative as C, getTests as D, hasFailedSnapshot as E, getSuites as F, normalize as G, deepMerge as H, toNamespacedPath as I, ensurePackageInstalled as J, stdout as K, extname as L, isWindows as M, mergeSlashes as N, getAllProperties as O, RealDate as R, resetModules as a, getNames as b, assertTypes as c, dirname as d, getFullName as e, notNullish as f, getCallLastIndex as g, deepClone as h, isObject as i, join as j, getType as k, isNode as l, mockDate as m, noop as n, relativePath as o, picocolors as p, isBrowser as q, resetDate as r, slash as s, toArray as t, partitionSuiteChildren as u, shuffle as v, hasTests as w, hasFailed as x, resolve as y, basename as z };
555
+ export { AggregateErrorPonyfill as A, isAbsolute as B, relative as C, getTests as D, hasFailedSnapshot as E, getSuites as F, normalize as G, deepMerge as H, toNamespacedPath as I, ensurePackageInstalled as J, stdout as K, extname as L, isWindows as M, mergeSlashes as N, getAllMockableProperties as O, RealDate as R, resetModules as a, getNames as b, assertTypes as c, dirname as d, getFullName as e, notNullish as f, getCallLastIndex as g, deepClone as h, isObject as i, join as j, getType as k, isNode as l, mockDate as m, noop as n, relativePath as o, picocolors as p, isBrowser as q, resetDate as r, slash as s, toArray as t, partitionSuiteChildren as u, shuffle as v, hasTests as w, hasFailed as x, resolve as y, basename as z };
@@ -1,4 +1,4 @@
1
- import { y as resolve } from './chunk-mock-date.9160e13b.mjs';
1
+ import { y as resolve } from './chunk-mock-date.ea3b3121.mjs';
2
2
  import { Buffer } from 'buffer';
3
3
  import path from 'path';
4
4
  import childProcess from 'child_process';
@@ -1,24 +1,26 @@
1
1
  import util$1 from 'util';
2
- import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, b as getNames, c as assertTypes, p as picocolors, e as getFullName, n as noop } from './chunk-mock-date.9160e13b.mjs';
2
+ import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, b as getNames, c as assertTypes, p as picocolors, e as getFullName, n as noop } from './chunk-mock-date.ea3b3121.mjs';
3
3
  import * as chai$2 from 'chai';
4
4
  import { expect, AssertionError, util } from 'chai';
5
5
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
6
- import { r as rpc } from './chunk-runtime-rpc.dbf0b31d.mjs';
6
+ import { r as rpc } from './chunk-runtime-rpc.fc50dcc0.mjs';
7
7
  import fs, { promises } from 'fs';
8
- import { a as plugins_1, f as format_1, g as getOriginalPos, b as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.8198ebd9.mjs';
8
+ import { a as plugins_1, f as format_1, g as getOriginalPos, b as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.d307e4ea.mjs';
9
9
  import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
10
10
  import { isMockFunction } from './spy.mjs';
11
11
  import { s as safeSetTimeout, a as safeClearTimeout } from './chunk-utils-timers.b48455ed.mjs';
12
12
 
13
13
  function createChainable(keys, fn) {
14
- function create(obj) {
14
+ function create(context) {
15
15
  const chain2 = function(...args) {
16
- return fn.apply(obj, args);
16
+ return fn.apply(context, args);
17
17
  };
18
+ Object.assign(chain2, fn);
19
+ chain2.withContext = () => chain2.bind(context);
18
20
  for (const key of keys) {
19
21
  Object.defineProperty(chain2, key, {
20
22
  get() {
21
- return create({ ...obj, [key]: true });
23
+ return create({ ...context, [key]: true });
22
24
  }
23
25
  });
24
26
  }
@@ -1233,8 +1235,13 @@ const JestChaiExpect = (chai, utils) => {
1233
1235
  args[0] = args[0].map((key) => key.replace(/([.[\]])/g, "\\$1")).join(".");
1234
1236
  const actual = this._obj;
1235
1237
  const [propertyName, expected] = args;
1236
- const { value, exists } = utils.getPathInfo(actual, propertyName);
1237
- const pass = exists && (args.length === 1 || equals(expected, value));
1238
+ let pass = false;
1239
+ if (Object.prototype.hasOwnProperty.call(actual, propertyName)) {
1240
+ pass = true;
1241
+ } else {
1242
+ const { value, exists } = utils.getPathInfo(actual, propertyName);
1243
+ pass = exists && (args.length === 1 || equals(expected, value));
1244
+ }
1238
1245
  return this.assert(pass, "expected #{this} to have property #{exp}", "expected #{this} to not have property #{exp}", expected, actual);
1239
1246
  });
1240
1247
  def("toBeCloseTo", function(received, precision = 2) {
@@ -2007,11 +2014,12 @@ function createSuiteCollector(name, factory = () => {
2007
2014
  return collector;
2008
2015
  }
2009
2016
  function createSuite() {
2010
- const suite2 = createChainable(["concurrent", "shuffle", "skip", "only", "todo"], function(name, factory) {
2017
+ function suiteFn(name, factory) {
2011
2018
  const mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
2012
2019
  return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle);
2013
- });
2014
- suite2.each = (cases) => {
2020
+ }
2021
+ suiteFn.each = function(cases) {
2022
+ const suite2 = this.withContext();
2015
2023
  return (name, fn) => {
2016
2024
  cases.forEach((i, idx) => {
2017
2025
  const items = Array.isArray(i) ? i : [i];
@@ -2019,23 +2027,24 @@ function createSuite() {
2019
2027
  });
2020
2028
  };
2021
2029
  };
2022
- suite2.skipIf = (condition) => condition ? suite2.skip : suite2;
2023
- suite2.runIf = (condition) => condition ? suite2 : suite2.skip;
2024
- return suite2;
2030
+ suiteFn.skipIf = (condition) => condition ? suite.skip : suite;
2031
+ suiteFn.runIf = (condition) => condition ? suite : suite.skip;
2032
+ return createChainable(["concurrent", "shuffle", "skip", "only", "todo"], suiteFn);
2025
2033
  }
2026
2034
  function createTest(fn) {
2027
- const test2 = createChainable(["concurrent", "skip", "only", "todo", "fails"], fn);
2028
- test2.each = (cases) => {
2029
- return (name, fn2) => {
2035
+ const testFn = fn;
2036
+ testFn.each = function(cases) {
2037
+ const test2 = this.withContext();
2038
+ return (name, fn2, timeout) => {
2030
2039
  cases.forEach((i, idx) => {
2031
2040
  const items = Array.isArray(i) ? i : [i];
2032
- test2(formatTitle(name, items, idx), () => fn2(...items));
2041
+ test2(formatTitle(name, items, idx), () => fn2(...items), timeout);
2033
2042
  });
2034
2043
  };
2035
2044
  };
2036
- test2.skipIf = (condition) => condition ? test2.skip : test2;
2037
- test2.runIf = (condition) => condition ? test2 : test2.skip;
2038
- return test2;
2045
+ testFn.skipIf = (condition) => condition ? test.skip : test;
2046
+ testFn.runIf = (condition) => condition ? test : test.skip;
2047
+ return createChainable(["concurrent", "skip", "only", "todo", "fails"], testFn);
2039
2048
  }
2040
2049
 
2041
2050
  export { GLOBAL_EXPECT as G, getDefaultHookTimeout as a, globalExpect as b, createExpect as c, describe as d, clearCollectorContext as e, defaultSuite as f, getCurrentSuite as g, setHooks as h, it as i, getHooks as j, collectorContext as k, setState as l, getFn as m, getState as n, createSuiteHooks as o, chai$1 as p, suite as s, test as t, withTimeout as w };
@@ -1,11 +1,11 @@
1
- import { e as environments, t as takeCoverage, p as pLimit } from './chunk-defaults.1c51d585.mjs';
2
- import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.3ee34848.mjs';
3
- import { h as deepClone, k as getType, l as isNode, R as RealDate, t as toArray, o as relativePath, q as isBrowser, u as partitionSuiteChildren, v as shuffle, w as hasTests, x as hasFailed, e as getFullName } from './chunk-mock-date.9160e13b.mjs';
4
- import { e as clearCollectorContext, f as defaultSuite, h as setHooks, j as getHooks, k as collectorContext, l as setState, G as GLOBAL_EXPECT, m as getFn, n as getState } from './chunk-runtime-chain.b6c2cdbc.mjs';
5
- import { r as rpc } from './chunk-runtime-rpc.dbf0b31d.mjs';
1
+ import { e as environments, t as takeCoverage, p as pLimit } from './chunk-defaults.8390340d.mjs';
2
+ import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.291644ec.mjs';
3
+ import { h as deepClone, k as getType, l as isNode, R as RealDate, t as toArray, o as relativePath, q as isBrowser, u as partitionSuiteChildren, v as shuffle, w as hasTests, x as hasFailed, e as getFullName } from './chunk-mock-date.ea3b3121.mjs';
4
+ import { e as clearCollectorContext, f as defaultSuite, h as setHooks, j as getHooks, k as collectorContext, l as setState, G as GLOBAL_EXPECT, m as getFn, n as getState } from './chunk-runtime-chain.44b4224d.mjs';
5
+ import { r as rpc } from './chunk-runtime-rpc.fc50dcc0.mjs';
6
6
  import util$1 from 'util';
7
7
  import { util } from 'chai';
8
- import { s as stringify } from './chunk-utils-source-map.8198ebd9.mjs';
8
+ import { s as stringify } from './chunk-utils-source-map.d307e4ea.mjs';
9
9
  import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
10
10
  import { a as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.b48455ed.mjs';
11
11
 
@@ -123,6 +123,7 @@ async function setupGlobalEnv(config) {
123
123
  value: index,
124
124
  enumerable: false
125
125
  });
126
+ Error.stackTraceLimit = 100;
126
127
  setupDefines(config.defines);
127
128
  if (globalSetup)
128
129
  return;
@@ -130,7 +131,7 @@ async function setupGlobalEnv(config) {
130
131
  if (isNode)
131
132
  await setupConsoleLogSpy();
132
133
  if (config.globals)
133
- (await import('./chunk-integrations-globals.56a11010.mjs')).registerApiGlobally();
134
+ (await import('./chunk-integrations-globals.a798d352.mjs')).registerApiGlobally();
134
135
  }
135
136
  function setupDefines(defines) {
136
137
  for (const key in defines)
@@ -441,7 +442,7 @@ async function sendTasksUpdate() {
441
442
  async function runTest(test) {
442
443
  var _a, _b;
443
444
  if (test.mode !== "run") {
444
- const { getSnapshotClient } = await import('./chunk-runtime-chain.b6c2cdbc.mjs').then(function (n) { return n.p; });
445
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
445
446
  getSnapshotClient().skipTestSnapshots(test);
446
447
  return;
447
448
  }
@@ -457,7 +458,7 @@ async function runTest(test) {
457
458
  updateTask(test);
458
459
  clearModuleMocks();
459
460
  if (isNode) {
460
- const { getSnapshotClient } = await import('./chunk-runtime-chain.b6c2cdbc.mjs').then(function (n) { return n.p; });
461
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
461
462
  await getSnapshotClient().setTest(test);
462
463
  }
463
464
  const workerState = getWorkerState();
@@ -510,7 +511,7 @@ async function runTest(test) {
510
511
  if (isBrowser && test.result.error)
511
512
  console.error(test.result.error.message, test.result.error.stackStr);
512
513
  if (isNode) {
513
- const { getSnapshotClient } = await import('./chunk-runtime-chain.b6c2cdbc.mjs').then(function (n) { return n.p; });
514
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
514
515
  getSnapshotClient().clearTest();
515
516
  }
516
517
  test.result.duration = now() - start;
@@ -622,7 +623,7 @@ async function startTestsBrowser(paths, config) {
622
623
  async function startTestsNode(paths, config) {
623
624
  const files = await collectTests(paths, config);
624
625
  rpc().onCollected(files);
625
- const { getSnapshotClient } = await import('./chunk-runtime-chain.b6c2cdbc.mjs').then(function (n) { return n.p; });
626
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
626
627
  getSnapshotClient().clear();
627
628
  await runFiles(files, config);
628
629
  takeCoverage();
@@ -1,7 +1,7 @@
1
- import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, c as createExpect, b as globalExpect } from './chunk-runtime-chain.b6c2cdbc.mjs';
2
- import { R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.9160e13b.mjs';
1
+ import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, c as createExpect, b as globalExpect } from './chunk-runtime-chain.44b4224d.mjs';
2
+ import { R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.ea3b3121.mjs';
3
3
  import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
4
- import { p as parseStacktrace } from './chunk-utils-source-map.8198ebd9.mjs';
4
+ import { p as parseStacktrace } from './chunk-utils-source-map.d307e4ea.mjs';
5
5
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
6
6
  import util from 'util';
7
7
  import { spyOn, fn, isMockFunction, spies } from './spy.mjs';
@@ -2747,7 +2747,7 @@ class VitestUtils {
2747
2747
  async importMock(path) {
2748
2748
  return this._mocker.importMock(path, this.getImporter());
2749
2749
  }
2750
- mocked(item, _deep = false) {
2750
+ mocked(item, _options = {}) {
2751
2751
  return item;
2752
2752
  }
2753
2753
  isMockFunction(fn2) {
@@ -1,9 +1,9 @@
1
- import { V as ViteNodeRunner } from './chunk-vite-node-client.a247c2c2.mjs';
1
+ import { V as ViteNodeRunner } from './chunk-vite-node-client.b59ba135.mjs';
2
2
  import { normalizePath } from 'vite';
3
- import { M as isWindows, N as mergeSlashes, d as dirname, j as join, z as basename, y as resolve, s as slash, k as getType, O as getAllProperties } from './chunk-mock-date.9160e13b.mjs';
3
+ import { M as isWindows, N as mergeSlashes, d as dirname, j as join, z as basename, y as resolve, s as slash, k as getType, O as getAllMockableProperties } from './chunk-mock-date.ea3b3121.mjs';
4
4
  import { existsSync, readdirSync } from 'fs';
5
- import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.9dfd1e3f.mjs';
6
- import { d as distDir } from './chunk-constants.16825f0c.mjs';
5
+ import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.96438e82.mjs';
6
+ import { d as distDir } from './chunk-constants.9da1ef26.mjs';
7
7
  import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
8
8
 
9
9
  class RefTracker {
@@ -123,13 +123,20 @@ const _VitestMocker = class {
123
123
  const spyModule = _VitestMocker.spyModule;
124
124
  const finalizers = new Array();
125
125
  const refs = new RefTracker();
126
+ const define = (container, key, value) => {
127
+ try {
128
+ container[key] = value;
129
+ return true;
130
+ } catch {
131
+ return false;
132
+ }
133
+ };
126
134
  const mockPropertiesOf = (container, newContainer) => {
127
135
  const containerType = getType(container);
128
136
  const isModule = containerType === "Module" || !!container.__esModule;
129
- for (const property of getAllProperties(container)) {
137
+ for (const { key: property, descriptor } of getAllMockableProperties(container)) {
130
138
  if (!isModule) {
131
- const descriptor = Object.getOwnPropertyDescriptor(container, property);
132
- if ((descriptor == null ? void 0 : descriptor.get) || (descriptor == null ? void 0 : descriptor.set))
139
+ if (descriptor.get || descriptor.set)
133
140
  continue;
134
141
  }
135
142
  if (isSpecialProp(property, containerType))
@@ -137,20 +144,21 @@ const _VitestMocker = class {
137
144
  const value = container[property];
138
145
  const refId = refs.getId(value);
139
146
  if (refId) {
140
- finalizers.push(() => newContainer[property] = refs.getMockedValue(refId));
147
+ finalizers.push(() => define(newContainer, property, refs.getMockedValue(refId)));
141
148
  continue;
142
149
  }
143
150
  const type = getType(value);
144
151
  if (Array.isArray(value)) {
145
- newContainer[property] = [];
152
+ define(newContainer, property, []);
146
153
  continue;
147
154
  }
148
155
  const isFunction = type.includes("Function") && typeof value === "function";
149
156
  if ((!isFunction || value.__isMockFunction) && type !== "Object" && type !== "Module") {
150
- newContainer[property] = value;
157
+ define(newContainer, property, value);
151
158
  continue;
152
159
  }
153
- newContainer[property] = isFunction ? value : {};
160
+ if (!define(newContainer, property, isFunction ? value : {}))
161
+ continue;
154
162
  if (isFunction) {
155
163
  spyModule.spyOn(newContainer, property).mockImplementation(() => void 0);
156
164
  Object.defineProperty(newContainer[property], "length", { value: 0 });
@@ -1,4 +1,4 @@
1
- import './chunk-mock-date.9160e13b.mjs';
1
+ import './chunk-mock-date.ea3b3121.mjs';
2
2
  import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
3
3
  import { w as withSafeTimers } from './chunk-utils-timers.b48455ed.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { s as slash, f as notNullish, p as picocolors } from './chunk-mock-date.9160e13b.mjs';
1
+ import { s as slash, f as notNullish, p as picocolors } from './chunk-mock-date.ea3b3121.mjs';
2
2
 
3
3
  var build = {};
4
4
 
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from 'module';
2
2
  import { pathToFileURL, fileURLToPath } from 'url';
3
3
  import vm from 'vm';
4
- import { y as resolve, d as dirname, B as isAbsolute, L as extname } from './chunk-mock-date.9160e13b.mjs';
5
- import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.9dfd1e3f.mjs';
4
+ import { y as resolve, d as dirname, B as isAbsolute, L as extname } from './chunk-mock-date.ea3b3121.mjs';
5
+ import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.96438e82.mjs';
6
6
  import createDebug from 'debug';
7
7
 
8
8
  const debugExecute = createDebug("vite-node:client:execute");
@@ -1,5 +1,5 @@
1
1
  import { existsSync, promises } from 'fs';
2
- import { y as resolve, p as picocolors, j as join } from './chunk-mock-date.9160e13b.mjs';
2
+ import { y as resolve, p as picocolors, j as join } from './chunk-mock-date.ea3b3121.mjs';
3
3
  import 'path';
4
4
  import 'tty';
5
5
  import 'local-pkg';