vitest 3.0.0-beta.1 → 3.0.0-beta.3

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 +12 -9
  2. package/dist/browser.js +2 -2
  3. package/dist/chunks/{RandomSequencer.gisBJ77r.js → RandomSequencer.C6x84bNN.js} +4 -3
  4. package/dist/chunks/{base.CkcgFVQd.js → base.CQ2VEtuH.js} +1 -1
  5. package/dist/chunks/{cac.CWCZimpS.js → cac.e7qW4xLT.js} +34 -18
  6. package/dist/chunks/{cli-api.BKUOv0Nc.js → cli-api.CWDlED-m.js} +1126 -537
  7. package/dist/chunks/{coverage.BoMDb1ip.js → coverage.BWeNbfBa.js} +4 -4
  8. package/dist/chunks/{creator.DcAcUhMD.js → creator.Ot9GlSGw.js} +16 -14
  9. package/dist/chunks/{environment.CT0jpO-1.d.ts → environment.d8YfPkTm.d.ts} +1 -3
  10. package/dist/chunks/{globals.DJTzb7B3.js → globals.BFncSRNA.js} +2 -2
  11. package/dist/chunks/{index.CkOJwybT.js → index.BBoOXW-l.js} +7 -2
  12. package/dist/chunks/{index.BqHViJW9.js → index.CkWmZCXU.js} +1 -1
  13. package/dist/chunks/{index.DKe7vK-G.js → index.CzkCSFCy.js} +670 -628
  14. package/dist/chunks/{reporters.BZbwTvrM.d.ts → reporters.DCiyjXOg.d.ts} +634 -532
  15. package/dist/chunks/{resolveConfig.3rGGWga5.js → resolveConfig.C1d7TK-U.js} +5560 -5541
  16. package/dist/chunks/{runBaseTests.C6huCAng.js → runBaseTests.qNWRkgHj.js} +11 -10
  17. package/dist/chunks/{setup-common.B5ClyS48.js → setup-common.Cp_bu5q3.js} +1 -1
  18. package/dist/chunks/types.BOjykUpq.d.ts +27 -0
  19. package/dist/chunks/{utils.CMUTX-p8.js → utils.Coei4Wlj.js} +1 -1
  20. package/dist/chunks/{vi.CZKezqeD.js → vi.S4Fq8wSo.js} +2 -1
  21. package/dist/chunks/{vite.DIfmneq0.d.ts → vite.CRSMFy31.d.ts} +1 -1
  22. package/dist/chunks/{worker.umPNbBNk.d.ts → worker.R-PA7DpW.d.ts} +1 -1
  23. package/dist/chunks/{worker.CmzGeuVD.d.ts → worker.XbtCXEXv.d.ts} +4 -3
  24. package/dist/cli.js +1 -1
  25. package/dist/config.cjs +1 -0
  26. package/dist/config.d.ts +6 -8
  27. package/dist/config.js +1 -0
  28. package/dist/coverage.d.ts +4 -6
  29. package/dist/coverage.js +33 -8
  30. package/dist/environments.d.ts +2 -2
  31. package/dist/execute.d.ts +2 -2
  32. package/dist/index.d.ts +11 -14
  33. package/dist/index.js +2 -2
  34. package/dist/node.d.ts +22 -17
  35. package/dist/node.js +66 -32
  36. package/dist/reporters.d.ts +4 -6
  37. package/dist/reporters.js +3 -3
  38. package/dist/runners.d.ts +2 -2
  39. package/dist/runners.js +3 -3
  40. package/dist/suite.d.ts +1 -1
  41. package/dist/workers/forks.js +1 -1
  42. package/dist/workers/runVmTests.js +7 -7
  43. package/dist/workers/threads.js +1 -1
  44. package/dist/workers.d.ts +3 -3
  45. package/dist/workers.js +1 -1
  46. package/package.json +15 -15
@@ -1,8 +1,8 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { startTests, collectTests } from '@vitest/runner';
3
- import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.CkOJwybT.js';
4
- import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.BoMDb1ip.js';
5
- import { a as globalExpect, v as vi } from './vi.CZKezqeD.js';
3
+ import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.BBoOXW-l.js';
4
+ import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.BWeNbfBa.js';
5
+ import { a as globalExpect, v as vi } from './vi.S4Fq8wSo.js';
6
6
  import { c as closeInspector } from './inspector.DKLceBVD.js';
7
7
  import { createRequire } from 'node:module';
8
8
  import timers from 'node:timers';
@@ -10,8 +10,8 @@ import util from 'node:util';
10
10
  import { getSafeTimers } from '@vitest/utils';
11
11
  import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
12
12
  import { installSourcemapsSupport } from 'vite-node/source-map';
13
- import { V as VitestIndex } from './index.BqHViJW9.js';
14
- import { s as setupCommonEnv } from './setup-common.B5ClyS48.js';
13
+ import { V as VitestIndex } from './index.CkWmZCXU.js';
14
+ import { s as setupCommonEnv } from './setup-common.Cp_bu5q3.js';
15
15
  import { g as getWorkerState, r as resetModules } from './utils.C8RiOc4B.js';
16
16
  import 'chai';
17
17
  import 'node:path';
