vitest 4.0.0-beta.1 → 4.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 (59) hide show
  1. package/dist/browser.d.ts +6 -6
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{base.Bj3pWTr1.js → base.D5_IXzht.js} +2 -2
  4. package/dist/chunks/{benchmark.d.BwvBVTda.d.ts → benchmark.d.DAaHLpsq.d.ts} +4 -4
  5. package/dist/chunks/{browser.d.q8Z0P0q1.d.ts → browser.d.BSPEQIuf.d.ts} +5 -5
  6. package/dist/chunks/{cac.D3EzDDZd.js → cac.C30xmylc.js} +11 -18
  7. package/dist/chunks/{cli-api.Dn5gKePv.js → cli-api.DE98RCgs.js} +53 -80
  8. package/dist/chunks/{config.d.HJdfX-8k.d.ts → config.d.DZo8c7fw.d.ts} +58 -58
  9. package/dist/chunks/{console.CtFJOzRO.js → console.DoJHFxmj.js} +3 -3
  10. package/dist/chunks/{constants.DnKduX2e.js → constants.CXzqaLmq.js} +1 -4
  11. package/dist/chunks/{coverage.Cwa-XhJt.js → coverage.OOpN1tMC.js} +54 -46
  12. package/dist/chunks/{coverage.d.S9RMNXIe.d.ts → coverage.d.CNYjU4GF.d.ts} +4 -4
  13. package/dist/chunks/{creator.GK6I-cL4.js → creator.CJNzQTzZ.js} +5 -5
  14. package/dist/chunks/{environment.d.CUq4cUgQ.d.ts → environment.d.Bhm9oc0v.d.ts} +1 -1
  15. package/dist/chunks/{execute.B7h3T_Hc.js → execute.Dt-pCVcL.js} +1 -1
  16. package/dist/chunks/{global.d.CVbXEflG.d.ts → global.d.DAhT2emn.d.ts} +2 -2
  17. package/dist/chunks/{globals.Cxal6MLI.js → globals.Dgo-vS5G.js} +3 -3
  18. package/dist/chunks/{index.CZI_8rVt.js → index.Bz6b0Ib7.js} +5 -5
  19. package/dist/chunks/{index.BWf_gE5n.js → index.D1_MsKEt.js} +1 -1
  20. package/dist/chunks/{index.TfbsX-3I.js → index.D3SKT3tv.js} +1 -1
  21. package/dist/chunks/{index.D-VkfKhf.js → index.Dppt57hu.js} +1 -1
  22. package/dist/chunks/{plugin.d.C2EcJUjo.d.ts → plugin.d.CKCmge5g.d.ts} +1 -1
  23. package/dist/chunks/{reporters.d.DxZg19fy.d.ts → reporters.d.BBuiUFDc.d.ts} +115 -145
  24. package/dist/chunks/{runBaseTests.BC7ZIH5L.js → runBaseTests.Bbi_gTJQ.js} +5 -5
  25. package/dist/chunks/{setup-common.D7ZqXFx-.js → setup-common.Ebx5x0eP.js} +1 -1
  26. package/dist/chunks/{suite.d.FvehnV49.d.ts → suite.d.BJWk38HB.d.ts} +1 -1
  27. package/dist/chunks/{typechecker.CVytUJuF.js → typechecker.CMNPqJOo.js} +3 -3
  28. package/dist/chunks/{utils.CAioKnHs.js → utils.CcGm2cd1.js} +1 -1
  29. package/dist/chunks/{vi.bdSIJ99Y.js → vi.CA0EPI9Y.js} +11 -11
  30. package/dist/chunks/{vm.BThCzidc.js → vm.BUnLJt_P.js} +11 -3
  31. package/dist/chunks/{worker.d.CmvJfRGs.d.ts → worker.d.DyXSTmRq.d.ts} +1 -1
  32. package/dist/chunks/{worker.d.DoNjFAiv.d.ts → worker.d.xTcinSQw.d.ts} +9 -15
  33. package/dist/cli.js +4 -4
  34. package/dist/config.d.ts +44 -44
  35. package/dist/config.js +1 -1
  36. package/dist/coverage.d.ts +20 -18
  37. package/dist/coverage.js +3 -3
  38. package/dist/environments.d.ts +9 -9
  39. package/dist/execute.d.ts +7 -7
  40. package/dist/execute.js +1 -1
  41. package/dist/index.d.ts +29 -27
  42. package/dist/index.js +2 -2
  43. package/dist/node.d.ts +23 -24
  44. package/dist/node.js +9 -9
  45. package/dist/reporters.d.ts +7 -7
  46. package/dist/reporters.js +3 -3
  47. package/dist/runners.d.ts +1 -1
  48. package/dist/runners.js +10 -3
  49. package/dist/suite.d.ts +2 -2
  50. package/dist/worker.js +1 -1
  51. package/dist/workers/forks.js +3 -3
  52. package/dist/workers/runVmTests.js +4 -4
  53. package/dist/workers/threads.js +3 -3
  54. package/dist/workers/vmForks.js +4 -4
  55. package/dist/workers/vmThreads.js +4 -4
  56. package/dist/workers.d.ts +4 -4
  57. package/dist/workers.js +5 -5
  58. package/globals.d.ts +17 -17
  59. package/package.json +17 -17
