vitest 5.0.0-beta.5 → 5.0.0-beta.6

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 (46) hide show
  1. package/dist/browser.d.ts +2 -2
  2. package/dist/browser.js +2 -2
  3. package/dist/chunks/{artifact.C0OHWdod.js → artifact.BNnEI1sJ.js} +5 -5
  4. package/dist/chunks/{base.BPbmtl-C.js → base.BKfXyFN7.js} +7 -7
  5. package/dist/chunks/{browser.d.B-p-y0sB.d.ts → browser.d.DoM6vBOs.d.ts} +3 -3
  6. package/dist/chunks/{cac.DYQRhgb-.js → cac.DKrA6qEB.js} +6 -6
  7. package/dist/chunks/{cli-api.SMst4llK.js → cli-api.cZcvaUFI.js} +280 -76
  8. package/dist/chunks/{config.d.Bkl6J5iR.d.ts → config.d.CKWK3nld.d.ts} +6 -2
  9. package/dist/chunks/{coverage.d.Dn6XbyQq.d.ts → coverage.d.CCNrKR65.d.ts} +1 -1
  10. package/dist/chunks/{creator.CJiHagNv.js → creator.C4nK7Krt.js} +3 -3
  11. package/dist/chunks/{defaults.CUUnbOrq.js → defaults.B_pFOTYy.js} +1 -1
  12. package/dist/chunks/{globals.D2wDMk06.js → globals.CzUA1xn8.js} +4 -4
  13. package/dist/chunks/{index.DugGyGng.js → index.B4UTDegh.js} +3 -3
  14. package/dist/chunks/{index.CXzZ7KB8.js → index.D6NDM5O1.js} +497 -118
  15. package/dist/chunks/{index.DzNNaFWy.js → index.DNRmy2jU.js} +22 -7
  16. package/dist/chunks/{index.6dZyLbho.js → index.Djaij2xr.js} +58 -16
  17. package/dist/chunks/{init-forks.CDWjf0q6.js → init-forks.BG4bCDny.js} +1 -1
  18. package/dist/chunks/{init-threads.B-vZ8N2q.js → init-threads.DLtIP5Qq.js} +1 -1
  19. package/dist/chunks/{init.gslB1aqB.js → init.DTAQFCjl.js} +2 -2
  20. package/dist/chunks/{nativeModuleMocker.CrcWvO03.js → nativeModuleMocker.BKtCThoO.js} +1 -1
  21. package/dist/chunks/{plugin.d.BuiCQSo8.d.ts → plugin.d.Bpge8Jye.d.ts} +51 -30
  22. package/dist/chunks/{rpc.d.BLxNuPAq.d.ts → rpc.d.C6-dGZ2f.d.ts} +1 -1
  23. package/dist/chunks/{setup-common.DRlwpHsL.js → setup-common.ZNdeu5wa.js} +1 -1
  24. package/dist/chunks/{task-utils.d.CLWcZaUf.d.ts → task-utils.d.mMDXJF_I.d.ts} +20 -1
  25. package/dist/chunks/{vm._FqKqltU.js → vm.CeHWcIrU.js} +2 -2
  26. package/dist/chunks/{worker.d.Cb0Z-SnE.d.ts → worker.d.JES7ffPK.d.ts} +2 -2
  27. package/dist/cli.js +1 -1
  28. package/dist/config.cjs +1 -1
  29. package/dist/config.d.ts +8 -8
  30. package/dist/config.js +1 -1
  31. package/dist/index.d.ts +237 -12
  32. package/dist/index.js +6 -6
  33. package/dist/module-evaluator.d.ts +2 -2
  34. package/dist/module-evaluator.js +7 -0
  35. package/dist/node.d.ts +25 -14
  36. package/dist/node.js +9 -8
  37. package/dist/runtime.d.ts +3 -3
  38. package/dist/runtime.js +2 -2
  39. package/dist/worker.d.ts +3 -3
  40. package/dist/worker.js +7 -7
  41. package/dist/workers/forks.js +8 -8
  42. package/dist/workers/runVmTests.js +7 -7
  43. package/dist/workers/threads.js +8 -8
  44. package/dist/workers/vmForks.js +4 -4
  45. package/dist/workers/vmThreads.js +4 -4
  46. package/package.json +17 -17
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a4 as SerializedCoverageConfig, aH as FileSpecification, V as VitestRunner, F as File, n as SerializedConfig } from './chunks/config.d.Bkl6J5iR.js';
2
- import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.Dn6XbyQq.js';
1
+ import { a4 as SerializedCoverageConfig, aH as FileSpecification, V as VitestRunner, F as File, n as SerializedConfig } from './chunks/config.d.CKWK3nld.js';
2
+ import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.CCNrKR65.js';
3
3
  import { SerializedDiffOptions } from '@vitest/utils/diff';