@@ -97,8 +97,11 @@ async function withEnv({ environment }, options, fn) {
97
97
 
98
98
  async function run(method, files, config, environment, executor) {
99
99
  const workerState = getWorkerState();
100
+ const isIsolatedThreads = config.pool === "threads" && (config.poolOptions?.threads?.isolate ?? true);
101
+ const isIsolatedForks = config.pool === "forks" && (config.poolOptions?.forks?.isolate ?? true);
102
+ const isolate = isIsolatedThreads || isIsolatedForks;
100
103
  await setupGlobalEnv(config, environment, executor);
101
- await startCoverageInsideWorker(config.coverage, executor);
104
+ await startCoverageInsideWorker(config.coverage, executor, { isolate });
102
105
  if (config.chaiConfig) {
103
106
  setupChaiConfig(config.chaiConfig);
104
107
  }
@@ -115,9 +118,7 @@ async function run(method, files, config, environment, executor) {
115
118
  async () => {
116
119
  workerState.durations.environment = performance.now() - workerState.durations.environment;
117
120
  for (const file of files) {
118
- const isIsolatedThreads = config.pool === "threads" && (config.poolOptions?.threads?.isolate ?? true);
119
- const isIsolatedForks = config.pool === "forks" && (config.poolOptions?.forks?.isolate ?? true);
120
- if (isIsolatedThreads || isIsolatedForks) {
121
+ if (isolate) {
121
122
  executor.mocker.reset();
122
123
  resetModules(workerState.moduleCache, true);
123
124
  }
@@ -130,7 +131,7 @@ async function run(method, files, config, environment, executor) {
130
131
  vi.resetConfig();
131
132
  vi.restoreAllMocks();
132
133
  }
133
- await stopCoverageInsideWorker(config.coverage, executor);
134
+ await stopCoverageInsideWorker(config.coverage, executor, { isolate });
134
135
  }
135
136
  );
136
137
  workerState.environmentTeardownRun = true;
@@ -13,7 +13,7 @@ async function setupCommonEnv(config) {
13
13
  globalSetup = true;
14
14
  setSafeTimers();
15
15
  if (config.globals) {
16
- (await import('./globals.DJTzb7B3.js')).registerApiGlobally();
16
+ (await import('./globals.BFncSRNA.js')).registerApiGlobally();
17
17
  }
18
18
  }
19
19
  function setupDefines(defines) {
@@ -0,0 +1,27 @@
1
+ type RawErrsMap = Map<string, TscErrorInfo[]>;
2
+ interface TscErrorInfo {
3
+ filePath: string;
4
+ errCode: number;
5
+ errMsg: string;
6
+ line: number;
7
+ column: number;
8
+ }
9
+ interface CollectLineNumbers {
10
+ target: number;
11
+ next: number;
12
+ prev?: number;
13
+ }
14
+ type CollectLines = {
15
+ [key in keyof CollectLineNumbers]: string;
16
+ };
17
+ interface RootAndTarget {
18
+ root: string;
19
+ targetAbsPath: string;
20
+ }
21
+ type Context = RootAndTarget & {
22
+ rawErrsMap: RawErrsMap;
23
+ openedDirs: Set<string>;
24
+ lastActivePath?: string;
25
+ };
26
+
27
+ export type { CollectLineNumbers as C, RawErrsMap as R, TscErrorInfo as T, CollectLines as a, RootAndTarget as b, Context as c };
@@ -126,7 +126,7 @@ function getStateSymbol(task) {
126
126
  if (!task.result) {
127
127
  return pending;
128
128
  }
129
- if (task.result.state === "run") {
129
+ if (task.result.state === "run" || task.result.state === "queued") {
130
130
  if (task.type === "suite") {
131
131
  return pointer;
132
132
  }
@@ -1,4 +1,4 @@
1
- import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, ASYMMETRIC_MATCHERS_OBJECT, getState, setState, addCustomEqualityTesters } from '@vitest/expect';
1
+ import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, ASYMMETRIC_MATCHERS_OBJECT, getState, setState, addCustomEqualityTesters, customMatchers } from '@vitest/expect';
2
2
  import { getCurrentTest } from '@vitest/runner';
3
3
  import { getNames, getTestName } from '@vitest/runner/utils';
4
4
  import * as chai$1 from 'chai';
@@ -566,6 +566,7 @@ function createExpect(test) {
566
566
  }
567
567
  chai$1.util.addMethod(expect, "assertions", assertions);
568
568
  chai$1.util.addMethod(expect, "hasAssertions", hasAssertions);
569
+ expect.extend(customMatchers);
569
570
  return expect;
570
571
  }
571
572
  const globalExpect = createExpect();
@@ -1,4 +1,4 @@
1
- import { I as InlineConfig } from './reporters.BZbwTvrM.js';
1
+ import { I as InlineConfig } from './reporters.DCiyjXOg.js';
2
2
 
3
3
  type VitestInlineConfig = InlineConfig;
4
4
  declare module 'vite' {
@@ -1,5 +1,5 @@
1
1
  import { MessagePort } from 'node:worker_threads';
2
- import { C as ContextRPC } from './worker.CmzGeuVD.js';
2
+ import { C as ContextRPC } from './worker.XbtCXEXv.js';
3
3
 
4
4
  interface WorkerContext extends ContextRPC {
5
5
  port: MessagePort;
@@ -1,7 +1,7 @@
1
- import { File, TaskResultPack, CancelReason, FileSpec, Task } from '@vitest/runner';
1
+ import { File, TaskResultPack, CancelReason, FileSpecification, Task } from '@vitest/runner';
2
2
  import { ViteNodeResolveId, ModuleCacheMap } from 'vite-node';
3
3
  import { S as SerializedConfig } from './config.BTPBhmK5.js';
4
- import { T as TransformMode, U as UserConsoleLog, A as AfterSuiteRunMeta, E as Environment } from './environment.CT0jpO-1.js';
4
+ import { T as TransformMode, U as UserConsoleLog, A as AfterSuiteRunMeta, E as Environment } from './environment.d8YfPkTm.js';
5
5
  import { SnapshotResult } from '@vitest/snapshot';
6
6
 
7
7
  type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
@@ -104,6 +104,7 @@ interface RuntimeRPC {
104
104
  onPathsCollected: (paths: string[]) => void;
105
105
  onUserConsoleLog: (log: UserConsoleLog) => void;
106
106
  onUnhandledError: (err: unknown, type: string) => void;
107
+ onQueued: (file: File) => void;
107
108
  onCollected: (files: File[]) => Promise<void>;
108
109
  onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
109
110
  onTaskUpdate: (pack: TaskResultPack[]) => Promise<void>;
@@ -130,7 +131,7 @@ interface ContextRPC {
130
131
  workerId: number;
131
132
  config: SerializedConfig;
132
133
  projectName: string;
133
- files: string[] | FileSpec[];
134
+ files: string[] | FileSpecification[];
134
135
  environment: ContextTestEnvironment;
135
136
  providedContext: Record<string, any>;
136
137
  invalidates?: string[];
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createCLI } from './chunks/cac.CWCZimpS.js';
1
+ import { c as createCLI } from './chunks/cac.e7qW4xLT.js';
2
2
  import '@vitest/utils';
3
3
  import 'events';
4
4
  import 'pathe';
package/dist/config.cjs CHANGED
@@ -15,6 +15,7 @@ const extraInlineDeps = [
15
15
  const isNode = typeof process < "u" && typeof process.stdout < "u" && !process.versions?.deno && !globalThis.window;
16
16
  const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !== void 0;
17
17
  (isNode || isDeno) && process.platform === "win32";
18
+ (isNode || isDeno) && process.stdout?.isTTY && !stdEnv.isCI;
18
19
 
19
20
  const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
20
21
  const defaultExclude = [
package/dist/config.d.ts CHANGED
@@ -1,25 +1,23 @@
1
1
  import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
3
- import { R as ResolvedCoverageOptions, d as CoverageV8Options, U as UserWorkspaceConfig, e as UserProjectConfigFn, f as UserProjectConfigExport, T as TestProjectConfiguration } from './chunks/reporters.BZbwTvrM.js';
4
- export { W as WorkspaceProjectConfiguration } from './chunks/reporters.BZbwTvrM.js';
5
- import './chunks/vite.DIfmneq0.js';
3
+ import { R as ResolvedCoverageOptions, d as CoverageV8Options, U as UserWorkspaceConfig, e as UserProjectConfigFn, f as UserProjectConfigExport, T as TestProjectConfiguration } from './chunks/reporters.DCiyjXOg.js';
4
+ export { W as WorkspaceProjectConfiguration } from './chunks/reporters.DCiyjXOg.js';
5
+ import './chunks/vite.CRSMFy31.js';
6
6
  import '@vitest/runner';
7
- import './chunks/environment.CT0jpO-1.js';
8
- import 'node:stream';
7
+ import './chunks/environment.d8YfPkTm.js';
9
8
  import '@vitest/utils';
10
- import 'vite-node';
9
+ import 'node:stream';
11
10
  import '@vitest/utils/source-map';
12
11
  import './chunks/config.BTPBhmK5.js';
13
12
  import '@vitest/pretty-format';
14
13
  import '@vitest/snapshot';
15
14
  import '@vitest/snapshot/environment';
16
15
  import '@vitest/utils/diff';
16
+ import 'vite-node';
17
17
  import 'chai';
18
18
  import './chunks/benchmark.CFFwLv-O.js';
19
19
  import '@vitest/runner/utils';
20
20
  import 'tinybench';
21
- import 'vite-node/client';
22
- import 'vite-node/server';
23
21
  import '@vitest/snapshot/manager';
24
22
  import 'node:fs';
25
23
 
package/dist/config.js CHANGED
@@ -13,6 +13,7 @@ const extraInlineDeps = [
13
13
  const isNode = typeof process < "u" && typeof process.stdout < "u" && !process.versions?.deno && !globalThis.window;
14
14
  const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !== void 0;
15
15
  (isNode || isDeno) && process.platform === "win32";
16
+ (isNode || isDeno) && process.stdout?.isTTY && !isCI;
16
17
 
17
18
  const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
18
19
  const defaultExclude = [
@@ -1,22 +1,20 @@
1
1
  import * as vite from 'vite';
2
- import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.BZbwTvrM.js';
3
- import { A as AfterSuiteRunMeta } from './chunks/environment.CT0jpO-1.js';
2
+ import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.DCiyjXOg.js';
3
+ import { A as AfterSuiteRunMeta } from './chunks/environment.d8YfPkTm.js';
4
4
  import '@vitest/runner';
5
- import 'node:stream';
6
5
  import '@vitest/utils';
7
- import 'vite-node';
6
+ import 'node:stream';
8
7
  import '@vitest/utils/source-map';
9
8
  import './chunks/config.BTPBhmK5.js';
10
9
  import '@vitest/pretty-format';
11
10
  import '@vitest/snapshot';
12
11
  import '@vitest/snapshot/environment';
13
12
  import '@vitest/utils/diff';
13
+ import 'vite-node';
14
14
  import 'chai';
15
15
  import './chunks/benchmark.CFFwLv-O.js';
16
16
  import '@vitest/runner/utils';
17
17
  import 'tinybench';
18
- import 'vite-node/client';
19
- import 'vite-node/server';
20
18
  import '@vitest/snapshot/manager';
21
19
  import 'node:fs';
22
20
 
package/dist/coverage.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { existsSync, promises, readdirSync, writeFileSync } from 'node:fs';
2
- import { c as coverageConfigDefaults, r as resolveCoverageReporters, m as mm } from './chunks/resolveConfig.3rGGWga5.js';
2
+ import { c as coverageConfigDefaults, r as resolveCoverageReporters, m as mm } from './chunks/resolveConfig.C1d7TK-U.js';
3
3
  import { resolve, relative } from 'pathe';
4
4
  import c from 'tinyrainbow';
5
5
  import '@vitest/utils';
@@ -13,7 +13,7 @@ import 'node:v8';
13
13
  import 'node:util';
14
14
  import './chunks/constants.fzPh7AOq.js';
15
15
  import 'node:os';
16
- import './chunks/RandomSequencer.gisBJ77r.js';
16
+ import './chunks/RandomSequencer.C6x84bNN.js';
17
17
  import 'std-env';
18
18
  import 'node:perf_hooks';
19
19
  import '@vitest/runner/utils';
@@ -271,7 +271,10 @@ Update your dependencies and make sure the versions match.`
271
271
  for (const { summary, file } of summaries) {
272
272
  for (const thresholdKey of THRESHOLD_KEYS) {
273
273
  const threshold = thresholds[thresholdKey];
274
- if (threshold !== void 0) {
274
+ if (threshold === void 0) {
275
+ continue;
276
+ }
277
+ if (threshold >= 0) {
275
278
  const coverage = summary.data[thresholdKey].pct;
276
279
  if (coverage < threshold) {
277
280
  process.exitCode = 1;
@@ -281,6 +284,17 @@ Update your dependencies and make sure the versions match.`
281
284
  }
282
285
  this.ctx.logger.error(errorMessage);
283
286
  }
287
+ } else {
288
+ const uncovered = summary.data[thresholdKey].total - summary.data[thresholdKey].covered;
289
+ const absoluteThreshold = threshold * -1;
290
+ if (uncovered > absoluteThreshold) {
291
+ process.exitCode = 1;
292
+ let errorMessage = `ERROR: Uncovered ${thresholdKey} (${uncovered}) exceed ${name === GLOBAL_THRESHOLDS_KEY ? name : `"${name}"`} threshold (${absoluteThreshold})`;
293
+ if (this.options.thresholds?.perFile && file) {
294
+ errorMessage += ` for ${relative("./", file).replace(/\\/g, "/")}`;
295
+ }
296
+ this.ctx.logger.error(errorMessage);
297
+ }
284
298
  }
285
299
  }
286
300
  }
@@ -300,11 +314,22 @@ Update your dependencies and make sure the versions match.`
300
314
  const thresholdsToUpdate = [];
301
315
  for (const key of THRESHOLD_KEYS) {
302
316
  const threshold = thresholds[key] ?? 100;
303
- const actual = Math.min(
304
- ...summaries.map((summary) => summary[key].pct)
305
- );
306
- if (actual > threshold) {
307
- thresholdsToUpdate.push([key, actual]);
317
+ if (threshold >= 0) {
318
+ const actual = Math.min(
319
+ ...summaries.map((summary) => summary[key].pct)
320
+ );
321
+ if (actual > threshold) {
322
+ thresholdsToUpdate.push([key, actual]);
323
+ }
324
+ } else {
325
+ const absoluteThreshold = threshold * -1;
326
+ const actual = Math.max(
327
+ ...summaries.map((summary) => summary[key].total - summary[key].covered)
328
+ );
329
+ if (actual < absoluteThreshold) {
330
+ const updatedThreshold = actual === 0 ? 100 : actual * -1;
331
+ thresholdsToUpdate.push([key, updatedThreshold]);
332
+ }
308
333
  }
309
334
  }
310
335
  if (thresholdsToUpdate.length === 0) {
@@ -1,5 +1,5 @@
1
- import { E as Environment } from './chunks/environment.CT0jpO-1.js';
2
- export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.CT0jpO-1.js';
1
+ import { E as Environment } from './chunks/environment.d8YfPkTm.js';
2
+ export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d8YfPkTm.js';
3
3
 
4
4
  declare const environments: {
5
5
  node: Environment;
package/dist/execute.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ViteNodeRunnerOptions } from 'vite-node';
2
2
  import { ViteNodeRunner } from 'vite-node/client';
3
- import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.CmzGeuVD.js';
3
+ import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.XbtCXEXv.js';
4
4
  import vm from 'node:vm';
5
5
  import * as _vitest_mocker from '@vitest/mocker';
6
6
  import { MockedModuleType } from '@vitest/mocker';
@@ -11,7 +11,7 @@ import '@vitest/pretty-format';
11
11
  import '@vitest/snapshot';
12
12
  import '@vitest/snapshot/environment';
13
13
  import '@vitest/utils/diff';
14
- import './chunks/environment.CT0jpO-1.js';
14
+ import './chunks/environment.d8YfPkTm.js';
15
15
 
16
16
  declare class FileMap {
17
17
  private fsCache;
package/dist/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import { TaskResultPack as TaskResultPack$1, File as File$1, TaskPopulated, Suite as Suite$1, Test as Test$1, Custom as Custom$1, Task as Task$1, TaskBase as TaskBase$1, TaskResult as TaskResult$1, DoneCallback as DoneCallback$1, RuntimeContext as RuntimeContext$1, SuiteHooks as SuiteHooks$1, SequenceHooks as SequenceHooks$1, SequenceSetupFiles as SequenceSetupFiles$1 } from '@vitest/runner';
2
2
  export { CancelReason, ExtendedContext, HookCleanupCallback, HookListener, OnTestFailedHandler, OnTestFinishedHandler, RunMode, Custom as RunnerCustomCase, Task as RunnerTask, TaskBase as RunnerTaskBase, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SuiteAPI, SuiteCollector, SuiteFactory, TaskContext, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
3
- import { g as VitestEnvironment$1, S as SerializedTestSpecification, h as RawErrsMap$1, i as TscErrorInfo$1, j as CollectLineNumbers$1, k as CollectLines$1, l as RootAndTarget$1, m as Context$1, b as CoverageProvider$1, a as ReportContext$1, c as CoverageProviderModule$1, n as CoverageReporter$1, o as CoverageProviderName, p as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, q as CoverageIstanbulOptions$1, d as CoverageV8Options$1, r as CustomProviderOptions$1, s as Reporter$1, V as Vitest$1, t as BrowserScript$1, u as BrowserConfigOptions$1, v as BuiltinEnvironment$1, P as Pool$1, w as PoolOptions$1, x as CSSModuleScopeStrategy$1, A as ApiConfig$1, y as VitestRunMode$1, D as DepsOptimizationOptions$1, z as TransformModePatterns$1, I as InlineConfig$1, E as TypecheckConfig$1, F as UserConfig$1, G as ResolvedConfig$1, H as ProjectConfig$1, U as UserWorkspaceConfig$1, J as BenchmarkUserOptions$1 } from './chunks/reporters.BZbwTvrM.js';
4
- import { W as WorkerContext$1 } from './chunks/worker.umPNbBNk.js';
5
- import { U as UserConsoleLog, M as ModuleGraphData, b as Awaitable$1, P as ProvidedContext, N as Nullable$1, c as Arrayable$1, d as ArgumentsType$1, e as MutableArray$1, C as Constructable$1, O as OnServerRestartHandler$1, a as EnvironmentReturn$1, V as VmEnvironmentReturn$1, E as Environment$1, R as ResolvedTestEnvironment$1, J as JSDOMOptions$1, H as HappyDOMOptions$1, f as EnvironmentOptions$1 } from './chunks/environment.CT0jpO-1.js';
6
- export { A as AfterSuiteRunMeta, g as ModuleCache } from './chunks/environment.CT0jpO-1.js';
7
- import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.CmzGeuVD.js';
8
- export { C as ContextRPC, d as ContextTestEnvironment, e as ResolveIdFunction, c as RunnerRPC, R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.CmzGeuVD.js';
9
- import './chunks/vite.DIfmneq0.js';
3
+ import { S as SerializedTestSpecification, b as CoverageProvider$1, a as ReportContext$1, c as CoverageProviderModule$1, g as CoverageReporter$1, h as CoverageProviderName, i as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, j as CoverageIstanbulOptions$1, d as CoverageV8Options$1, k as CustomProviderOptions$1, l as Reporter$1, V as Vitest$1, m as BrowserScript$1, n as BrowserConfigOptions$1, o as BuiltinEnvironment$1, p as VitestEnvironment$1, P as Pool$1, q as PoolOptions$1, r as CSSModuleScopeStrategy$1, A as ApiConfig$1, s as VitestRunMode$1, D as DepsOptimizationOptions$1, t as TransformModePatterns$1, I as InlineConfig$1, u as TypecheckConfig$1, v as UserConfig$1, w as ResolvedConfig$1, x as ProjectConfig$1, U as UserWorkspaceConfig$1, y as BenchmarkUserOptions$1 } from './chunks/reporters.DCiyjXOg.js';
4
+ import { W as WorkerContext$1 } from './chunks/worker.R-PA7DpW.js';
5
+ import { R as RawErrsMap$1, T as TscErrorInfo$1, C as CollectLineNumbers$1, a as CollectLines$1, b as RootAndTarget$1, c as Context$1 } from './chunks/types.BOjykUpq.js';
6
+ import { U as UserConsoleLog, M as ModuleGraphData, b as Awaitable$1, P as ProvidedContext, N as Nullable$1, c as Arrayable$1, d as ArgumentsType$1, e as MutableArray$1, C as Constructable$1, a as EnvironmentReturn$1, V as VmEnvironmentReturn$1, E as Environment$1, R as ResolvedTestEnvironment$1, J as JSDOMOptions$1, H as HappyDOMOptions$1, f as EnvironmentOptions$1 } from './chunks/environment.d8YfPkTm.js';
7
+ export { A as AfterSuiteRunMeta, g as ModuleCache } from './chunks/environment.d8YfPkTm.js';
8
+ import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.XbtCXEXv.js';
9
+ export { C as ContextRPC, d as ContextTestEnvironment, e as ResolveIdFunction, c as RunnerRPC, R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.XbtCXEXv.js';
10
+ import './chunks/vite.CRSMFy31.js';
10
11
  import { PromisifyAssertion, Tester, ExpectStatic } from '@vitest/expect';
11
12
  export { Assertion, AsymmetricMatchersContaining, ExpectPollOptions, ExpectStatic, JestAssertion } from '@vitest/expect';
12
13
  import { Plugin } from '@vitest/pretty-format';
@@ -29,10 +30,8 @@ export { assert, should } from 'chai';
29
30
  export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
30
31
  import 'node:stream';
31
32
  import 'vite';
32
- import 'vite-node';
33
33
  import '@vitest/utils/source-map';
34
- import 'vite-node/client';
35
- import 'vite-node/server';
34
+ import 'vite-node';
36
35
  import '@vitest/snapshot/manager';
37
36
  import 'node:fs';
38
37
  import 'node:worker_threads';
@@ -64,7 +63,7 @@ interface InlineSnapshotMatcher<T> {
64
63
  }
65
64
  declare module '@vitest/expect' {
66
65
  interface MatcherState {
67
- environment: VitestEnvironment$1;
66
+ environment: string;
68
67
  snapshotState: SnapshotState;
69
68
  }
70
69
  interface ExpectPollOptions {
@@ -633,8 +632,6 @@ type ArgumentsType<T> = ArgumentsType$1<T>;
633
632
  type MutableArray<T extends readonly any[]> = MutableArray$1<T>;
634
633
  /** @deprecated do not use, internal helper */
635
634
  type Constructable = Constructable$1;
636
- /** @deprecated import from `vitest/node` instead */
637
- type OnServerRestartHandler = OnServerRestartHandler$1;
638
635
 
639
636
  /** @deprecated import from `vitest/environments` instead */
640
637
  type EnvironmentReturn = EnvironmentReturn$1;
@@ -721,4 +718,4 @@ type SerializableSpec = SerializedTestSpecification;
721
718
  /** @deprecated import from `vitest/node` instead */
722
719
  type BenchmarkUserOptions = BenchmarkUserOptions$1;
723
720
 
724
- export { type ApiConfig, type ArgumentsType, type Arrayable, type AssertType, type Awaitable, type BaseCoverageOptions, BenchmarkResult, type BenchmarkUserOptions, type BrowserConfigOptions, type BrowserScript, type BrowserUI, type BuiltinEnvironment, type CSSModuleScopeStrategy, type CollectLineNumbers, type CollectLines, type Constructable, type Context, type CoverageIstanbulOptions, type CoverageOptions, type CoverageProvider, type CoverageProviderModule, type CoverageReporter, type CoverageV8Options, type Custom, type CustomProviderOptions, type DepsOptimizationOptions, type DoneCallback, type Environment, type EnvironmentOptions, type EnvironmentReturn, type File, type HappyDOMOptions, type InlineConfig, type JSDOMOptions, ModuleGraphData, type MutableArray, type Nullable, type OnServerRestartHandler, type Pool, type PoolOptions, type ProjectConfig, ProvidedContext, type RawErrsMap, type ReportContext, type Reporter, type ResolvedConfig, type ResolvedCoverageOptions, type ResolvedTestEnvironment, type RootAndTarget, type RuntimeContext, type SequenceHooks, type SequenceSetupFiles, type SerializableSpec, SerializedConfig, SerializedTestSpecification, type Suite, type SuiteHooks, type Task, type TaskBase, type TaskResult, type TaskResultPack, type Test, type TransformModePatterns, type TransformResultWithSource, type TscErrorInfo, type TypecheckConfig, type UserConfig, UserConsoleLog, type UserWorkspaceConfig, type Vitest, type VitestEnvironment, type VitestRunMode, type VitestUtils, type VmEnvironmentReturn, type WebSocketEvents, type WebSocketHandlers, type WebSocketRPC, type WorkerContext, type WorkerRPC, assertType, createExpect, globalExpect as expect, getRunningMode, inject, isFirstRun, isWatchMode, runOnce, vi, vitest };
721
+ export { type ApiConfig, type ArgumentsType, type Arrayable, type AssertType, type Awaitable, type BaseCoverageOptions, BenchmarkResult, type BenchmarkUserOptions, type BrowserConfigOptions, type BrowserScript, type BrowserUI, type BuiltinEnvironment, type CSSModuleScopeStrategy, type CollectLineNumbers, type CollectLines, type Constructable, type Context, type CoverageIstanbulOptions, type CoverageOptions, type CoverageProvider, type CoverageProviderModule, type CoverageReporter, type CoverageV8Options, type Custom, type CustomProviderOptions, type DepsOptimizationOptions, type DoneCallback, type Environment, type EnvironmentOptions, type EnvironmentReturn, type File, type HappyDOMOptions, type InlineConfig, type JSDOMOptions, ModuleGraphData, type MutableArray, type Nullable, type Pool, type PoolOptions, type ProjectConfig, ProvidedContext, type RawErrsMap, type ReportContext, type Reporter, type ResolvedConfig, type ResolvedCoverageOptions, type ResolvedTestEnvironment, type RootAndTarget, type RuntimeContext, type SequenceHooks, type SequenceSetupFiles, type SerializableSpec, SerializedConfig, SerializedTestSpecification, type Suite, type SuiteHooks, type Task, type TaskBase, type TaskResult, type TaskResultPack, type Test, type TransformModePatterns, type TransformResultWithSource, type TscErrorInfo, type TypecheckConfig, type UserConfig, UserConsoleLog, type UserWorkspaceConfig, type Vitest, type VitestEnvironment, type VitestRunMode, type VitestUtils, type VmEnvironmentReturn, type WebSocketEvents, type WebSocketHandlers, type WebSocketRPC, type WorkerContext, type WorkerRPC, assertType, createExpect, globalExpect as expect, getRunningMode, inject, isFirstRun, isWatchMode, runOnce, vi, vitest };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { c as createExpect, a as expect, i as inject, v as vi, b as vitest } from './chunks/vi.CZKezqeD.js';
1
+ export { c as createExpect, a as expect, i as inject, v as vi, b as vitest } from './chunks/vi.S4Fq8wSo.js';
2
2
  export { i as isFirstRun, a as runOnce } from './chunks/run-once.2ogXb3JV.js';
3
- export { a as assertType, g as getRunningMode, i as isWatchMode } from './chunks/index.BqHViJW9.js';
3
+ export { a as assertType, g as getRunningMode, i as isWatchMode } from './chunks/index.CkWmZCXU.js';
4
4
  export { b as bench } from './chunks/benchmark.Cdu9hjj4.js';
5
5
  export { expectTypeOf } from 'expect-type';
6
6
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
package/dist/node.d.ts CHANGED
@@ -1,28 +1,27 @@
1
- import { y as VitestRunMode, K as VitestOptions, V as Vitest, F as UserConfig$1, A as ApiConfig, L as Logger, G as ResolvedConfig$1, M as TestProject, N as TestSequencer, O as WorkspaceSpec, Q as TestModule, X as ModuleDiagnostic } from './chunks/reporters.BZbwTvrM.js';
2
- export { B as BaseCoverageOptions, J as BenchmarkUserOptions, ae as BrowserBuiltinProvider, af as BrowserCommand, ag as BrowserCommandContext, u as BrowserConfigOptions, ah as BrowserOrchestrator, ai as BrowserProvider, aj as BrowserProviderInitializationOptions, ak as BrowserProviderModule, al as BrowserProviderOptions, t as BrowserScript, am as BrowserServer, an as BrowserServerState, ao as BrowserServerStateContext, v as BuiltinEnvironment, ap as CDPSession, x as CSSModuleScopeStrategy, q as CoverageIstanbulOptions, p as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, n as CoverageReporter, d as CoverageV8Options, r as CustomProviderOptions, D as DepsOptimizationOptions, a0 as HTMLOptions, I as InlineConfig, a2 as JUnitOptions, a1 as JsonOptions, P as Pool, w as PoolOptions, Z as ProcessPool, H as ProjectConfig, a as ReportContext, as as ResolveSnapshotPathHandler, at as ResolveSnapshotPathHandlerContext, aq as ResolvedBrowserOptions, R as ResolvedCoverageOptions, ar as ResolvedProjectConfig, $ as SerializedTestProject, a5 as TaskOptions, a3 as TestCase, a6 as TestCollection, a7 as TestDiagnostic, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, ac as TestSequencerConstructor, ad as TestSpecification, a4 as TestSuite, z as TransformModePatterns, j as TypeCheckCollectLineNumbers, k as TypeCheckCollectLines, m as TypeCheckContext, i as TypeCheckErrorInfo, h as TypeCheckRawErrorsMap, l as TypeCheckRootAndTarget, E as TypecheckConfig, U as UserWorkspaceConfig, g as VitestEnvironment, Y as VitestPackageInstaller, _ as getFilePoolName } from './chunks/reporters.BZbwTvrM.js';
3
- import { UserConfig, ResolvedConfig, Plugin, LogLevel, LoggerOptions, Logger as Logger$1, createServer as createServer$1 } from 'vite';
1
+ import { s as VitestRunMode, z as VitestOptions, V as Vitest, v as UserConfig$1, A as ApiConfig, E as TestProject, w as ResolvedConfig, F as TestSequencer, G as TestSpecification, L as Logger, H as TestModule, M as ModuleDiagnostic } from './chunks/reporters.DCiyjXOg.js';
2
+ export { B as BaseCoverageOptions, y as BenchmarkUserOptions, aa as BrowserBuiltinProvider, ab as BrowserCommand, ac as BrowserCommandContext, n as BrowserConfigOptions, ad as BrowserInstanceOption, ae as BrowserOrchestrator, af as BrowserProvider, ag as BrowserProviderInitializationOptions, ah as BrowserProviderModule, ai as BrowserProviderOptions, m as BrowserScript, aj as BrowserServerState, ak as BrowserServerStateSession, o as BuiltinEnvironment, al as CDPSession, r as CSSModuleScopeStrategy, j as CoverageIstanbulOptions, i as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, g as CoverageReporter, d as CoverageV8Options, k as CustomProviderOptions, D as DepsOptimizationOptions, Z as HTMLOptions, I as InlineConfig, $ as JUnitOptions, _ as JsonOptions, O as OnServerRestartHandler, J as OnTestsRerunHandler, am as ParentProjectBrowser, P as Pool, q as PoolOptions, N as ProcessPool, an as ProjectBrowser, x as ProjectConfig, a as ReportContext, aq as ResolveSnapshotPathHandler, ar as ResolveSnapshotPathHandlerContext, ao as ResolvedBrowserOptions, R as ResolvedCoverageOptions, ap as ResolvedProjectConfig, Y as SerializedTestProject, a0 as TaskOptions, a1 as TestCase, a2 as TestCollection, a3 as TestDiagnostic, a4 as TestResult, a5 as TestResultFailed, a6 as TestResultPassed, a7 as TestResultSkipped, as as TestRunResult, a9 as TestSequencerConstructor, a8 as TestSuite, t as TransformModePatterns, u as TypecheckConfig, U as UserWorkspaceConfig, p as VitestEnvironment, K as VitestPackageInstaller, Q as WorkspaceSpec, X as getFilePoolName } from './chunks/reporters.DCiyjXOg.js';
3
+ import { UserConfig, Plugin, ResolvedConfig as ResolvedConfig$1, LogLevel, LoggerOptions, Logger as Logger$1, createServer as createServer$1 } from 'vite';
4
4
  import * as vite from 'vite';
5
5
  export { vite as Vite };
6
- export { isFileServingAllowed, parseAst, parseAstAsync } from 'vite';
7
- import { R as RuntimeRPC } from './chunks/worker.CmzGeuVD.js';
6
+ export { esbuildVersion, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
7
+ import { R as RuntimeRPC } from './chunks/worker.XbtCXEXv.js';
8
8
  import { Writable } from 'node:stream';
9
- export { W as WorkerContext } from './chunks/worker.umPNbBNk.js';
10
- export { f as EnvironmentOptions, H as HappyDOMOptions, J as JSDOMOptions, O as OnServerRestartHandler, h as OnTestsRerunHandler } from './chunks/environment.CT0jpO-1.js';
9
+ export { W as WorkerContext } from './chunks/worker.R-PA7DpW.js';
10
+ export { C as TypeCheckCollectLineNumbers, a as TypeCheckCollectLines, c as TypeCheckContext, T as TypeCheckErrorInfo, R as TypeCheckRawErrorsMap, b as TypeCheckRootAndTarget } from './chunks/types.BOjykUpq.js';
11
11
  import createDebug from 'debug';
12
+ export { generateFileHash } from '@vitest/runner/utils';
13
+ export { f as EnvironmentOptions, H as HappyDOMOptions, J as JSDOMOptions } from './chunks/environment.d8YfPkTm.js';
12
14
  export { b as RuntimeConfig } from './chunks/config.BTPBhmK5.js';
13
15
  export { SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
14
16
  import '@vitest/utils';
15
- import 'vite-node';
16
17
  import '@vitest/utils/source-map';
17
18
  import '@vitest/pretty-format';
18
19
  import '@vitest/snapshot';
19
20
  import '@vitest/utils/diff';
21
+ import 'vite-node';
20
22
  import 'chai';
21
23
  import './chunks/benchmark.CFFwLv-O.js';
22
- import '@vitest/runner/utils';
23
24
  import 'tinybench';
24
- import 'vite-node/client';
25
- import 'vite-node/server';
26
25
  import '@vitest/snapshot/manager';
27
26
  import 'node:fs';
28
27
  import 'node:worker_threads';
@@ -53,16 +52,15 @@ interface CliOptions extends UserConfig$1 {
53
52
  */
54
53
  declare function startVitest(mode: VitestRunMode, cliFilters?: string[], options?: CliOptions, viteOverrides?: UserConfig, vitestOptions?: VitestOptions): Promise<Vitest>;
55
54
 
56
- interface CLIOptions {
55
+ interface CliParseOptions {
57
56
  allowUnknownOptions?: boolean;
58
57
  }
59
- declare function parseCLI(argv: string | string[], config?: CLIOptions): {
58
+ declare function parseCLI(argv: string | string[], config?: CliParseOptions): {
60
59
  filter: string[];
61
60
  options: CliOptions;
62
61
  };
63
62
 
64
63
  declare function resolveApiServerConfig<Options extends ApiConfig & UserConfig$1>(options: Options, defaultPort: number): ApiConfig | undefined;
65
- declare function resolveConfig(mode: VitestRunMode, options: UserConfig$1, viteConfig: ResolvedConfig, logger: Logger): ResolvedConfig$1;
66
64
 
67
65
  declare function createVitest(mode: VitestRunMode, options: UserConfig$1, viteOverrides?: UserConfig, vitestOptions?: VitestOptions): Promise<Vitest>;
68
66
 
@@ -80,6 +78,11 @@ type GlobalSetupContext = TestProject;
80
78
 
81
79
  declare function VitestPlugin(options?: UserConfig$1, ctx?: Vitest): Promise<Plugin[]>;
82
80
 
81
+ declare function resolveConfig(options?: UserConfig$1, viteOverrides?: UserConfig): Promise<{
82
+ vitestConfig: ResolvedConfig;
83
+ viteConfig: ResolvedConfig$1;
84
+ }>;
85
+
83
86
  declare function resolveFsAllow(projectRoot: string, rootConfigFile: string | false | undefined): string[];
84
87
 
85
88
  interface MethodsOptions {
@@ -90,8 +93,8 @@ declare function createMethodsRPC(project: TestProject, options?: MethodsOptions
90
93
  declare class BaseSequencer implements TestSequencer {
91
94
  protected ctx: Vitest;
92
95
  constructor(ctx: Vitest);
93
- shard(files: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
94
- sort(files: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
96
+ shard(files: TestSpecification[]): Promise<TestSpecification[]>;
97
+ sort(files: TestSpecification[]): Promise<TestSpecification[]>;
95
98
  }
96
99
 
97
100
  declare function registerConsoleShortcuts(ctx: Vitest, stdin: NodeJS.ReadStream | undefined, stdout: NodeJS.WriteStream | Writable): () => void;
@@ -103,6 +106,8 @@ declare const distDir: string;
103
106
 
104
107
  declare function createDebugger(namespace: `vitest:${string}`): createDebug.Debugger | undefined;
105
108
 
109
+ declare const version: string;
110
+
106
111
  /** @deprecated use `createViteServer` instead */
107
112
  declare const createServer: typeof createServer$1;
108
113
  declare const createViteServer: typeof createServer$1;
@@ -117,4 +122,4 @@ declare const TestFile: typeof TestModule;
117
122
  */
118
123
  type FileDiagnostic = ModuleDiagnostic;
119
124
 
120
- export { ApiConfig, BaseSequencer, type FileDiagnostic, GitNotFoundError, type GlobalSetupContext, ModuleDiagnostic, ResolvedConfig$1 as ResolvedConfig, TestFile, TestModule, TestProject, TestSequencer, FilesNotFoundError as TestsNotFoundError, UserConfig$1 as UserConfig, Vitest, VitestPlugin, VitestRunMode, TestProject as WorkspaceProject, WorkspaceSpec, createDebugger, createMethodsRPC, createServer, createViteLogger, createViteServer, createVitest, distDir, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rootDir, startVitest };
125
+ export { ApiConfig, BaseSequencer, type CliParseOptions, type FileDiagnostic, GitNotFoundError, type GlobalSetupContext, ModuleDiagnostic, ResolvedConfig, TestFile, TestModule, TestProject, TestSequencer, TestSpecification, FilesNotFoundError as TestsNotFoundError, UserConfig$1 as UserConfig, Vitest, VitestOptions, VitestPlugin, VitestRunMode, TestProject as WorkspaceProject, createDebugger, createMethodsRPC, createServer, createViteLogger, createViteServer, createVitest, distDir, parseCLI, registerConsoleShortcuts, resolveApiServerConfig, resolveConfig, resolveFsAllow, rootDir, startVitest, version };