@@ -768,7 +768,7 @@ class Typechecker {
768
768
  let dataReceived = false;
769
769
  return new Promise((resolve, reject) => {
770
770
  if (!child.process || !child.process.stdout) {
771
- reject(new Error(`Failed to initialize ${typecheck.checker}. This is a bug in Vitest - please, open an issue with reproduction.`));
771
+ reject(/* @__PURE__ */ new Error(`Failed to initialize ${typecheck.checker}. This is a bug in Vitest - please, open an issue with reproduction.`));
772
772
  return;
773
773
  }
774
774
  child.process.stdout.on("data", (chunk) => {
@@ -792,7 +792,7 @@ class Typechecker {
792
792
  this._output = "";
793
793
  }
794
794
  });
795
- const timeout = setTimeout(() => reject(new Error(`${typecheck.checker} spawn timed out`)), this.project.config.typecheck.spawnTimeout);
795
+ const timeout = setTimeout(() => reject(/* @__PURE__ */ new Error(`${typecheck.checker} spawn timed out`)), this.project.config.typecheck.spawnTimeout);
796
796
  function onError(cause) {
797
797
  clearTimeout(timeout);
798
798
  reject(new Error("Spawning typechecker failed - is typescript installed?", { cause }));
@@ -811,7 +811,7 @@ class Typechecker {
811
811
  else resolve({ result: child });
812
812
  });
813
813
  if (process.platform === "win32") child.process.once("close", (code) => {
814
- if (code != null && code !== 0 && !dataReceived) onError(new Error(`The ${typecheck.checker} command exited with code ${code}.`));
814
+ if (code != null && code !== 0 && !dataReceived) onError(/* @__PURE__ */ new Error(`The ${typecheck.checker} command exited with code ${code}.`));
815
815
  });
816
816
  child.process.once("error", onError);
817
817
  });
@@ -46,7 +46,7 @@ function createForksRpcOptions(nodeV8) {
46
46
  function unwrapSerializableConfig(config) {
47
47
  if (config.testNamePattern && typeof config.testNamePattern === "string") {
48
48
  const testNamePattern = config.testNamePattern;
49
- if (testNamePattern.startsWith(REGEXP_WRAP_PREFIX)) config.testNamePattern = parseRegexp(testNamePattern.slice(REGEXP_WRAP_PREFIX.length));
49
+ if (testNamePattern.startsWith(REGEXP_WRAP_PREFIX)) config.testNamePattern = parseRegexp(testNamePattern.slice(9));
50
50
  }
51
51
  if (config.defines && Array.isArray(config.defines.keys) && config.defines.original) {
52
52
  const { keys, original } = config.defines;
@@ -40,7 +40,7 @@ function createExpectPoll(expect) {
40
40
  if (key === "assert") return assertionFunction;
41
41
  if (typeof key === "string" && unsupported.includes(key)) throw new SyntaxError(`expect.poll() is not supported in combination with .${key}(). Use vi.waitFor() if your assertion condition is unstable.`);
42
42
  return function(...args) {
43
- const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
43
+ const STACK_TRACE_ERROR = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
44
44
  const promise = () => new Promise((resolve, reject) => {
45
45
  let intervalId;
46
46
  let timeoutId;
@@ -76,7 +76,7 @@ function createExpectPoll(expect) {
76
76
  const negated = chai$1.util.flag(assertion, "negate") ? "not." : "";
77
77
  const name = chai$1.util.flag(assertion, "_poll.element") ? "element(locator)" : "poll(assertion)";
78
78
  const assertionString = `expect.${name}.${negated}${String(key)}()`;
79
- const error = new Error(`${assertionString} was not awaited. This assertion is asynchronous and must be awaited; otherwise, it is not executed to avoid unhandled rejections:\n\nawait ${assertionString}\n`);
79
+ const error = /* @__PURE__ */ new Error(`${assertionString} was not awaited. This assertion is asynchronous and must be awaited; otherwise, it is not executed to avoid unhandled rejections:\n\nawait ${assertionString}\n`);
80
80
  throw copyStackTrace$1(error, STACK_TRACE_ERROR);
81
81
  }
82
82
  });
@@ -313,7 +313,7 @@ const SnapshotPlugin = (chai, utils) => {
313
313
  utils.flag(this, "_name", "toMatchFileSnapshot");
314
314
  const isNot = utils.flag(this, "negate");
315
315
  if (isNot) throw new Error("toMatchFileSnapshot cannot be used with \"not\"");
316
- const error = new Error("resolves");
316
+ const error = /* @__PURE__ */ new Error("resolves");
317
317
  const expected = utils.flag(this, "object");
318
318
  const test = getTest("toMatchFileSnapshot", this);
319
319
  const errorMessage = utils.flag(this, "message");
@@ -441,7 +441,7 @@ function createExpect(test) {
441
441
  chai$1.assert.fail(`expected${message ? ` "${message}" ` : " "}not to be reached`);
442
442
  };
443
443
  function assertions(expected) {
444
- const errorGen = () => new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
444
+ const errorGen = () => /* @__PURE__ */ new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
445
445
  if (Error.captureStackTrace) Error.captureStackTrace(errorGen(), assertions);
446
446
  expect.setState({
447
447
  expectedAssertionsNumber: expected,
@@ -449,7 +449,7 @@ function createExpect(test) {
449
449
  });
450
450
  }
451
451
  function hasAssertions() {
452
- const error = new Error("expected any number of assertion, but got none");
452
+ const error = /* @__PURE__ */ new Error("expected any number of assertion, but got none");
453
453
  if (Error.captureStackTrace) Error.captureStackTrace(error, hasAssertions);
454
454
  expect.setState({
455
455
  isExpectingAssertions: true,
@@ -3707,7 +3707,7 @@ function copyStackTrace(target, source) {
3707
3707
  function waitFor(callback, options = {}) {
3708
3708
  const { setTimeout, setInterval, clearTimeout, clearInterval } = getSafeTimers();
3709
3709
  const { interval = 50, timeout = 1e3 } = typeof options === "number" ? { timeout: options } : options;
3710
- const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
3710
+ const STACK_TRACE_ERROR = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
3711
3711
  return new Promise((resolve, reject) => {
3712
3712
  let lastError;
3713
3713
  let promiseStatus = "idle";
@@ -3721,7 +3721,7 @@ function waitFor(callback, options = {}) {
3721
3721
  const handleTimeout = () => {
3722
3722
  if (intervalId) clearInterval(intervalId);
3723
3723
  let error = lastError;
3724
- if (!error) error = copyStackTrace(new Error("Timed out in waitFor!"), STACK_TRACE_ERROR);
3724
+ if (!error) error = copyStackTrace(/* @__PURE__ */ new Error("Timed out in waitFor!"), STACK_TRACE_ERROR);
3725
3725
  reject(error);
3726
3726
  };
3727
3727
  const checkCallback = () => {
@@ -3755,14 +3755,14 @@ function waitFor(callback, options = {}) {
3755
3755
  function waitUntil(callback, options = {}) {
3756
3756
  const { setTimeout, setInterval, clearTimeout, clearInterval } = getSafeTimers();
3757
3757
  const { interval = 50, timeout = 1e3 } = typeof options === "number" ? { timeout: options } : options;
3758
- const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
3758
+ const STACK_TRACE_ERROR = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
3759
3759
  return new Promise((resolve, reject) => {
3760
3760
  let promiseStatus = "idle";
3761
3761
  let timeoutId;
3762
3762
  let intervalId;
3763
3763
  const onReject = (error) => {
3764
3764
  if (intervalId) clearInterval(intervalId);
3765
- if (!error) error = copyStackTrace(new Error("Timed out in waitUntil!"), STACK_TRACE_ERROR);
3765
+ if (!error) error = copyStackTrace(/* @__PURE__ */ new Error("Timed out in waitUntil!"), STACK_TRACE_ERROR);
3766
3766
  reject(error);
3767
3767
  };
3768
3768
  const onResolve = (result) => {
@@ -3922,8 +3922,8 @@ function createVitest() {
3922
3922
  async importMock(path) {
3923
3923
  return _mocker().importMock(path, getImporter("importMock"));
3924
3924
  },
3925
- mockObject(value) {
3926
- return _mocker().mockObject({ value }).value;
3925
+ mockObject(value, options) {
3926
+ return _mocker().mockObject({ value }, void 0, options?.spy ? "autospy" : "automock").value;
3927
3927
  },
3928
3928
  mocked(item, _options = {}) {
3929
3929
  return item;
@@ -2,8 +2,8 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
2
2
  import vm, { isContext } from 'node:vm';
3
3
  import { dirname, basename, extname, normalize, join, resolve } from 'pathe';
4
4
  import { distDir } from '../path.js';
5
- import { createCustomConsole } from './console.CtFJOzRO.js';
6
- import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.B7h3T_Hc.js';
5
+ import { createCustomConsole } from './console.DoJHFxmj.js';
6
+ import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.Dt-pCVcL.js';
7
7
  import fs from 'node:fs';
8
8
  import { dirname as dirname$1 } from 'node:path';
9
9
  import { isPrimitive, isNodeBuiltin, toArray, getCachedData, setCacheData, isBareImport } from 'vite-node/utils';
@@ -84,6 +84,14 @@ class CommonjsExecutor {
84
84
  requiresCache.set(this, _require);
85
85
  return _require;
86
86
  }
87
+ static getSourceMapsSupport = () => ({
88
+ enabled: false,
89
+ nodeModules: false,
90
+ generatedCode: false
91
+ });
92
+ static setSourceMapsSupport = () => {
93
+ // noop
94
+ };
87
95
  static register = () => {
88
96
  throw new Error(`[vitest] "register" is not available when running in Vitest.`);
89
97
  };
@@ -645,7 +653,7 @@ class ExternalModulesExecutor {
645
653
  // create ERR_MODULE_NOT_FOUND on our own since latest NodeJS's import.meta.resolve doesn't throw on non-existing namespace or path
646
654
  // https://github.com/nodejs/node/pull/49038
647
655
  if ((type === "module" || type === "commonjs" || type === "wasm") && !existsSync(path)) {
648
- const error = new Error(`Cannot find ${isBareImport(path) ? "package" : "module"} '${path}'`);
656
+ const error = /* @__PURE__ */ new Error(`Cannot find ${isBareImport(path) ? "package" : "module"} '${path}'`);
649
657
  error.code = "ERR_MODULE_NOT_FOUND";
650
658
  throw error;
651
659
  }
@@ -1,5 +1,5 @@
1
1
  import { MessagePort } from 'node:worker_threads';
2
- import { C as ContextRPC } from './worker.d.DoNjFAiv.js';
2
+ import { C as ContextRPC } from './worker.d.xTcinSQw.js';
3
3
 
4
4
  interface WorkerContext extends ContextRPC {
5
5
  port: MessagePort;
@@ -1,6 +1,6 @@
1
1
  import { CancelReason, File, TestAnnotation, TaskResultPack, TaskEventPack, FileSpecification, Task } from '@vitest/runner';
2
- import { a as SerializedConfig } from './config.d.HJdfX-8k.js';
3
- import { T as TransformMode, U as UserConsoleLog, A as AfterSuiteRunMeta, E as Environment } from './environment.d.CUq4cUgQ.js';
2
+ import { a as SerializedConfig } from './config.d.DZo8c7fw.js';
3
+ import { T as TransformMode, U as UserConsoleLog, A as AfterSuiteRunMeta, E as Environment } from './environment.d.Bhm9oc0v.js';
4
4
  import { SnapshotResult } from '@vitest/snapshot';
5
5
 
6
6
  type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
@@ -96,21 +96,15 @@ type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
96
96
 
97
97
  interface RuntimeRPC {
98
98
  fetch: (id: string, transformMode: TransformMode) => Promise<{
99
- externalize?: string
100
- id?: string
99
+ externalize?: string;
100
+ id?: string;
101
101
  }>;
102
102
  transform: (id: string, transformMode: TransformMode) => Promise<{
103
- code?: string
103
+ code?: string;
104
104
  }>;
105
105
  resolveId: (id: string, importer: string | undefined, transformMode: TransformMode) => Promise<{
106
- external?: boolean | "absolute" | "relative"
107
- id: string
108
- /** @deprecated */
109
- meta?: Record<string, any> | null
110
- /** @deprecated */
111
- moduleSideEffects?: boolean | "no-treeshake" | null
112
- /** @deprecated */
113
- syntheticNamedExports?: boolean | string | null
106
+ external?: boolean | "absolute" | "relative";
107
+ id: string;
114
108
  } | null>;
115
109
  onUserConsoleLog: (log: UserConsoleLog) => void;
116
110
  onUnhandledError: (err: unknown, type: string) => void;
@@ -160,8 +154,8 @@ interface WorkerGlobalState {
160
154
  onCleanup: (listener: () => unknown) => void;
161
155
  providedContext: Record<string, any>;
162
156
  durations: {
163
- environment: number
164
- prepare: number
157
+ environment: number;
158
+ prepare: number;
165
159
  };
166
160
  onFilterStackTrace?: (trace: string) => string;
167
161
  }
package/dist/cli.js CHANGED
@@ -1,13 +1,13 @@
1
- import { c as createCLI } from './chunks/cac.D3EzDDZd.js';
1
+ import { c as createCLI } from './chunks/cac.C30xmylc.js';
2
2
  import '@vitest/utils';
3
3
  import 'events';
4
4
  import 'pathe';
5
5
  import 'tinyrainbow';
6
- import './chunks/constants.DnKduX2e.js';
7
- import './chunks/index.CZI_8rVt.js';
6
+ import './chunks/constants.CXzqaLmq.js';
7
+ import './chunks/index.Bz6b0Ib7.js';
8
8
  import 'node:fs';
9
9
  import 'node:fs/promises';
10
- import './chunks/typechecker.CVytUJuF.js';
10
+ import './chunks/typechecker.CMNPqJOo.js';
11
11
  import 'node:os';
12
12
  import 'node:perf_hooks';
13
13
  import '@vitest/utils/source-map';
package/dist/config.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { HookHandler, ConfigEnv, UserConfig } from 'vite';
2
2
  export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
3
- import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.DxZg19fy.js';
4
- export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.DxZg19fy.js';
5
- import { V as VitestPluginContext } from './chunks/plugin.d.C2EcJUjo.js';
6
- import { F as FakeTimerInstallOpts } from './chunks/config.d.HJdfX-8k.js';
3
+ import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.BBuiUFDc.js';
4
+ export { a as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.BBuiUFDc.js';
5
+ import { V as VitestPluginContext } from './chunks/plugin.d.CKCmge5g.js';
6
+ import { F as FakeTimerInstallOpts } from './chunks/config.d.DZo8c7fw.js';
7
7
  import '@vitest/runner';
8
- import './chunks/environment.d.CUq4cUgQ.js';
8
+ import './chunks/environment.d.Bhm9oc0v.js';
9
9
  import '@vitest/utils';
10
10
  import 'node:stream';
11
11
  import 'node:console';
12
- import './chunks/browser.d.q8Z0P0q1.js';
13
- import './chunks/worker.d.DoNjFAiv.js';
12
+ import './chunks/browser.d.BSPEQIuf.js';
13
+ import './chunks/worker.d.xTcinSQw.js';
14
14
  import '@vitest/snapshot';
15
15
  import '@vitest/mocker';
16
16
  import '@vitest/utils/source-map';
@@ -19,10 +19,10 @@ import '@vitest/utils/diff';
19
19
  import 'vite-node';
20
20
  import 'chai';
21
21
  import 'vitest/optional-types.js';
22
- import './chunks/benchmark.d.BwvBVTda.js';
22
+ import './chunks/benchmark.d.DAaHLpsq.js';
23
23
  import '@vitest/runner/utils';
24
24
  import 'tinybench';
25
- import './chunks/coverage.d.S9RMNXIe.js';
25
+ import './chunks/coverage.d.CNYjU4GF.js';
26
26
  import 'vite-node/client';
27
27
  import '@vitest/snapshot/manager';
28
28
  import 'node:fs';
@@ -50,43 +50,43 @@ declare const defaultExclude: string[];
50
50
  // These are the generic defaults for coverage. Providers may also set some provider specific defaults.
51
51
  declare const coverageConfigDefaults: ResolvedCoverageOptions;
52
52
  declare const configDefaults: Readonly<{
53
- allowOnly: boolean
54
- isolate: boolean
55
- watch: boolean
56
- globals: boolean
57
- environment: "node"
58
- pool: "forks"
59
- clearMocks: boolean
60
- restoreMocks: boolean
61
- mockReset: boolean
62
- unstubGlobals: boolean
63
- unstubEnvs: boolean
64
- include: string[]
65
- exclude: string[]
66
- teardownTimeout: number
67
- forceRerunTriggers: string[]
68
- update: boolean
69
- reporters: never[]
70
- silent: boolean
71
- hideSkippedTests: boolean
72
- api: boolean
73
- ui: boolean
74
- uiBase: string
75
- open: boolean
53
+ allowOnly: boolean;
54
+ isolate: boolean;
55
+ watch: boolean;
56
+ globals: boolean;
57
+ environment: "node";
58
+ pool: "forks";
59
+ clearMocks: boolean;
60
+ restoreMocks: boolean;
61
+ mockReset: boolean;
62
+ unstubGlobals: boolean;
63
+ unstubEnvs: boolean;
64
+ include: string[];
65
+ exclude: string[];
66
+ teardownTimeout: number;
67
+ forceRerunTriggers: string[];
68
+ update: boolean;
69
+ reporters: never[];
70
+ silent: boolean;
71
+ hideSkippedTests: boolean;
72
+ api: boolean;
73
+ ui: boolean;
74
+ uiBase: string;
75
+ open: boolean;
76
76
  css: {
77
- include: never[]
78
- }
79
- coverage: CoverageV8Options
80
- fakeTimers: FakeTimerInstallOpts
81
- maxConcurrency: number
82
- dangerouslyIgnoreUnhandledErrors: boolean
77
+ include: never[];
78
+ };
79
+ coverage: CoverageV8Options;
80
+ fakeTimers: FakeTimerInstallOpts;
81
+ maxConcurrency: number;
82
+ dangerouslyIgnoreUnhandledErrors: boolean;
83
83
  typecheck: {
84
- checker: "tsc"
85
- include: string[]
86
- exclude: string[]
87
- }
88
- slowTestThreshold: number
89
- disableConsoleIntercept: boolean
84
+ checker: "tsc";
85
+ include: string[];
86
+ exclude: string[];
87
+ };
88
+ slowTestThreshold: number;
89
+ disableConsoleIntercept: boolean;
90
90
  }>;
91
91
 
92
92
  type ViteUserConfigFnObject = (env: ConfigEnv) => UserConfig;
package/dist/config.js CHANGED
@@ -1,4 +1,4 @@
1
- export { d as defaultBrowserPort, e as extraInlineDeps } from './chunks/constants.DnKduX2e.js';
1
+ export { d as defaultBrowserPort, e as extraInlineDeps } from './chunks/constants.CXzqaLmq.js';
2
2
  export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.CXFFjsi8.js';
3
3
  export { mergeConfig } from 'vite';
4
4
  import 'node:os';
@@ -1,13 +1,13 @@
1
- import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, b as ReportContext } from './chunks/reporters.d.DxZg19fy.js';
1
+ import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, b as ReportContext } from './chunks/reporters.d.BBuiUFDc.js';
2
2
  import { TransformResult } from 'vite';
3
- import { A as AfterSuiteRunMeta } from './chunks/environment.d.CUq4cUgQ.js';
3
+ import { A as AfterSuiteRunMeta } from './chunks/environment.d.Bhm9oc0v.js';
4
4
  import '@vitest/runner';
5
5
  import '@vitest/utils';
6
6
  import 'node:stream';
7
7
  import 'node:console';
8
- import './chunks/browser.d.q8Z0P0q1.js';
9
- import './chunks/worker.d.DoNjFAiv.js';
10
- import './chunks/config.d.HJdfX-8k.js';
8
+ import './chunks/browser.d.BSPEQIuf.js';
9
+ import './chunks/worker.d.xTcinSQw.js';
10
+ import './chunks/config.d.DZo8c7fw.js';
11
11
  import '@vitest/pretty-format';
12
12
  import '@vitest/snapshot';
13
13
  import '@vitest/utils/diff';
@@ -16,10 +16,10 @@ import '@vitest/utils/source-map';
16
16
  import 'vite-node';
17
17
  import 'chai';
18
18
  import 'vitest/optional-types.js';
19
- import './chunks/benchmark.d.BwvBVTda.js';
19
+ import './chunks/benchmark.d.DAaHLpsq.js';
20
20
  import '@vitest/runner/utils';
21
21
  import 'tinybench';
22
- import './chunks/coverage.d.S9RMNXIe.js';
22
+ import './chunks/coverage.d.CNYjU4GF.js';
23
23
  import 'vite-node/client';
24
24
  import '@vitest/snapshot/manager';
25
25
  import 'node:fs';
@@ -47,7 +47,7 @@ interface ResolvedThreshold {
47
47
  * ```
48
48
  */
49
49
  type CoverageFiles = Map<NonNullable<AfterSuiteRunMeta["projectName"]> | symbol, Record<AfterSuiteRunMeta["transformMode"], {
50
- [TestFilenames: string]: string
50
+ [TestFilenames: string]: string;
51
51
  }>>;
52
52
  declare class BaseCoverageProvider<Options extends ResolvedCoverageOptions<"istanbul" | "v8">> {
53
53
  ctx: Vitest;
@@ -58,30 +58,32 @@ declare class BaseCoverageProvider<Options extends ResolvedCoverageOptions<"ista
58
58
  coverageFiles: CoverageFiles;
59
59
  pendingPromises: Promise<void>[];
60
60
  coverageFilesDirectory: string;
61
+ roots: string[];
61
62
  _initialize(ctx: Vitest): void;
62
63
  /**
63
64
  * Check if file matches `coverage.include` but not `coverage.exclude`
64
65
  */
65
- isIncluded(_filename: string): boolean;
66
+ isIncluded(_filename: string, root?: string): boolean;
67
+ private getUntestedFilesByRoot;
66
68
  getUntestedFiles(testedFiles: string[]): Promise<string[]>;
67
69
  createCoverageMap(): CoverageMap;
68
70
  generateReports(_: CoverageMap, __: boolean | undefined): Promise<void>;
69
71
  parseConfigModule(_: string): Promise<{
70
72
  generate: () => {
71
- code: string
72
- }
73
+ code: string;
74
+ };
73
75
  }>;
74
76
  resolveOptions(): Options;
75
77
  clean(clean?: boolean): Promise<void>;
76
78
  onAfterSuiteRun({ coverage, transformMode, projectName, testFiles }: AfterSuiteRunMeta): void;
77
79
  readCoverageFiles<CoverageType>({ onFileRead, onFinished, onDebug }: {
78
80
  /** Callback invoked with a single coverage result */
79
- onFileRead: (data: CoverageType) => void
81
+ onFileRead: (data: CoverageType) => void;
80
82
  /** Callback invoked once all results of a project for specific transform mode are read */
81
- onFinished: (project: Vitest["projects"][number], transformMode: AfterSuiteRunMeta["transformMode"]) => Promise<void>
83
+ onFinished: (project: Vitest["projects"][number], transformMode: AfterSuiteRunMeta["transformMode"]) => Promise<void>;
82
84
  onDebug: ((...logs: any[]) => void) & {
83
- enabled: boolean
84
- }
85
+ enabled: boolean;
86
+ };
85
87
  }): Promise<void>;
86
88
  cleanAfterRun(): Promise<void>;
87
89
  onTestFailure(): Promise<void>;
@@ -101,9 +103,9 @@ declare class BaseCoverageProvider<Options extends ResolvedCoverageOptions<"ista
101
103
  * Check if current coverage is above configured thresholds and bump the thresholds if needed
102
104
  */
103
105
  updateThresholds({ thresholds: allThresholds, onUpdate, configurationFile }: {
104
- thresholds: ResolvedThreshold[]
105
- configurationFile: unknown
106
- onUpdate: () => void
106
+ thresholds: ResolvedThreshold[];
107
+ configurationFile: unknown;
108
+ onUpdate: () => void;
107
109
  }): Promise<void>;
108
110
  mergeReports(coverageMaps: unknown[]): Promise<void>;
109
111
  hasTerminalReporter(reporters: ResolvedCoverageOptions["reporter"]): boolean;
package/dist/coverage.js CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BaseCoverageProvider } from './chunks/coverage.Cwa-XhJt.js';
1
+ export { B as BaseCoverageProvider } from './chunks/coverage.OOpN1tMC.js';
2
2
  import 'node:fs';
3
3
  import 'node:path';
4
4
  import 'pathe';
@@ -20,12 +20,12 @@ import 'node:assert';
20
20
  import 'node:v8';
21
21
  import 'node:util';
22
22
  import 'vite';
23
- import './chunks/constants.DnKduX2e.js';
23
+ import './chunks/constants.CXzqaLmq.js';
24
24
  import 'node:tty';
25
25
  import 'node:events';
26
26
  import './chunks/index.B521nVV-.js';
27
27
  import 'tinypool';
28
- import './chunks/typechecker.CVytUJuF.js';
28
+ import './chunks/typechecker.CMNPqJOo.js';
29
29
  import 'node:perf_hooks';
30
30
  import '@vitest/utils/source-map';
31
31
  import 'tinyexec';
@@ -1,11 +1,11 @@
1
- import { E as Environment } from './chunks/environment.d.CUq4cUgQ.js';
2
- export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d.CUq4cUgQ.js';
1
+ import { E as Environment } from './chunks/environment.d.Bhm9oc0v.js';
2
+ export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d.Bhm9oc0v.js';
3
3
 
4
4
  declare const environments: {
5
- "node": Environment
6
- "jsdom": Environment
7
- "happy-dom": Environment
8
- "edge-runtime": Environment
5
+ "node": Environment;
6
+ "jsdom": Environment;
7
+ "happy-dom": Environment;
8
+ "edge-runtime": Environment;
9
9
  };
10
10
 
11
11
  interface PopulateOptions {
@@ -17,9 +17,9 @@ interface PopulateOptions {
17
17
  additionalKeys?: string[];
18
18
  }
19
19
  declare function populateGlobal(global: any, win: any, options?: PopulateOptions): {
20
- keys: Set<string>
21
- skipKeys: string[]
22
- originals: Map<string | symbol, any>
20
+ keys: Set<string>;
21
+ skipKeys: string[];
22
+ originals: Map<string | symbol, any>;
23
23
  };
24
24
 
25
25
  export { Environment, environments as builtinEnvironments, populateGlobal };
package/dist/execute.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { ViteNodeRunnerOptions } from 'vite-node';
2
2
  import { ViteNodeRunner, ModuleExecutionInfo } from 'vite-node/client';
3
- import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.d.DoNjFAiv.js';
3
+ import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.d.xTcinSQw.js';
4
4
  import vm from 'node:vm';
5
5
  import { MockedModule, MockedModuleType } from '@vitest/mocker';
6
6
  import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './chunks/mocker.d.BE_2ls6u.js';
7
7
  import '@vitest/runner';
8
- import './chunks/config.d.HJdfX-8k.js';
8
+ import './chunks/config.d.DZo8c7fw.js';
9
9
  import '@vitest/pretty-format';
10
10
  import '@vitest/snapshot';
11
11
  import '@vitest/utils/diff';
12
- import './chunks/environment.d.CUq4cUgQ.js';
12
+ import './chunks/environment.d.Bhm9oc0v.js';
13
13
 
14
14
  declare class FileMap {
15
15
  private fsCache;
@@ -26,7 +26,7 @@ interface ModuleEvaluateOptions {
26
26
  breakOnSigint?: vm.RunningScriptOptions["breakOnSigint"] | undefined;
27
27
  }
28
28
  type ModuleLinker = (specifier: string, referencingModule: VMModule, extra: {
29
- assert: object
29
+ assert: object;
30
30
  }) => VMModule | Promise<VMModule>;
31
31
  type ModuleStatus = "unlinked" | "linking" | "linked" | "evaluating" | "evaluated" | "errored";
32
32
  declare class VMModule {
@@ -130,9 +130,9 @@ declare class VitestExecutor extends ViteNodeRunner {
130
130
  private primitives;
131
131
  constructor(options: ExecuteOptions);
132
132
  protected getContextPrimitives(): {
133
- Object: typeof Object
134
- Reflect: typeof Reflect
135
- Symbol: typeof Symbol
133
+ Object: typeof Object;
134
+ Reflect: typeof Reflect;
135
+ Symbol: typeof Symbol;
136
136
  };
137
137
  get state(): WorkerGlobalState;
138
138
  get moduleExecutionInfo(): ModuleExecutionInfo | undefined;
package/dist/execute.js CHANGED
@@ -1,4 +1,4 @@
1
- export { V as VitestExecutor } from './chunks/execute.B7h3T_Hc.js';
1
+ export { V as VitestExecutor } from './chunks/execute.Dt-pCVcL.js';
2
2
  import 'node:fs';
3
3
  import 'node:url';
4
4
  import 'node:vm';