vitest 1.5.0 → 1.5.2

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 (36) hide show
  1. package/dist/browser.d.ts +2 -1
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{integrations-globals.2J_Aii2q.js → integrations-globals.k0N5-dd1.js} +2 -2
  4. package/dist/chunks/{runtime-runBaseTests.3fVSWBsC.js → runtime-runBaseTests.-x-nNuJ_.js} +4 -4
  5. package/dist/cli.js +2 -60
  6. package/dist/config.d.ts +2 -1
  7. package/dist/coverage.d.ts +4 -2
  8. package/dist/coverage.js +2 -2
  9. package/dist/environments.d.ts +2 -1
  10. package/dist/execute.d.ts +2 -1
  11. package/dist/index.d.ts +5 -4
  12. package/dist/index.js +3 -3
  13. package/dist/node.d.ts +26 -4
  14. package/dist/node.js +11 -9
  15. package/dist/{reporters-LqC_WI4d.d.ts → reporters-xEmem8D4.d.ts} +88 -41
  16. package/dist/reporters.d.ts +2 -1
  17. package/dist/reporters.js +3 -2
  18. package/dist/runners.d.ts +2 -1
  19. package/dist/runners.js +1 -1
  20. package/dist/{suite-ynYMzeLu.d.ts → suite-HPAKvIxA.d.ts} +1 -1
  21. package/dist/suite.d.ts +3 -2
  22. package/dist/vendor/{base.BjeeYg4o.js → base.gAwDs8Jc.js} +1 -1
  23. package/dist/vendor/cac.8mXc9Oj6.js +1406 -0
  24. package/dist/vendor/{cac.qnW6GNL2.js → cli-api._n4_Wp_j.js} +139 -1542
  25. package/dist/vendor/{index.12jbrDSD.js → index.0RrMQKD8.js} +1 -1
  26. package/dist/vendor/{index.kSaPvGW6.js → index.GlXSU9xI.js} +21 -208
  27. package/dist/vendor/{index.-ITFwqG_.js → index.gHZzsRJQ.js} +1 -1
  28. package/dist/vendor/{setup-common.A1De6efh.js → setup-common.7SXMSI--.js} +5 -2
  29. package/dist/vendor/utils.VYmeMh-u.js +217 -0
  30. package/dist/vendor/{vi.Fxjax7rQ.js → vi.Y_w82WR8.js} +5 -1
  31. package/dist/workers/forks.js +1 -1
  32. package/dist/workers/runVmTests.js +4 -4
  33. package/dist/workers/threads.js +1 -1
  34. package/dist/workers.d.ts +2 -1
  35. package/dist/workers.js +1 -1
  36. package/package.json +9 -9
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-LqC_WI4d.js';
2
+ import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-xEmem8D4.js';
3
3
  import { VitestExecutor } from './execute.js';
4
4
  import 'vite';
5
5
  import 'vite-node';
@@ -8,6 +8,7 @@ import '@vitest/expect';
8
8
  import '@vitest/runner/utils';
9
9
  import '@vitest/utils';
10
10
  import 'tinybench';
11
+ import 'node:stream';
11
12
  import 'vite-node/client';
12
13
  import '@vitest/snapshot/manager';
13
14
  import 'vite-node/server';
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.A1De6efh.js';
2
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './vendor/setup-common.7SXMSI--.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
1
  import { g as globalApis } from '../vendor/constants.5J7I254_.js';
2
- import { V as VitestIndex } from '../vendor/index.12jbrDSD.js';
2
+ import { V as VitestIndex } from '../vendor/index.0RrMQKD8.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.Fxjax7rQ.js';
12
+ import '../vendor/vi.Y_w82WR8.js';
13
13
  import 'chai';
14
14
  import '../vendor/_commonjsHelpers.jjO7Zipk.js';
15
15
  import '@vitest/expect';
@@ -1,17 +1,17 @@
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.Fxjax7rQ.js';
4
+ import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.Y_w82WR8.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.-ITFwqG_.js';
6
+ import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.gHZzsRJQ.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.12jbrDSD.js';
14
- import { s as setupCommonEnv } from '../vendor/setup-common.A1De6efh.js';
13
+ import { V as VitestIndex } from '../vendor/index.0RrMQKD8.js';
14
+ import { s as setupCommonEnv } from '../vendor/setup-common.7SXMSI--.js';
15
15
  import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
16
16
  import { c as closeInspector } from '../vendor/inspector.IgLX3ur5.js';
17
17
  import 'pathe';
package/dist/cli.js CHANGED
@@ -1,67 +1,9 @@
1
- import { d as createCLI } from './vendor/cac.qnW6GNL2.js';
1
+ import { c as createCLI } from './vendor/cac.8mXc9Oj6.js';
2
2
  import 'pathe';