4
4
  import * as _vitest_spy from '@vitest/spy';
5
5
  export { _vitest_spy as SpyModule };
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.DRlwpHsL.js';
2
- export { p as collectTests, s as startTests } from './chunks/artifact.C0OHWdod.js';
1
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.ZNdeu5wa.js';
2
+ export { p as collectTests, s as startTests } from './chunks/artifact.BNnEI1sJ.js';
3
3
  import * as spyModule from '@vitest/spy';
4
4
  export { spyModule as SpyModule };
5
5
  export { format, inspect, stringify } from '@vitest/utils/display';
@@ -473,7 +473,7 @@ function resolveDeps(usedFixtures, registrations, depSet = /* @__PURE__ */ new S
473
473
  if (depSet.has(fixture)) if (fixture.parent) fixture = fixture.parent;
474
474
  else throw new Error(`Circular fixture dependency detected: ${fixture.name} <- ${[...depSet].reverse().map((d) => d.name).join(" <- ")}`);
475
475
  depSet.add(fixture);
476
- resolveDeps([...fixture.deps].map((n) => n === fixture.name ? fixture.parent : registrations.get(n)).filter((n) => !!n), registrations, depSet, pendingFixtures);
476
+ resolveDeps(Array.from(fixture.deps, (n) => n === fixture.name ? fixture.parent : registrations.get(n)).filter((n) => !!n), registrations, depSet, pendingFixtures);
477
477
  pendingFixtures.push(fixture);
478
478
  depSet.clear();
479
479
  });
@@ -2263,7 +2263,7 @@ function throttle(fn, ms) {
2263
2263
  return fn.apply(this, args);
2264
2264
  }
2265
2265
  // Make sure fn is still called even if there are no further calls
2266
- pendingCall ??= setTimeout(() => call.bind(this)(...args), ms);
2266
+ pendingCall ??= setTimeout(call.bind(this), ms, ...args);
2267
2267
  };
2268
2268
  }
2269
2269
  // throttle based on summary reporter's DURATION_UPDATE_INTERVAL_MS
