vitest 1.4.0 → 1.5.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 (44) hide show
  1. package/dist/browser.d.ts +4 -1
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{integrations-globals.trMeEBob.js → integrations-globals.2J_Aii2q.js} +3 -3
  4. package/dist/chunks/{runtime-console.tUKE_2UJ.js → runtime-console.kbFEN7E-.js} +14 -6
  5. package/dist/chunks/{runtime-runBaseTests.SKlFOhuq.js → runtime-runBaseTests.3fVSWBsC.js} +11 -9
  6. package/dist/cli-wrapper.js +1 -1
  7. package/dist/cli.js +6 -6
  8. package/dist/config.cjs +1 -0
  9. package/dist/config.d.ts +1 -1
  10. package/dist/config.js +1 -0
  11. package/dist/coverage.d.ts +1 -1
  12. package/dist/environments.d.ts +1 -1
  13. package/dist/execute.d.ts +1 -1
  14. package/dist/index.d.ts +3 -3
  15. package/dist/index.js +3 -3
  16. package/dist/node.d.ts +2 -2
  17. package/dist/node.js +6 -6
  18. package/dist/{reporters-P7C2ytIv.d.ts → reporters-LqC_WI4d.d.ts} +36 -8
  19. package/dist/reporters.d.ts +1 -1
  20. package/dist/reporters.js +3 -3
  21. package/dist/runners.d.ts +1 -1
  22. package/dist/runners.js +3 -3
  23. package/dist/{suite-a18diDsI.d.ts → suite-ynYMzeLu.d.ts} +1 -1
  24. package/dist/suite.d.ts +2 -2
  25. package/dist/vendor/{base.nhvUBzQY.js → base.BjeeYg4o.js} +1 -1
  26. package/dist/vendor/{cac.RvTIWZBK.js → cac.qnW6GNL2.js} +156 -74
  27. package/dist/vendor/{constants.K-Wf1PUy.js → constants.5J7I254_.js} +2 -1
  28. package/dist/vendor/{index.LNWuEnUT.js → index.-ITFwqG_.js} +1 -1
  29. package/dist/vendor/{index.BeX1oZht.js → index.12jbrDSD.js} +1 -1
  30. package/dist/vendor/{index.e9RDLAeW.js → index.kSaPvGW6.js} +32 -7
  31. package/dist/vendor/inspector.IgLX3ur5.js +54 -0
  32. package/dist/vendor/{setup-common.vyF1kALR.js → setup-common.A1De6efh.js} +8 -1
  33. package/dist/vendor/{utils.w0xgzP1h.js → utils.0uYuCbzo.js} +5 -2
  34. package/dist/vendor/{vi.JYQecGiw.js → vi.Fxjax7rQ.js} +21 -20
  35. package/dist/vendor/{vm.cAHVDF92.js → vm.I_IsyNig.js} +2 -2
  36. package/dist/worker.js +2 -39
  37. package/dist/workers/forks.js +2 -2
  38. package/dist/workers/runVmTests.js +10 -4
  39. package/dist/workers/threads.js +2 -2
  40. package/dist/workers/vmForks.js +7 -7
  41. package/dist/workers/vmThreads.js +7 -7
  42. package/dist/workers.d.ts +1 -1
  43. package/dist/workers.js +8 -7
  44. package/package.json +11 -11
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { processError, startTests } from '@vitest/runner';
2
- import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-P7C2ytIv.js';
2
+ import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-LqC_WI4d.js';
3
3
  import { VitestExecutor } from './execute.js';
4
4
  import 'vite';
5
5
  import 'vite-node';
@@ -37,6 +37,9 @@ interface DiffOptions {
37
37
  omitAnnotationLines?: boolean;
38
38
  patchColor?: Formatter;
39
39
  compareKeys?: any;
40
+ truncateThreshold?: number;
41
+ truncateAnnotation?: string;
42
+ truncateAnnotationColor?: Formatter;
40
43
  }
41
44
 
42
45
  declare function setupCommonEnv(config: ResolvedConfig): Promise<void>;
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { processError, startTests } from '@vitest/runner';
2
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './vendor/setup-common.vyF1kALR.js';
2
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './vendor/setup-common.A1De6efh.js';
3
3
  export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor/coverage.E7sG1b3r.js';
4
4
  import '@vitest/utils';
5
5
  import '@vitest/snapshot';
@@ -1,5 +1,5 @@
1
- import { g as globalApis } from '../vendor/constants.K-Wf1PUy.js';
2
- import { V as VitestIndex } from '../vendor/index.BeX1oZht.js';
1
+ import { g as globalApis } from '../vendor/constants.5J7I254_.js';
2
+ import { V as VitestIndex } from '../vendor/index.12jbrDSD.js';
3
3
  import '@vitest/runner';