3
3
  import 'events';
4
4
  import 'picocolors';
5
- import './vendor/index.ir9i0ywP.js';
6
- import 'std-env';
7
- import '@vitest/runner/utils';
8
- import '@vitest/utils';
9
- import './vendor/global.CkGT_TMy.js';
10
- import './vendor/index.kSaPvGW6.js';
11
- import 'node:fs';
12
- import './vendor/tasks.IknbGB2n.js';
13
- import 'node:perf_hooks';
14
- import './chunks/runtime-console.kbFEN7E-.js';
15
- import 'node:stream';
16
- import 'node:console';
17
- import 'node:path';
18
- import './vendor/date.Ns1pGd_X.js';
19
5
  import './vendor/base.Xt0Omgh7.js';
20
- import '@vitest/utils/source-map';
21
- import 'node:os';
22
- import 'node:module';
23
- import 'node:fs/promises';
24
- import 'execa';
25
- import 'node:url';
26
- import 'path';
27
- import 'fs';
28
- import 'module';
29
- import 'vite';
30
- import 'acorn-walk';
31
- import 'node:process';
32
- import './vendor/_commonjsHelpers.jjO7Zipk.js';
33
- import 'assert';
34
- import 'node:crypto';
35
- import 'vite-node/utils';
6
+ import '@vitest/utils';
36
7
  import './vendor/constants.5J7I254_.js';
37
- import './vendor/coverage.E7sG1b3r.js';
38
- import './vendor/index.GVFv9dZ0.js';
39
- import 'node:worker_threads';
40
- import 'os';
41
- import './vendor/index.xL8XjTLv.js';
42
- import 'util';
43
- import 'stream';
44
- import 'vite-node/client';
45
- import '@vitest/snapshot/manager';
46
- import 'vite-node/server';
47
- import './path.js';
48
- import './vendor/index.8bPxjt7g.js';
49
- import 'zlib';
50
- import 'buffer';
51
- import 'crypto';
52
- import 'https';
53
- import 'http';
54
- import 'net';
55
- import 'tls';
56
- import 'url';
57
- import 'node:v8';
58
- import 'node:events';
59
- import 'tinypool';
60
- import 'local-pkg';
61
- import 'magic-string';
62
- import '@vitest/utils/ast';
63
- import 'strip-literal';
64
- import 'node:readline';
65
- import 'readline';
66
8
 
67
9
  createCLI().parse();
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-LqC_WI4d.js';
2
+ export { av as UserConfigExport, au as UserConfigFn, as as UserConfigFnObject, at as UserConfigFnPromise, ax as UserProjectConfigExport, aw as UserProjectConfigFn, $ as UserWorkspaceConfig, aB as configDefaults, aE as coverageConfigDefaults, aD as defaultExclude, aC as defaultInclude, ay as defineConfig, az as defineProject, aA as defineWorkspace, aF as extraInlineDeps } from './reporters-xEmem8D4.js';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
5
5
  import '@vitest/snapshot';
@@ -7,6 +7,7 @@ import '@vitest/expect';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import 'tinybench';
10
+ import 'node:stream';
10
11
  import 'vite-node/client';
11
12
  import '@vitest/snapshot/manager';
12
13
  import 'vite-node/server';
@@ -1,4 +1,4 @@
1
- import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-LqC_WI4d.js';
1
+ import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-xEmem8D4.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
@@ -7,6 +7,7 @@ import '@vitest/expect';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import 'tinybench';
10
+ import 'node:stream';
10
11
  import 'vite-node/client';
11
12
  import '@vitest/snapshot/manager';
12
13
  import 'vite-node/server';