@@ -2294,9 +2294,9 @@ async function callCleanupHooks(runner, cleanups) {
2294
2294
  */
2295
2295
  function passesRetryCondition(test, errors) {
2296
2296
  const condition = getRetryCondition(test.retry);
2297
- if (!errors || errors.length === 0) return false;
2297
+ const error = errors?.at(-1);
2298
+ if (error == null) return false;
2298
2299
  if (!condition) return true;
2299
- const error = errors[errors.length - 1];
2300
2300
  if (condition instanceof RegExp) return condition.test(error.message || "");
2301
2301
  else if (typeof condition === "function") return condition(error);
2302
2302
  return false;
@@ -2612,7 +2612,7 @@ async function startTests(specs, runner) {
2612
2612
  };
2613
2613
  if (!workerRunners.has(runner)) {
2614
2614
  runner.onCleanupWorkerContext?.(async () => {
2615
- await Promise.all([...TestFixtures.getWorkerContexts()].map((context) => callFixtureCleanup(context))).finally(() => {
2615
+ await Promise.all(Array.from(TestFixtures.getWorkerContexts(), (context) => callFixtureCleanup(context))).finally(() => {
2616
2616
  TestFixtures.clearDefinitions();
2617
2617
  });
2618
2618
  });
@@ -1,16 +1,16 @@
1
1
  import { runInThisContext } from 'node:vm';
2
2
  import * as spyModule from '@vitest/spy';
3
- import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.DugGyGng.js';
4
- import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.gslB1aqB.js';
3
+ import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.B4UTDegh.js';
4
+ import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.DTAQFCjl.js';
5
5
  import { N as NativeModuleRunner } from './nativeModuleRunner.WlMdOB52.js';
6
6
  import { Traces } from '../traces.js';
7
7
  import { V as VitestEvaluatedModules } from './rpc.DZEh5xnQ.js';
8
- import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.DzNNaFWy.js';
8
+ import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.DNRmy2jU.js';
9
9
  import { performance as performance$1 } from 'node:perf_hooks';
10
- import { s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker } from './setup-common.DRlwpHsL.js';
11
- import { i as index, g as globalExpect, v as vi } from './index.CXzZ7KB8.js';
10
+ import { s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker } from './setup-common.ZNdeu5wa.js';
11
+ import { i as index, g as globalExpect, v as vi } from './index.D6NDM5O1.js';
12
12
  import { c as closeInspector } from './inspector.CvyFGlXm.js';
13
- import { s as startTests, p as publicCollect } from './artifact.C0OHWdod.js';
13
+ import { s as startTests, p as publicCollect } from './artifact.BNnEI1sJ.js';
14
14
  import { createRequire } from 'node:module';
15
15
  import timers from 'node:timers';
16
16
  import timersPromises from 'node:timers/promises';
@@ -114,7 +114,7 @@ async function startModuleRunner(options) {
114
114
  let mocker;
115
115
  if (options.state.config.experimental.nodeLoader !== false) {
116
116
  // this additionally imports acorn/magic-string
117
- const { NativeModuleMocker } = await import('./nativeModuleMocker.CrcWvO03.js');
117
+ const { NativeModuleMocker } = await import('./nativeModuleMocker.BKtCThoO.js');
118
118
  mocker = new NativeModuleMocker({
119
119
  async resolveId(id, importer) {
120
120
  // TODO: use import.meta.resolve instead
@@ -1,6 +1,6 @@
1
- import { aH as FileSpecification } from './config.d.Bkl6J5iR.js';
2
- import { O as OTELCarrier } from './rpc.d.BLxNuPAq.js';
3
- import { T as TestExecutionMethod } from './worker.d.Cb0Z-SnE.js';
1
+ import { aH as FileSpecification } from './config.d.CKWK3nld.js';
2
+ import { O as OTELCarrier } from './rpc.d.C6-dGZ2f.js';
3
+ import { T as TestExecutionMethod } from './worker.d.JES7ffPK.js';
4
4
 
5
5
  type SerializedTestSpecification = [project: {
6
6
  name: string | undefined;
@@ -621,7 +621,7 @@ class CAC extends EventEmitter {
621
621
 
622
622
  const cac = (name = "") => new CAC(name);
623
623
 
624
- var version = "5.0.0-beta.5";
624
+ var version = "5.0.0-beta.6";
625
625
 
626
626
  const apiConfig = (port) => ({
627
627
  port: {
@@ -2349,7 +2349,7 @@ function normalizeCliOptions(cliFilters, argv) {
2349
2349
  }
2350
2350
  async function start(cliFilters, options) {
2351
2351
  try {
2352
- const { startVitest } = await import('./cli-api.SMst4llK.js').then(function (n) { return n.y; });
2352
+ const { startVitest } = await import('./cli-api.cZcvaUFI.js').then(function (n) { return n.y; });
2353
2353
  const ctx = await startVitest(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
2354
2354
  if (!ctx.shouldKeepServer()) await ctx.exit();
2355
2355
  } catch (e) {
@@ -2357,7 +2357,7 @@ async function start(cliFilters, options) {
2357
2357
  console.error(`\n${errorBanner("Startup Error")}`);
2358
2358
  console.error(e);
2359
2359
  console.error("\n\n");
2360
- if (process.exitCode == null) process.exitCode = 1;
2360
+ process.exitCode ??= 1;
2361
2361
  process.exit();
2362
2362
  }
2363
2363
  }
@@ -2366,12 +2366,12 @@ async function init(project) {
2366
2366
  console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
2367
2367
  process.exit(1);
2368
2368
  }
2369
- const { create } = await import('./creator.CJiHagNv.js');
2369
+ const { create } = await import('./creator.C4nK7Krt.js');
2370
2370
  await create();
2371
2371
  }
2372
2372
  async function collect(cliFilters, options) {
2373
2373
  try {
2374
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.SMst4llK.js').then(function (n) { return n.y; });
2374
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.cZcvaUFI.js').then(function (n) { return n.y; });
2375
2375
  const ctx = await prepareVitest({
2376
2376
  ...normalizeCliOptions(cliFilters, options),
2377
2377
  watch: false,
@@ -2397,7 +2397,7 @@ async function collect(cliFilters, options) {
2397
2397
  console.error(`\n${errorBanner("Collect Error")}`);
2398
2398
  console.error(e);
2399
2399
  console.error("\n\n");
2400
- if (process.exitCode == null) process.exitCode = 1;
2400
+ process.exitCode ??= 1;
2401
2401
  process.exit();
2402
2402
  }
2403
2403
  }