4
4
  import '../vendor/benchmark.eeqk2rd8.js';
5
5
  import '@vitest/runner/utils';
@@ -9,7 +9,7 @@ import 'pathe';
9
9
  import 'std-env';
10
10
  import '../vendor/global.CkGT_TMy.js';
11
11
  import '../vendor/run-once.Olz_Zkd8.js';
12
- import '../vendor/vi.JYQecGiw.js';
12
+ import '../vendor/vi.Fxjax7rQ.js';
13
13
  import 'chai';
14
14
  import '../vendor/_commonjsHelpers.jjO7Zipk.js';
15
15
  import '@vitest/expect';
@@ -3,6 +3,11 @@ import { Console } from 'node:console';
3
3
  import { relative } from 'node:path';
4
4
  import { getSafeTimers, getColors } from '@vitest/utils';
5
5
  import { R as RealDate } from '../vendor/date.Ns1pGd_X.js';
6
+ import '../vendor/index.ir9i0ywP.js';
7
+ import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
8
+ import 'pathe';
9
+ import 'std-env';
10
+ import '@vitest/runner/utils';
6
11
 
7
12
  const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
8
13
  function getTaskIdByStack(root) {
@@ -10,7 +15,7 @@ function getTaskIdByStack(root) {
10
15
  const stack = (_a = new Error("STACK_TRACE_ERROR").stack) == null ? void 0 : _a.split("\n");
11
16
  if (!stack)
12
17
  return UNKNOWN_TEST_ID;
13
- const index = stack.findIndex((line2) => line2.includes("at Console.value (node:internal/console/"));
18
+ const index = stack.findIndex((line2) => line2.includes("at Console.value"));
14
19
  const line = index === -1 ? null : stack[index + 2];
15
20
  if (!line)
16
21
  return UNKNOWN_TEST_ID;
@@ -19,11 +24,12 @@ function getTaskIdByStack(root) {
19
24
  return relative(root, filepath);
20
25
  return UNKNOWN_TEST_ID;
21
26
  }
22
- function createCustomConsole(state) {
27
+ function createCustomConsole() {
23
28
  const stdoutBuffer = /* @__PURE__ */ new Map();
24
29
  const stderrBuffer = /* @__PURE__ */ new Map();
25
30
  const timers = /* @__PURE__ */ new Map();
26
31
  const { setTimeout, clearTimeout } = getSafeTimers();
32
+ const state = () => getWorkerState();
27
33
  function schedule(taskId) {
28
34
  const timer = timers.get(taskId);
29
35
  const { stdoutTime, stderrTime } = timer;
@@ -44,7 +50,7 @@ function createCustomConsole(state) {
44
50
  return;
45
51
  const content = buffer.map((i) => String(i)).join("");
46
52
  const timer = timers.get(taskId);
47
- state.rpc.onUserConsoleLog({
53
+ state().rpc.onUserConsoleLog({
48
54
  type: "stdout",
49
55
  content: content || "<empty line>",
50
56
  taskId,
@@ -60,7 +66,7 @@ function createCustomConsole(state) {
60
66
  return;
61
67
  const content = buffer.map((i) => String(i)).join("");
62
68
  const timer = timers.get(taskId);
63
- state.rpc.onUserConsoleLog({
69
+ state().rpc.onUserConsoleLog({
64
70
  type: "stderr",
65
71
  content: content || "<empty line>",
66
72
  taskId,
@@ -73,7 +79,8 @@ function createCustomConsole(state) {
73
79
  const stdout = new Writable({
74
80
  write(data, encoding, callback) {
75
81
  var _a, _b, _c;
76
- const id = ((_a = state == null ? void 0 : state.current) == null ? void 0 : _a.id) || ((_c = (_b = state == null ? void 0 : state.current) == null ? void 0 : _b.file) == null ? void 0 : _c.id) || getTaskIdByStack(state.ctx.config.root);
82
+ const s = state();
83
+ const id = ((_a = s == null ? void 0 : s.current) == null ? void 0 : _a.id) || ((_c = (_b = s == null ? void 0 : s.current) == null ? void 0 : _b.file) == null ? void 0 : _c.id) || getTaskIdByStack(s.config.root);
77
84
  let timer = timers.get(id);
78
85
  if (timer) {
79
86
  timer.stdoutTime = timer.stdoutTime || RealDate.now();
@@ -94,7 +101,8 @@ function createCustomConsole(state) {
94
101
  const stderr = new Writable({
95
102
  write(data, encoding, callback) {
96
103
  var _a, _b, _c;
97
- const id = ((_a = state == null ? void 0 : state.current) == null ? void 0 : _a.id) || ((_c = (_b = state == null ? void 0 : state.current) == null ? void 0 : _b.file) == null ? void 0 : _c.id) || getTaskIdByStack(state.ctx.config.root);
104
+ const s = state();
105
+ const id = ((_a = s == null ? void 0 : s.current) == null ? void 0 : _a.id) || ((_c = (_b = s == null ? void 0 : s.current) == null ? void 0 : _b.file) == null ? void 0 : _c.id) || getTaskIdByStack(s.config.root);
98
106
  let timer = timers.get(id);
99
107
  if (timer) {
100
108
  timer.stderrTime = timer.stderrTime || RealDate.now();
@@ -1,18 +1,19 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { startTests } from '@vitest/runner';
3
3
  import '../vendor/index.ir9i0ywP.js';
4
- import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.JYQecGiw.js';
4
+ import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.Fxjax7rQ.js';
5
5
  import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.E7sG1b3r.js';
6
- import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.LNWuEnUT.js';
6
+ import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.-ITFwqG_.js';
7
7
  import { createRequire } from 'node:module';
8
8
  import util from 'node:util';
9
9
  import timers from 'node:timers';
10
10
  import { isatty } from 'node:tty';
11
11
  import { installSourcemapsSupport } from 'vite-node/source-map';
12
12
  import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
13
- import { V as VitestIndex } from '../vendor/index.BeX1oZht.js';
14
- import { s as setupCommonEnv } from '../vendor/setup-common.vyF1kALR.js';
13
+ import { V as VitestIndex } from '../vendor/index.12jbrDSD.js';
14
+ import { s as setupCommonEnv } from '../vendor/setup-common.A1De6efh.js';
15
15
  import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
16
+ import { c as closeInspector } from '../vendor/inspector.IgLX3ur5.js';
16
17
  import 'pathe';
17
18
  import 'std-env';
18
19
  import '@vitest/runner/utils';
@@ -66,11 +67,11 @@ async function setupGlobalEnv(config, { environment }) {
66
67
  getSourceMap: (source) => state.moduleCache.getSourceMap(source)
67
68
  });
68
69
  if (!config.disableConsoleIntercept)
69
- await setupConsoleLogSpy(state);
70
+ await setupConsoleLogSpy();
70
71
  }
71
- async function setupConsoleLogSpy(state) {
72
- const { createCustomConsole } = await import('./runtime-console.tUKE_2UJ.js');
73
- globalThis.console = createCustomConsole(state);
72
+ async function setupConsoleLogSpy() {
73
+ const { createCustomConsole } = await import('./runtime-console.kbFEN7E-.js');
74
+ globalThis.console = createCustomConsole();
74
75
  }
75
76
  async function withEnv({ environment }, options, fn) {
76
77
  globalThis.__vitest_environment__ = environment.name;
@@ -96,7 +97,8 @@ async function run(files, config, environment, executor) {
96
97
  const runner = await resolveTestRunner(config, executor);
97
98
  workerState.onCancel.then((reason) => {
98
99
  var _a;
99
- return (_a = runner.onCancel) == null ? void 0 : _a.call(runner, reason);
100
+ closeInspector(config);
101
+ (_a = runner.onCancel) == null ? void 0 : _a.call(runner, reason);
100
102
  });
101
103
  workerState.durations.prepare = performance.now() - workerState.durations.prepare;
102
104
  workerState.durations.environment = performance.now();
@@ -1,7 +1,7 @@
1
1
  import { fileURLToPath } from 'node:url';
2
2
  import c from 'picocolors';
3
3
  import { execa } from 'execa';
4
- import { E as EXIT_CODE_RESTART } from './vendor/constants.K-Wf1PUy.js';
4
+ import { E as EXIT_CODE_RESTART } from './vendor/constants.5J7I254_.js';
5
5
 
6
6
  const ENTRY = new URL("./cli.js", import.meta.url);
7
7
  const NODE_ARGS = [
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { d as createCLI } from './vendor/cac.RvTIWZBK.js';
1
+ import { d as createCLI } from './vendor/cac.qnW6GNL2.js';
2
2
  import 'pathe';
3
3
  import 'events';
4
4
  import 'picocolors';
@@ -7,16 +7,16 @@ import 'std-env';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import './vendor/global.CkGT_TMy.js';
10
- import './vendor/index.e9RDLAeW.js';
10
+ import './vendor/index.kSaPvGW6.js';
11
11
  import 'node:fs';
12
+ import './vendor/tasks.IknbGB2n.js';
12
13
  import 'node:perf_hooks';
13
- import './chunks/runtime-console.tUKE_2UJ.js';
14
+ import './chunks/runtime-console.kbFEN7E-.js';
14
15
  import 'node:stream';
15
16
  import 'node:console';
16
17
  import 'node:path';
17
18
  import './vendor/date.Ns1pGd_X.js';
18
19
  import './vendor/base.Xt0Omgh7.js';
19
- import './vendor/tasks.IknbGB2n.js';
20
20
  import '@vitest/utils/source-map';
21
21
  import 'node:os';
22
22
  import 'node:module';
@@ -33,9 +33,10 @@ import './vendor/_commonjsHelpers.jjO7Zipk.js';
33
33
  import 'assert';
34
34
  import 'node:crypto';
35
35
  import 'vite-node/utils';
36
- import './vendor/constants.K-Wf1PUy.js';
36
+ import './vendor/constants.5J7I254_.js';
37
37
  import './vendor/coverage.E7sG1b3r.js';
38
38
  import './vendor/index.GVFv9dZ0.js';
39
+ import 'node:worker_threads';
39
40
  import 'os';
40
41
  import './vendor/index.xL8XjTLv.js';
41
42
  import 'util';
@@ -56,7 +57,6 @@ import 'url';
56
57
  import 'node:v8';
57
58
  import 'node:events';
58
59
  import 'tinypool';
59
- import 'node:worker_threads';
60
60
  import 'local-pkg';
61
61
  import 'magic-string';
62
62
  import '@vitest/utils/ast';
package/dist/config.cjs CHANGED
@@ -40,6 +40,7 @@ const coverageConfigDefaults = {
40
40
  reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
41
41
  extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
42
42
  allowExternal: false,
43
+ ignoreEmptyLines: false,
43
44
  processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
44
45
  };
45
46
  const fakeTimersDefaults = {
package/dist/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
2
- export { ax as UserConfigExport, aw as UserConfigFn, au as UserConfigFnObject, av as UserConfigFnPromise, az as UserProjectConfigExport, ay as UserProjectConfigFn, a1 as UserWorkspaceConfig, aD as configDefaults, aG as coverageConfigDefaults, aF as defaultExclude, aE as defaultInclude, aA as defineConfig, aB as defineProject, aC as defineWorkspace, aH as extraInlineDeps } from './reporters-P7C2ytIv.js';
2
+ export { ax as UserConfigExport, aw as UserConfigFn, au as UserConfigFnObject, av as UserConfigFnPromise, az as UserProjectConfigExport, ay as UserProjectConfigFn, a1 as UserWorkspaceConfig, aD as configDefaults, aG as coverageConfigDefaults, aF as defaultExclude, aE as defaultInclude, aA as defineConfig, aB as defineProject, aC as defineWorkspace, aH as extraInlineDeps } from './reporters-LqC_WI4d.js';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
5
5
  import '@vitest/snapshot';
package/dist/config.js CHANGED
@@ -38,6 +38,7 @@ const coverageConfigDefaults = {
38
38
  reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
39
39
  extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
40
40
  allowExternal: false,
41
+ ignoreEmptyLines: false,
41
42
  processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
42
43
  };
43
44
  const fakeTimersDefaults = {
@@ -1,4 +1,4 @@
1
- import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-P7C2ytIv.js';
1
+ import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-LqC_WI4d.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
@@ -1,4 +1,4 @@
1
- import { E as Environment } from './reporters-P7C2ytIv.js';
1
+ import { E as Environment } from './reporters-LqC_WI4d.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/execute.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import vm from 'node:vm';
2
2
  import { ViteNodeRunner } from 'vite-node/client';
3
3
  import { ViteNodeRunnerOptions } from 'vite-node';
4
- import { ar as PendingSuiteMock, as as MockFactory, e as RuntimeRPC, W as WorkerGlobalState, at as MockMap } from './reporters-P7C2ytIv.js';
4
+ import { ar as PendingSuiteMock, as as MockFactory, e as RuntimeRPC, W as WorkerGlobalState, at as MockMap } from './reporters-LqC_WI4d.js';
5
5
  import 'vite';
6
6
  import '@vitest/runner';
7
7
  import '@vitest/snapshot';
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { TaskPopulated, File, TaskResultPack, CancelReason } from '@vitest/runner';
2
2
  export { Custom, DoneCallback, ExtendedContext, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskContext, TaskCustomOptions, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
3
- export { b as bench } from './suite-a18diDsI.js';
3
+ export { b as bench } from './suite-ynYMzeLu.js';
4
4
  import { ExpectStatic } from '@vitest/expect';
5
5
  export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
6
- import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, t as RuntimeConfig, P as ProvidedContext, A as AfterSuiteRunMeta, u as UserConsoleLog, R as ResolvedConfig, v as ModuleGraphData, w as Reporter } from './reporters-P7C2ytIv.js';
7
- export { S as ApiConfig, aa as ArgumentsType, a9 as Arrayable, a7 as Awaitable, B as BaseCoverageOptions, ap as BenchFunction, an as Benchmark, aq as BenchmarkAPI, ao as BenchmarkResult, am as BenchmarkUserOptions, N as BuiltinEnvironment, Q as CSSModuleScopeStrategy, z as CollectLineNumbers, D as CollectLines, ac as Constructable, H as Context, f as ContextRPC, a3 as ContextTestEnvironment, aj as CoverageIstanbulOptions, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, ai as CoverageReporter, ak as CoverageV8Options, al as CustomProviderOptions, Y as DepsOptimizationOptions, E as Environment, X as EnvironmentOptions, ae as EnvironmentReturn, L as HappyDOMOptions, _ as InlineConfig, K as JSDOMOptions, ad as ModuleCache, ab as MutableArray, a8 as Nullable, ag as OnServerRestartHandler, I as Pool, J as PoolOptions, a0 as ProjectConfig, x as RawErrsMap, ah as ReportContext, a5 as ResolveIdFunction, a as ResolvedCoverageOptions, a4 as ResolvedTestEnvironment, G as RootAndTarget, a2 as RunnerRPC, e as RuntimeRPC, Z as TransformModePatterns, y as TscErrorInfo, $ as TypecheckConfig, U as UserConfig, a1 as UserWorkspaceConfig, i as Vitest, O as VitestEnvironment, V as VitestRunMode, af as VmEnvironmentReturn, g as WorkerContext, W as WorkerGlobalState, a6 as WorkerRPC } from './reporters-P7C2ytIv.js';
6
+ import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, t as RuntimeConfig, P as ProvidedContext, A as AfterSuiteRunMeta, u as UserConsoleLog, R as ResolvedConfig, v as ModuleGraphData, w as Reporter } from './reporters-LqC_WI4d.js';
7
+ export { S as ApiConfig, aa as ArgumentsType, a9 as Arrayable, a7 as Awaitable, B as BaseCoverageOptions, ap as BenchFunction, an as Benchmark, aq as BenchmarkAPI, ao as BenchmarkResult, am as BenchmarkUserOptions, N as BuiltinEnvironment, Q as CSSModuleScopeStrategy, z as CollectLineNumbers, D as CollectLines, ac as Constructable, H as Context, f as ContextRPC, a3 as ContextTestEnvironment, aj as CoverageIstanbulOptions, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, ai as CoverageReporter, ak as CoverageV8Options, al as CustomProviderOptions, Y as DepsOptimizationOptions, E as Environment, X as EnvironmentOptions, ae as EnvironmentReturn, L as HappyDOMOptions, _ as InlineConfig, K as JSDOMOptions, ad as ModuleCache, ab as MutableArray, a8 as Nullable, ag as OnServerRestartHandler, I as Pool, J as PoolOptions, a0 as ProjectConfig, x as RawErrsMap, ah as ReportContext, a5 as ResolveIdFunction, a as ResolvedCoverageOptions, a4 as ResolvedTestEnvironment, G as RootAndTarget, a2 as RunnerRPC, e as RuntimeRPC, Z as TransformModePatterns, y as TscErrorInfo, $ as TypecheckConfig, U as UserConfig, a1 as UserWorkspaceConfig, i as Vitest, O as VitestEnvironment, V as VitestRunMode, af as VmEnvironmentReturn, g as WorkerContext, W as WorkerGlobalState, a6 as WorkerRPC } from './reporters-LqC_WI4d.js';
8
8
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
9
9
  export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
10
10
  export { SnapshotEnvironment } from '@vitest/snapshot/environment';
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
2
2
  export { b as bench } from './vendor/benchmark.eeqk2rd8.js';
3
3
  export { i as isFirstRun, a as runOnce } from './vendor/run-once.Olz_Zkd8.js';
4
- export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.JYQecGiw.js';
5
- import { d as dist } from './vendor/index.BeX1oZht.js';
6
- export { b as assertType, g as getRunningMode, i as inject, a as isWatchMode } from './vendor/index.BeX1oZht.js';
4
+ export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.Fxjax7rQ.js';
5
+ import { d as dist } from './vendor/index.12jbrDSD.js';
6
+ export { b as assertType, g as getRunningMode, i as inject, a as isWatchMode } from './vendor/index.12jbrDSD.js';
7
7
  import * as chai from 'chai';
8
8
  export { chai };
9
9
  export { assert, should } from 'chai';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as VitestRunMode, U as UserConfig, h as VitestOptions, i as Vitest, j as CliOptions, R as ResolvedConfig, P as ProvidedContext, k as WorkspaceProject, e as RuntimeRPC, T as TestSequencer, l as WorkspaceSpec } from './reporters-P7C2ytIv.js';
2
- export { q as BrowserProvider, p as BrowserProviderInitializationOptions, r as BrowserProviderOptions, m as ProcessPool, o as TestSequencerConstructor, n as VitestPackageInstaller, s as startVitest } from './reporters-P7C2ytIv.js';
1
+ import { V as VitestRunMode, U as UserConfig, h as VitestOptions, i as Vitest, j as CliOptions, R as ResolvedConfig, P as ProvidedContext, k as WorkspaceProject, e as RuntimeRPC, T as TestSequencer, l as WorkspaceSpec } from './reporters-LqC_WI4d.js';
2
+ export { q as BrowserProvider, p as BrowserProviderInitializationOptions, r as BrowserProviderOptions, m as ProcessPool, o as TestSequencerConstructor, n as VitestPackageInstaller, s as startVitest } from './reporters-LqC_WI4d.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
4
  import '@vitest/runner';
5
5
  import 'vite-node';
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- export { b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, p as parseCLI, r as registerConsoleShortcuts, s as startVitest } from './vendor/cac.RvTIWZBK.js';
2
- export { B as BaseSequencer } from './vendor/index.e9RDLAeW.js';
1
+ export { b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, p as parseCLI, r as registerConsoleShortcuts, s as startVitest } from './vendor/cac.qnW6GNL2.js';
2
+ export { B as BaseSequencer } from './vendor/index.kSaPvGW6.js';
3
3
  import 'pathe';
4
4
  import 'events';
5
5
  import 'picocolors';
@@ -8,7 +8,7 @@ import 'std-env';
8
8
  import '@vitest/runner/utils';
9
9
  import '@vitest/utils';
10
10
  import './vendor/global.CkGT_TMy.js';
11
- import './vendor/constants.K-Wf1PUy.js';
11
+ import './vendor/constants.5J7I254_.js';
12
12
  import './vendor/coverage.E7sG1b3r.js';
13
13
  import './vendor/index.GVFv9dZ0.js';
14
14
  import 'node:console';
@@ -17,6 +17,7 @@ import 'node:path';
17
17
  import 'node:url';
18
18
  import 'node:process';
19
19
  import 'node:fs';
20
+ import 'node:worker_threads';
20
21
  import './vendor/_commonjsHelpers.jjO7Zipk.js';
21
22
  import 'os';
22
23
  import 'path';
@@ -43,7 +44,6 @@ import 'node:v8';
43
44
  import 'node:os';
44
45
  import 'node:events';
45
46
  import 'tinypool';
46
- import 'node:worker_threads';
47
47
  import 'local-pkg';
48
48
  import 'node:crypto';
49
49
  import 'vite-node/utils';
@@ -54,11 +54,11 @@ import 'strip-literal';
54
54
  import 'node:module';
55
55
  import 'node:readline';
56
56
  import 'readline';
57
+ import './vendor/tasks.IknbGB2n.js';
57
58
  import 'node:perf_hooks';
58
- import './chunks/runtime-console.tUKE_2UJ.js';
59
+ import './chunks/runtime-console.kbFEN7E-.js';
59
60
  import 'node:stream';
60
61
  import './vendor/date.Ns1pGd_X.js';
61
- import './vendor/tasks.IknbGB2n.js';
62
62
  import 'node:fs/promises';
63
63
  import 'execa';
64
64
  import 'module';
@@ -315,13 +315,15 @@ interface FakeTimerInstallOpts {
315
315
  now?: number | Date | undefined;
316
316
 
317
317
  /**
318
- * An array with names of global methods and APIs to fake. By default, `@sinonjs/fake-timers` does not replace `nextTick()` and `queueMicrotask()`.
319
- * For instance, `FakeTimers.install({ toFake: ['setTimeout', 'nextTick'] })` will fake only `setTimeout()` and `nextTick()`
318
+ * An array with names of global methods and APIs to fake.
319
+ * For instance, `vi.useFakeTimer({ toFake: ['setTimeout', 'performance'] })` will fake only `setTimeout()` and `performance.now()`
320
+ * @default ['setTimeout', 'clearTimeout', 'setImmediate', 'clearImmediate', 'setInterval', 'clearInterval', 'Date']
320
321
  */
321
322
  toFake?: FakeMethod[] | undefined;
322
323
 
323
324
  /**
324
- * The maximum number of timers that will be run when calling runAll() (default: 1000)
325
+ * The maximum number of timers that will be run when calling runAll()
326
+ * @default 10000
325
327
  */
326
328
  loopLimit?: number | undefined;
327
329
 
@@ -338,8 +340,8 @@ interface FakeTimerInstallOpts {
338
340
  advanceTimeDelta?: number | undefined;
339
341
 
340
342
  /**
341
- * Tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers. These are not cleared by
342
- * default, leading to potentially unexpected behavior if timers existed prior to installing FakeTimers. (default: false)
343
+ * Tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers.
344
+ * @default true
343
345
  */
344
346
  shouldClearNativeTimers?: boolean | undefined;
345
347
  }
@@ -695,7 +697,7 @@ declare class WorkspaceProject {
695
697
  globFiles(include: string[], exclude: string[], cwd: string): Promise<string[]>;
696
698
  isTargetFile(id: string, source?: string): Promise<boolean>;
697
699
  isInSourceTestFile(code: string): boolean;
698
- filterFiles(testFiles: string[], filters: string[] | undefined, dir: string): string[];
700
+ filterFiles(testFiles: string[], filters: string[], dir: string): string[];
699
701
  initBrowserServer(configFile: string | undefined): Promise<void>;
700
702
  static createBasicProject(ctx: Vitest): WorkspaceProject;
701
703
  static createCoreProject(ctx: Vitest): Promise<WorkspaceProject>;
@@ -1197,6 +1199,7 @@ declare class TableReporter extends BaseReporter {
1197
1199
  rendererOptions: TableRendererOptions;
1198
1200
  onTestRemoved(trigger?: string): Promise<void>;
1199
1201
  onCollected(): void;
1202
+ onTaskUpdate(packs: TaskResultPack[]): void;
1200
1203
  onFinished(files?: _vitest_runner.File[], errors?: unknown[]): Promise<void>;
1201
1204
  onWatcherStart(): Promise<void>;
1202
1205
  stopListRender(): Promise<void>;
@@ -1640,6 +1643,10 @@ interface CoverageIstanbulOptions extends BaseCoverageOptions {
1640
1643
  ignoreClassMethods?: string[];
1641
1644
  }
1642
1645
  interface CoverageV8Options extends BaseCoverageOptions {
1646
+ /**
1647
+ * Ignore empty lines, comments and other non-runtime code, e.g. Typescript types
1648
+ */
1649
+ ignoreEmptyLines?: boolean;
1643
1650
  }
1644
1651
  interface CustomProviderOptions extends Pick<BaseCoverageOptions, FieldsWithDefaultValues> {
1645
1652
  /** Name of the module or path to a file to load the custom provider from */
@@ -2460,14 +2467,35 @@ interface InlineConfig {
2460
2467
  *
2461
2468
  * Requires `poolOptions.threads.singleThread: true` OR `poolOptions.forks.singleFork: true`.
2462
2469
  */
2463
- inspect?: boolean;
2470
+ inspect?: boolean | string;
2464
2471
  /**
2465
2472
  * Debug tests by opening `node:inspector` in worker / child process and wait for debugger to connect.
2466
2473
  * Provides similar experience as `--inspect-brk` Node CLI argument.
2467
2474
  *
2468
2475
  * Requires `poolOptions.threads.singleThread: true` OR `poolOptions.forks.singleFork: true`.
2469
2476
  */
2470
- inspectBrk?: boolean;
2477
+ inspectBrk?: boolean | string;
2478
+ /**
2479
+ * Inspector options. If `--inspect` or `--inspect-brk` is enabled, these options will be passed to the inspector.
2480
+ */
2481
+ inspector?: {
2482
+ /**
2483
+ * Enable inspector
2484
+ */
2485
+ enabled?: boolean;
2486
+ /**
2487
+ * Port to run inspector on
2488
+ */
2489
+ port?: number;
2490
+ /**
2491
+ * Host to run inspector on
2492
+ */
2493
+ host?: string;
2494
+ /**
2495
+ * Wait for debugger to connect before running tests
2496
+ */
2497
+ waitForDebugger?: boolean;
2498
+ };
2471
2499
  /**
2472
2500
  * Modify default Chai config. Vitest uses Chai for `expect` and `assert` matches.
2473
2501
  * https://github.com/chaijs/chai/blob/4.x.x/lib/chai/config.js
@@ -1,4 +1,4 @@
1
- export { aS as BaseReporter, aJ as BasicReporter, a_ as BenchmarkBuiltinReporters, aZ as BenchmarkReportsMap, aV as BuiltinReporterOptions, aU as BuiltinReporters, aI as DefaultReporter, aK as DotReporter, aR as GithubActionsReporter, aQ as HangingProcessReporter, aO as JUnitReporter, aW as JsonAssertionResult, aL as JsonReporter, aX as JsonTestResult, aY as JsonTestResults, w as Reporter, aT as ReportersMap, aP as TapFlatReporter, aN as TapReporter, aM as VerboseReporter } from './reporters-P7C2ytIv.js';
1
+ export { aS as BaseReporter, aJ as BasicReporter, a_ as BenchmarkBuiltinReporters, aZ as BenchmarkReportsMap, aV as BuiltinReporterOptions, aU as BuiltinReporters, aI as DefaultReporter, aK as DotReporter, aR as GithubActionsReporter, aQ as HangingProcessReporter, aO as JUnitReporter, aW as JsonAssertionResult, aL as JsonReporter, aX as JsonTestResult, aY as JsonTestResults, w as Reporter, aT as ReportersMap, aP as TapFlatReporter, aN as TapReporter, aM as VerboseReporter } from './reporters-LqC_WI4d.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
package/dist/reporters.js CHANGED
@@ -1,4 +1,4 @@
1
- export { a as BasicReporter, e as BenchmarkReportsMap, D as DefaultReporter, b as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, c as JUnitReporter, J as JsonReporter, R as ReportersMap, d as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.e9RDLAeW.js';
1
+ export { a as BasicReporter, e as BenchmarkReportsMap, D as DefaultReporter, b as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, c as JUnitReporter, J as JsonReporter, R as ReportersMap, d as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.kSaPvGW6.js';
2
2
  import 'node:fs';
3
3
  import 'pathe';
4
4
  import './vendor/index.ir9i0ywP.js';
@@ -7,14 +7,14 @@ import '@vitest/runner/utils';
7
7
  import '@vitest/utils';
8
8
  import './vendor/global.CkGT_TMy.js';
9
9
  import 'picocolors';
10
+ import './vendor/tasks.IknbGB2n.js';
10
11
  import 'node:perf_hooks';
11
- import './chunks/runtime-console.tUKE_2UJ.js';
12
+ import './chunks/runtime-console.kbFEN7E-.js';
12
13
  import 'node:stream';
13
14
  import 'node:console';
14
15
  import 'node:path';
15
16
  import './vendor/date.Ns1pGd_X.js';
16
17
  import './vendor/base.Xt0Omgh7.js';
17
- import './vendor/tasks.IknbGB2n.js';
18
18
  import '@vitest/utils/source-map';
19
19
  import 'node:os';
20
20
  import 'node:module';
package/dist/runners.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VitestRunner, VitestRunnerImportSource, Suite, Task, CancelReason, Test, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
2
- import { R as ResolvedConfig } from './reporters-P7C2ytIv.js';
2
+ import { R as ResolvedConfig } from './reporters-LqC_WI4d.js';
3
3
  import * as tinybench from 'tinybench';
4
4
  import 'vite';
5
5
  import 'vite-node';
package/dist/runners.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.JYQecGiw.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.Fxjax7rQ.js';
3
3
  import './vendor/index.ir9i0ywP.js';
4
4
  import { r as rpc } from './vendor/rpc.joBhAkyK.js';
5
5
  import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
@@ -161,8 +161,8 @@ async function runBenchmarkSuite(suite, runner) {
161
161
  else if (task.type === "suite")
162
162
  benchmarkSuiteGroup.push(task);
163
163
  }
164
- if (benchmarkSuiteGroup.length)
165
- await Promise.all(benchmarkSuiteGroup.map((subSuite) => runBenchmarkSuite(subSuite, runner)));
164
+ for (const subSuite of benchmarkSuiteGroup)
165
+ await runBenchmarkSuite(subSuite, runner);
166
166
  if (benchmarkGroup.length) {
167
167
  const defer = createDefer();
168
168
  suite.result = {
@@ -1,6 +1,6 @@
1
1
  import { Custom } from '@vitest/runner';
2
2
  import '@vitest/runner/utils';
3
- import { ap as BenchFunction, aq as BenchmarkAPI } from './reporters-P7C2ytIv.js';
3
+ import { ap as BenchFunction, aq as BenchmarkAPI } from './reporters-LqC_WI4d.js';
4
4
  import { Options } from 'tinybench';
5
5
 
6
6
  declare function getBenchOptions(key: Custom): Options;
package/dist/suite.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createTaskCollector, getCurrentSuite, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
2
2
  export { createChainable } from '@vitest/runner/utils';
3
- export { g as getBenchFn, a as getBenchOptions } from './suite-a18diDsI.js';
4
- import './reporters-P7C2ytIv.js';
3
+ export { g as getBenchFn, a as getBenchOptions } from './suite-ynYMzeLu.js';
4
+ import './reporters-LqC_WI4d.js';
5
5
  import 'vite';
6
6
  import 'vite-node';
7
7
  import '@vitest/snapshot';
@@ -25,7 +25,7 @@ async function runBaseTests(state) {
25
25
  ctx.files.forEach((i) => state.moduleCache.delete(i));
26
26
  const [executor, { run }] = await Promise.all([
27
27
  startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
28
- import('../chunks/runtime-runBaseTests.SKlFOhuq.js')
28
+ import('../chunks/runtime-runBaseTests.3fVSWBsC.js')
29
29
  ]);
30
30
  await run(
31
31
  ctx.files,