@@ -146,10 +147,11 @@ declare class BaseCoverageProvider {
146
147
  * where each threshold set holds their own coverage maps. Threshold set is either
147
148
  * for specific files defined by glob pattern or global for all other files.
148
149
  */
149
- resolveThresholds({ coverageMap, thresholds, createCoverageMap }: {
150
+ resolveThresholds({ coverageMap, thresholds, createCoverageMap, root }: {
150
151
  coverageMap: CoverageMap;
151
152
  thresholds: NonNullable<BaseCoverageOptions['thresholds']>;
152
153
  createCoverageMap: () => CoverageMap;
154
+ root: string;
153
155
  }): ResolvedThreshold[];
154
156
  /**
155
157
  * Resolve reporters from various configuration options
package/dist/coverage.js CHANGED
@@ -76,7 +76,7 @@ class BaseCoverageProvider {
76
76
  * where each threshold set holds their own coverage maps. Threshold set is either
77
77
  * for specific files defined by glob pattern or global for all other files.
78
78
  */
79
- resolveThresholds({ coverageMap, thresholds, createCoverageMap }) {
79
+ resolveThresholds({ coverageMap, thresholds, createCoverageMap, root }) {
80
80
  const resolvedThresholds = [];
81
81
  const files = coverageMap.files();
82
82
  const filesMatchedByGlobs = [];
@@ -87,7 +87,7 @@ class BaseCoverageProvider {
87
87
  const glob = key;
88
88
  const globThresholds = resolveGlobThresholds(thresholds[glob]);
89
89
  const globCoverageMap = createCoverageMap();
90
- const matchingFiles = files.filter((file) => mm.isMatch(file, glob));
90
+ const matchingFiles = files.filter((file) => mm.isMatch(relative(root, file), glob));
91
91
  filesMatchedByGlobs.push(...matchingFiles);
92
92
  for (const file of matchingFiles) {
93
93
  const fileCoverage = coverageMap.fileCoverageFor(file);
@@ -1,4 +1,4 @@
1
- import { E as Environment } from './reporters-LqC_WI4d.js';
1
+ import { E as Environment } from './reporters-xEmem8D4.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
@@ -7,6 +7,7 @@ import '@vitest/expect';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import 'tinybench';
10
+ import 'node:stream';
10
11
  import 'vite-node/client';
11
12
  import '@vitest/snapshot/manager';
12
13
  import 'vite-node/server';
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-LqC_WI4d.js';
4
+ import { ap as PendingSuiteMock, aq as MockFactory, e as RuntimeRPC, W as WorkerGlobalState, ar as MockMap } from './reporters-xEmem8D4.js';
5
5
  import 'vite';
6
6
  import '@vitest/runner';
7
7
  import '@vitest/snapshot';
@@ -9,6 +9,7 @@ import '@vitest/expect';
9
9
  import '@vitest/runner/utils';
10
10
  import '@vitest/utils';
11
11
  import 'tinybench';
12
+ import 'node:stream';
12
13
  import '@vitest/snapshot/manager';
13
14
  import 'vite-node/server';
14
15
  import 'node:worker_threads';
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-ynYMzeLu.js';
3
+ export { b as bench } from './suite-HPAKvIxA.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-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';
6
+ import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, r as RuntimeConfig, P as ProvidedContext, A as AfterSuiteRunMeta, s as UserConsoleLog, R as ResolvedConfig, t as ModuleGraphData, u as Reporter } from './reporters-xEmem8D4.js';
7
+ export { O as ApiConfig, a8 as ArgumentsType, a7 as Arrayable, a5 as Awaitable, B as BaseCoverageOptions, an as BenchFunction, al as Benchmark, ao as BenchmarkAPI, am as BenchmarkResult, ak as BenchmarkUserOptions, K as BuiltinEnvironment, N as CSSModuleScopeStrategy, x as CollectLineNumbers, y as CollectLines, aa as Constructable, D as Context, f as ContextRPC, a1 as ContextTestEnvironment, ah as CoverageIstanbulOptions, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, ag as CoverageReporter, ai as CoverageV8Options, aj as CustomProviderOptions, S as DepsOptimizationOptions, E as Environment, Q as EnvironmentOptions, ac as EnvironmentReturn, I as HappyDOMOptions, Y as InlineConfig, J as JSDOMOptions, ab as ModuleCache, a9 as MutableArray, a6 as Nullable, ae as OnServerRestartHandler, G as Pool, H as PoolOptions, _ as ProjectConfig, v as RawErrsMap, af as ReportContext, a3 as ResolveIdFunction, a as ResolvedCoverageOptions, a2 as ResolvedTestEnvironment, z as RootAndTarget, a0 as RunnerRPC, e as RuntimeRPC, X as TransformModePatterns, w as TscErrorInfo, Z as TypecheckConfig, U as UserConfig, $ as UserWorkspaceConfig, i as Vitest, L as VitestEnvironment, V as VitestRunMode, ad as VmEnvironmentReturn, g as WorkerContext, W as WorkerGlobalState, a4 as WorkerRPC } from './reporters-xEmem8D4.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';
@@ -19,6 +19,7 @@ export { ErrorWithDiff, ParsedStack } from '@vitest/utils';
19
19
  export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
20
20
  import '@vitest/runner/utils';
21
21
  import 'vite-node';
22
+ import 'node:stream';
22
23
  import 'vite-node/client';
23
24
  import '@vitest/snapshot/manager';
24
25
  import 'vite-node/server';
@@ -627,7 +628,7 @@ interface VitestUtils {
627
628
  * Changes the value of `import.meta.env` and `process.env`.
628
629
  * You can return it back to original value with `vi.unstubAllEnvs`, or by enabling `unstubEnvs` config option.
629
630
  */
630
- stubEnv: (name: string, value: string) => VitestUtils;
631
+ stubEnv: <T extends string>(name: T, value: T extends 'PROD' | 'DEV' | 'SSR' ? boolean : string) => VitestUtils;
631
632
  /**
632
633
  * Reset the value to original value that was available before first `vi.stubGlobal` was called.
633
634
  */
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.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';
4
+ export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.Y_w82WR8.js';
5
+ import { d as dist } from './vendor/index.0RrMQKD8.js';
6
+ export { b as assertType, g as getRunningMode, i as inject, a as isWatchMode } from './vendor/index.0RrMQKD8.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,6 +1,7 @@
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';
1
+ import { V as VitestRunMode, U as UserConfig, h as VitestOptions, i as Vitest, R as ResolvedConfig, P as ProvidedContext, j as WorkspaceProject, e as RuntimeRPC, T as TestSequencer, k as WorkspaceSpec } from './reporters-xEmem8D4.js';
2
+ export { p as BrowserProvider, o as BrowserProviderInitializationOptions, q as BrowserProviderOptions, l as ProcessPool, n as TestSequencerConstructor, m as VitestPackageInstaller } from './reporters-xEmem8D4.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
+ import { Writable } from 'node:stream';
4
5
  import '@vitest/runner';
5
6
  import 'vite-node';
6
7
  import '@vitest/snapshot';
@@ -19,6 +20,27 @@ declare function createVitest(mode: VitestRunMode, options: UserConfig, viteOver
19
20
 
20
21
  declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin[]>;
21
22
 
23
+ interface CliOptions extends UserConfig {
24
+ /**
25
+ * Override the watch mode
26
+ */
27
+ run?: boolean;
28
+ /**
29
+ * Retry the test suite if it crashes due to a segfault (default: true)
30
+ */
31
+ segfaultRetry?: number;
32
+ /**
33
+ * Removes colors from the console output
34
+ */
35
+ color?: boolean;
36
+ }
37
+ /**
38
+ * Start Vitest programmatically
39
+ *
40
+ * Returns a Vitest instance if initialized successfully.
41
+ */
42
+ declare function startVitest(mode: VitestRunMode, cliFilters?: string[], options?: CliOptions, viteOverrides?: UserConfig$1, vitestOptions?: VitestOptions): Promise<Vitest | undefined>;
43
+
22
44
  interface CLIOptions {
23
45
  allowUnknownOptions?: boolean;
24
46
  }
@@ -27,7 +49,7 @@ declare function parseCLI(argv: string | string[], config?: CLIOptions): {
27
49
  options: CliOptions;
28
50
  };
29
51
 
30
- declare function registerConsoleShortcuts(ctx: Vitest): () => void;
52
+ declare function registerConsoleShortcuts(ctx: Vitest, stdin: NodeJS.ReadStream | undefined, stdout: NodeJS.WriteStream | Writable): () => void;
31
53
 
32
54
  interface GlobalSetupContext {
33
55
  config: ResolvedConfig;
@@ -43,4 +65,4 @@ declare class BaseSequencer implements TestSequencer {
43
65
  sort(files: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
44
66
  }
45
67
 
46
- export { BaseSequencer, type GlobalSetupContext, TestSequencer, Vitest, VitestPlugin, WorkspaceProject, WorkspaceSpec, createMethodsRPC, createVitest, parseCLI, registerConsoleShortcuts };
68
+ export { BaseSequencer, type GlobalSetupContext, TestSequencer, Vitest, VitestPlugin, WorkspaceProject, WorkspaceSpec, createMethodsRPC, createVitest, parseCLI, registerConsoleShortcuts, startVitest };
package/dist/node.js CHANGED
@@ -1,13 +1,7 @@
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';
1
+ export { b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/cli-api._n4_Wp_j.js';
2
+ export { p as parseCLI } from './vendor/cac.8mXc9Oj6.js';
3
+ export { B as BaseSequencer } from './vendor/index.GlXSU9xI.js';
3
4
  import 'pathe';
4
- import 'events';
5
- import 'picocolors';
6
- import './vendor/index.ir9i0ywP.js';
7
- import 'std-env';
8
- import '@vitest/runner/utils';
9
- import '@vitest/utils';
10
- import './vendor/global.CkGT_TMy.js';
11
5
  import './vendor/constants.5J7I254_.js';
12
6
  import './vendor/coverage.E7sG1b3r.js';
13
7
  import './vendor/index.GVFv9dZ0.js';
@@ -24,10 +18,17 @@ import 'path';
24
18
  import './vendor/index.xL8XjTLv.js';
25
19
  import 'util';
26
20
  import 'stream';
21
+ import 'events';
27
22
  import 'fs';
23
+ import 'picocolors';
28
24
  import 'vite-node/client';
29
25
  import '@vitest/snapshot/manager';
30
26
  import 'vite-node/server';
27
+ import './vendor/index.ir9i0ywP.js';
28
+ import 'std-env';
29
+ import '@vitest/runner/utils';
30
+ import '@vitest/utils';
31
+ import './vendor/global.CkGT_TMy.js';
31
32
  import './path.js';
32
33
  import './vendor/index.8bPxjt7g.js';
33
34
  import 'zlib';
@@ -51,6 +52,7 @@ import 'magic-string';
51
52
  import 'acorn-walk';
52
53
  import '@vitest/utils/ast';
53
54
  import 'strip-literal';
55
+ import './vendor/utils.VYmeMh-u.js';
54
56
  import 'node:module';
55
57
  import 'node:readline';
56
58
  import 'readline';
@@ -7,7 +7,8 @@ import { SnapshotResult, SnapshotStateOptions, SnapshotState } from '@vitest/sna
7
7
  import { ExpectStatic } from '@vitest/expect';
8
8
  import { ChainableFunction } from '@vitest/runner/utils';
9
9
  import { ParsedStack, Awaitable as Awaitable$1, ErrorWithDiff, Arrayable as Arrayable$1 } from '@vitest/utils';
10
- import { TaskResult, Bench, Options } from 'tinybench';
10
+ import { TaskResult, Bench, Options as Options$1 } from 'tinybench';
11
+ import { Writable } from 'node:stream';
11
12
  import { ViteNodeRunner } from 'vite-node/client';
12
13
  import { SnapshotManager } from '@vitest/snapshot/manager';
13
14
  import { ViteNodeServer } from 'vite-node/server';
@@ -453,6 +454,81 @@ interface VmOptions {
453
454
  execArgv?: string[];
454
455
  }
455
456
 
457
+ interface Options {
458
+ /**
459
+ Show the cursor. This can be useful when a CLI accepts input from a user.
460
+
461
+ @example
462
+ ```
463
+ import {createLogUpdate} from 'log-update';
464
+
465
+ // Write output but don't hide the cursor
466
+ const log = createLogUpdate(process.stdout, {
467
+ showCursor: true
468
+ });
469
+ ```
470
+ */
471
+ readonly showCursor?: boolean;
472
+ }
473
+
474
+ type LogUpdateMethods = {
475
+ /**
476
+ Clear the logged output.
477
+ */
478
+ clear(): void;
479
+
480
+ /**
481
+ Persist the logged output. Useful if you want to start a new log session below the current one.
482
+ */
483
+ done(): void;
484
+ };
485
+
486
+ /**
487
+ Log to `stdout` by overwriting the previous output in the terminal.
488
+
489
+ @param text - The text to log to `stdout`.
490
+
491
+ @example
492
+ ```
493
+ import logUpdate from 'log-update';
494
+
495
+ const frames = ['-', '\\', '|', '/'];
496
+ let index = 0;
497
+
498
+ setInterval(() => {
499
+ const frame = frames[index = ++index % frames.length];
500
+
501
+ logUpdate(
502
+ `
503
+ ♥♥
504
+ ${frame} unicorns ${frame}
505
+ ♥♥
506
+ `
507
+ );
508
+ }, 80);
509
+ ```
510
+ */
511
+ declare const logUpdate: ((...text: string[]) => void) & LogUpdateMethods;
512
+
513
+
514
+ /**
515
+ Get a `logUpdate` method that logs to the specified stream.
516
+
517
+ @param stream - The stream to log to.
518
+
519
+ @example
520
+ ```
521
+ import {createLogUpdate} from 'log-update';
522
+
523
+ // Write output but don't hide the cursor
524
+ const log = createLogUpdate(process.stdout);
525
+ ```
526
+ */
527
+ declare function createLogUpdate(
528
+ stream: NodeJS.WritableStream,
529
+ options?: Options
530
+ ): typeof logUpdate;
531
+
456
532
  interface ParsedFile extends File {
457
533
  start: number;
458
534
  end: number;
@@ -543,20 +619,13 @@ interface ErrorOptions {
543
619
  }
544
620
  declare class Logger {
545
621
  ctx: Vitest;
546
- console: Console;
547
- outputStream: NodeJS.WriteStream & {
548
- fd: 1;
549
- };
550
- errorStream: NodeJS.WriteStream & {
551
- fd: 2;
552
- };
553
- logUpdate: ((...text: string[]) => void) & {
554
- clear(): void;
555
- done(): void;
556
- };
622
+ outputStream: NodeJS.WriteStream | Writable;
623
+ errorStream: NodeJS.WriteStream | Writable;
624
+ logUpdate: ReturnType<typeof createLogUpdate>;
557
625
  private _clearScreenPending;
558
626
  private _highlights;
559
- constructor(ctx: Vitest, console?: Console);
627
+ console: Console;
628
+ constructor(ctx: Vitest, outputStream?: NodeJS.WriteStream | Writable, errorStream?: NodeJS.WriteStream | Writable);
560
629
  log(...args: any[]): void;
561
630
  error(...args: any[]): void;
562
631
  warn(...args: any[]): void;
@@ -681,7 +750,7 @@ declare class WorkspaceProject {
681
750
  constructor(path: string | number, ctx: Vitest, options?: InitializeProjectOptions | undefined);
682
751
  getName(): string;
683
752
  isCore(): boolean;
684
- provide: (key: string, value: unknown) => void;
753
+ provide: <T extends never>(key: T, value: ProvidedContext[T]) => void;
685
754
  getProvidedContext(): ProvidedContext;
686
755
  initializeGlobalSetup(): Promise<void>;
687
756
  teardownGlobalSetup(): Promise<void>;
@@ -811,27 +880,6 @@ declare class ResultsCache {
811
880
  writeToCache(): Promise<void>;
812
881
  }
813
882
 
814
- interface CliOptions extends UserConfig {
815
- /**
816
- * Override the watch mode
817
- */
818
- run?: boolean;
819
- /**
820
- * Retry the test suite if it crashes due to a segfault (default: true)
821
- */
822
- segfaultRetry?: number;
823
- /**
824
- * Removes colors from the console output
825
- */
826
- color?: boolean;
827
- }
828
- /**
829
- * Start Vitest programmatically
830
- *
831
- * Returns a Vitest instance if initialized successfully.
832
- */
833
- declare function startVitest(mode: VitestRunMode, cliFilters?: string[], options?: CliOptions, viteOverrides?: UserConfig$1, vitestOptions?: VitestOptions): Promise<Vitest | undefined>;
834
-
835
883
  type FileStatsCache = Pick<Stats, 'size'>;
836
884
  declare class FilesStatsCache {
837
885
  cache: Map<string, FileStatsCache>;
@@ -849,10 +897,6 @@ declare class VitestCache {
849
897
  size: number;
850
898
  } | undefined;
851
899
  static resolveCacheDir(root: string, dir?: string, projectName?: string): string;
852
- static clearCache(options: CliOptions): Promise<{
853
- dir: string;
854
- cleared: boolean;
855
- }>;
856
900
  }
857
901
 
858
902
  declare class VitestPackageInstaller {
@@ -861,6 +905,9 @@ declare class VitestPackageInstaller {
861
905
 
862
906
  interface VitestOptions {
863
907
  packageInstaller?: VitestPackageInstaller;
908
+ stdin?: NodeJS.ReadStream;
909
+ stdout?: NodeJS.WriteStream | Writable;
910
+ stderr?: NodeJS.WriteStream | Writable;
864
911
  }
865
912
  declare class Vitest {
866
913
  readonly mode: VitestRunMode;
@@ -1819,7 +1866,7 @@ interface BenchmarkResult extends TaskResult {
1819
1866
  rank: number;
1820
1867
  }
1821
1868
  type BenchFunction = (this: Bench) => Promise<void> | void;
1822
- type ChainableBenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', (name: string | Function, fn?: BenchFunction, options?: Options) => void>;
1869
+ type ChainableBenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', (name: string | Function, fn?: BenchFunction, options?: Options$1) => void>;
1823
1870
  type BenchmarkAPI = ChainableBenchmarkAPI & {
1824
1871
  skipIf: (condition: any) => ChainableBenchmarkAPI;
1825
1872
  runIf: (condition: any) => ChainableBenchmarkAPI;
@@ -2772,4 +2819,4 @@ type Context = RootAndTarget & {
2772
2819
  lastActivePath?: string;
2773
2820
  };
2774
2821
 
2775
- export { type TypecheckConfig as $, type AfterSuiteRunMeta as A, type BaseCoverageOptions as B, type CoverageOptions as C, type CollectLines as D, type Environment as E, type FakeTimerInstallOpts as F, type RootAndTarget as G, type Context as H, type Pool as I, type PoolOptions as J, type JSDOMOptions as K, type HappyDOMOptions as L, type MockFactoryWithHelper as M, type BuiltinEnvironment as N, type VitestEnvironment as O, type ProvidedContext as P, type CSSModuleScopeStrategy as Q, type ResolvedConfig as R, type ApiConfig as S, type TestSequencer as T, type UserConfig as U, type VitestRunMode as V, type WorkerGlobalState as W, type EnvironmentOptions as X, type DepsOptimizationOptions as Y, type TransformModePatterns as Z, type InlineConfig as _, type ResolvedCoverageOptions as a, type ProjectConfig as a0, type UserWorkspaceConfig as a1, type RunnerRPC as a2, type ContextTestEnvironment as a3, type ResolvedTestEnvironment as a4, type ResolveIdFunction as a5, type WorkerRPC as a6, type Awaitable as a7, type Nullable as a8, type Arrayable as a9, defineConfig as aA, defineProject as aB, defineWorkspace as aC, configDefaults as aD, defaultInclude as aE, defaultExclude as aF, coverageConfigDefaults as aG, extraInlineDeps as aH, DefaultReporter as aI, BasicReporter as aJ, DotReporter as aK, JsonReporter$1 as aL, VerboseReporter as aM, TapReporter as aN, JUnitReporter as aO, TapFlatReporter as aP, HangingProcessReporter as aQ, GithubActionsReporter as aR, BaseReporter as aS, ReportersMap as aT, type BuiltinReporters as aU, type BuiltinReporterOptions as aV, type JsonAssertionResult as aW, type JsonTestResult as aX, type JsonTestResults as aY, BenchmarkReportsMap as aZ, type BenchmarkBuiltinReporters as a_, type ArgumentsType$1 as aa, type MutableArray as ab, type Constructable as ac, type ModuleCache as ad, type EnvironmentReturn as ae, type VmEnvironmentReturn as af, type OnServerRestartHandler as ag, type ReportContext as ah, type CoverageReporter as ai, type CoverageIstanbulOptions as aj, type CoverageV8Options as ak, type CustomProviderOptions as al, type BenchmarkUserOptions as am, type Benchmark as an, type BenchmarkResult as ao, type BenchFunction as ap, type BenchmarkAPI as aq, type PendingSuiteMock as ar, type MockFactory as as, type MockMap as at, type UserConfigFnObject as au, type UserConfigFnPromise as av, type UserConfigFn as aw, type UserConfigExport as ax, type UserProjectConfigFn as ay, type UserProjectConfigExport as az, type CoverageProvider as b, type CoverageProviderModule as c, type BirpcOptions as d, type RuntimeRPC as e, type ContextRPC as f, type WorkerContext as g, type VitestOptions as h, Vitest as i, type CliOptions as j, WorkspaceProject as k, type WorkspaceSpec as l, type ProcessPool as m, VitestPackageInstaller as n, type TestSequencerConstructor as o, type BrowserProviderInitializationOptions as p, type BrowserProvider as q, type BrowserProviderOptions as r, startVitest as s, type RuntimeConfig as t, type UserConsoleLog as u, type ModuleGraphData as v, type Reporter as w, type RawErrsMap as x, type TscErrorInfo as y, type CollectLineNumbers as z };
2822
+ export { type UserWorkspaceConfig as $, type AfterSuiteRunMeta as A, type BaseCoverageOptions as B, type CoverageOptions as C, type Context as D, type Environment as E, type FakeTimerInstallOpts as F, type Pool as G, type PoolOptions as H, type HappyDOMOptions as I, type JSDOMOptions as J, type BuiltinEnvironment as K, type VitestEnvironment as L, type MockFactoryWithHelper as M, type CSSModuleScopeStrategy as N, type ApiConfig as O, type ProvidedContext as P, type EnvironmentOptions as Q, type ResolvedConfig as R, type DepsOptimizationOptions as S, type TestSequencer as T, type UserConfig as U, type VitestRunMode as V, type WorkerGlobalState as W, type TransformModePatterns as X, type InlineConfig as Y, type TypecheckConfig as Z, type ProjectConfig as _, type ResolvedCoverageOptions as a, type RunnerRPC as a0, type ContextTestEnvironment as a1, type ResolvedTestEnvironment as a2, type ResolveIdFunction as a3, type WorkerRPC as a4, type Awaitable as a5, type Nullable as a6, type Arrayable as a7, type ArgumentsType$1 as a8, type MutableArray as a9, defineWorkspace as aA, configDefaults as aB, defaultInclude as aC, defaultExclude as aD, coverageConfigDefaults as aE, extraInlineDeps as aF, DefaultReporter as aG, BasicReporter as aH, DotReporter as aI, JsonReporter$1 as aJ, VerboseReporter as aK, TapReporter as aL, JUnitReporter as aM, TapFlatReporter as aN, HangingProcessReporter as aO, GithubActionsReporter as aP, BaseReporter as aQ, ReportersMap as aR, type BuiltinReporters as aS, type BuiltinReporterOptions as aT, type JsonAssertionResult as aU, type JsonTestResult as aV, type JsonTestResults as aW, BenchmarkReportsMap as aX, type BenchmarkBuiltinReporters as aY, type Constructable as aa, type ModuleCache as ab, type EnvironmentReturn as ac, type VmEnvironmentReturn as ad, type OnServerRestartHandler as ae, type ReportContext as af, type CoverageReporter as ag, type CoverageIstanbulOptions as ah, type CoverageV8Options as ai, type CustomProviderOptions as aj, type BenchmarkUserOptions as ak, type Benchmark as al, type BenchmarkResult as am, type BenchFunction as an, type BenchmarkAPI as ao, type PendingSuiteMock as ap, type MockFactory as aq, type MockMap as ar, type UserConfigFnObject as as, type UserConfigFnPromise as at, type UserConfigFn as au, type UserConfigExport as av, type UserProjectConfigFn as aw, type UserProjectConfigExport as ax, defineConfig as ay, defineProject as az, type CoverageProvider as b, type CoverageProviderModule as c, type BirpcOptions as d, type RuntimeRPC as e, type ContextRPC as f, type WorkerContext as g, type VitestOptions as h, Vitest as i, WorkspaceProject as j, type WorkspaceSpec as k, type ProcessPool as l, VitestPackageInstaller as m, type TestSequencerConstructor as n, type BrowserProviderInitializationOptions as o, type BrowserProvider as p, type BrowserProviderOptions as q, type RuntimeConfig as r, type UserConsoleLog as s, type ModuleGraphData as t, type Reporter as u, type RawErrsMap as v, type TscErrorInfo as w, type CollectLineNumbers as x, type CollectLines as y, type RootAndTarget as z };
@@ -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-LqC_WI4d.js';
1
+ export { aQ as BaseReporter, aH as BasicReporter, aY as BenchmarkBuiltinReporters, aX as BenchmarkReportsMap, aT as BuiltinReporterOptions, aS as BuiltinReporters, aG as DefaultReporter, aI as DotReporter, aP as GithubActionsReporter, aO as HangingProcessReporter, aM as JUnitReporter, aU as JsonAssertionResult, aJ as JsonReporter, aV as JsonTestResult, aW as JsonTestResults, u as Reporter, aR as ReportersMap, aN as TapFlatReporter, aL as TapReporter, aK as VerboseReporter } from './reporters-xEmem8D4.js';
2
2
  import 'vite';
3
3
  import '@vitest/runner';
4
4
  import 'vite-node';
@@ -7,6 +7,7 @@ import '@vitest/expect';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import 'tinybench';
10
+ import 'node:stream';
10
11
  import 'vite-node/client';
11
12
  import '@vitest/snapshot/manager';
12
13
  import 'vite-node/server';
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.kSaPvGW6.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.GlXSU9xI.js';
2
2
  import 'node:fs';
3
3
  import 'pathe';
4
4
  import './vendor/index.ir9i0ywP.js';
@@ -7,6 +7,8 @@ import '@vitest/runner/utils';
7
7
  import '@vitest/utils';
8
8
  import './vendor/global.CkGT_TMy.js';
9
9
  import 'picocolors';
10
+ import './vendor/utils.VYmeMh-u.js';
11
+ import './vendor/base.Xt0Omgh7.js';
10
12
  import './vendor/tasks.IknbGB2n.js';
11
13
  import 'node:perf_hooks';
12
14
  import './chunks/runtime-console.kbFEN7E-.js';
@@ -14,7 +16,6 @@ import 'node:stream';
14
16
  import 'node:console';
15
17
  import 'node:path';
16
18
  import './vendor/date.Ns1pGd_X.js';
17
- import './vendor/base.Xt0Omgh7.js';
18
19
  import '@vitest/utils/source-map';
19
20
  import 'node:os';
20
21
  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-LqC_WI4d.js';
2
+ import { R as ResolvedConfig } from './reporters-xEmem8D4.js';
3
3
  import * as tinybench from 'tinybench';
4
4
  import 'vite';
5
5
  import 'vite-node';
@@ -7,6 +7,7 @@ import '@vitest/snapshot';
7
7
  import '@vitest/expect';
8
8
  import '@vitest/runner/utils';
9
9
  import '@vitest/utils';
10
+ import 'node:stream';
10
11
  import 'vite-node/client';
11
12
  import '@vitest/snapshot/manager';
12
13
  import 'vite-node/server';
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.Fxjax7rQ.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.Y_w82WR8.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';