vitest 3.0.8 → 3.0.9

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 (60) hide show
  1. package/dist/browser.d.ts +12 -23
  2. package/dist/browser.js +2 -2
  3. package/dist/chunks/{base.XvKTsMeK.js → base.DV59CbtV.js} +1 -1
  4. package/dist/chunks/{benchmark.Cdu9hjj4.js → benchmark.DL72EVN-.js} +1 -1
  5. package/dist/chunks/{benchmark.CFFwLv-O.d.ts → benchmark.d.BwvBVTda.d.ts} +11 -11
  6. package/dist/chunks/{cac.VN5q-TPC.js → cac.CeVHgzve.js} +5 -5
  7. package/dist/chunks/{cli-api.Dis64jtY.js → cli-api.Ckwz_xSb.js} +13 -8
  8. package/dist/chunks/config.d.DevWltVl.d.ts +218 -0
  9. package/dist/chunks/{constants.fzPh7AOq.js → constants.DTYd6dNH.js} +1 -1
  10. package/dist/chunks/{coverage.DnNIv-kJ.js → coverage.A3sS5-Wm.js} +1 -29
  11. package/dist/chunks/coverage.d.S9RMNXIe.d.ts +35 -0
  12. package/dist/chunks/{resolveConfig.L1_HR0_0.js → coverage.gV8doR2Y.js} +496 -127
  13. package/dist/chunks/{creator.2CFRE1Yx.js → creator.BsBnpTzI.js} +1 -1
  14. package/dist/chunks/defaults.C2Ndd9wx.js +119 -0
  15. package/dist/chunks/env.D4Lgay0q.js +8 -0
  16. package/dist/chunks/environment.d.C8UItCbf.d.ts +170 -0
  17. package/dist/chunks/global.d.Cg2sEPIm.d.ts +127 -0
  18. package/dist/chunks/{globals.CydvVTgC.js → globals.BEpDe-k3.js} +4 -4
  19. package/dist/chunks/{index.B7vJpkTD.js → index.B8tIoLPT.js} +6 -1
  20. package/dist/chunks/{index.CNRemkXW.js → index.D7Ny8f_s.js} +2 -2
  21. package/dist/chunks/{index.BmFgJtkv.js → index.uXkkC4xl.js} +1 -2
  22. package/dist/chunks/{mocker.cRtM890J.d.ts → mocker.d.BE_2ls6u.d.ts} +6 -6
  23. package/dist/chunks/reporters.d.CqBhtcTq.d.ts +3006 -0
  24. package/dist/chunks/{runBaseTests.DnaAUBKD.js → runBaseTests.BVrL_ow3.js} +8 -8
  25. package/dist/chunks/{setup-common.Uaw6Zgv9.js → setup-common.CPvtqi8q.js} +25 -2
  26. package/dist/chunks/{suite.qtkXWc6R.d.ts → suite.d.FvehnV49.d.ts} +1 -1
  27. package/dist/chunks/{typechecker.cZ0LjdSi.js → typechecker.BlF3eHsb.js} +2 -7
  28. package/dist/chunks/{vi.B5EKKJdE.js → vi.nSCvwQ7l.js} +3 -3
  29. package/dist/chunks/vite.d.BUZTGxQ3.d.ts +11 -0
  30. package/dist/chunks/{worker.BmVno_ab.d.ts → worker.d.C58isfFm.d.ts} +62 -62
  31. package/dist/chunks/{worker.BT4v-DKx.d.ts → worker.d.CSFlSYJg.d.ts} +2 -2
  32. package/dist/cli.js +2 -2
  33. package/dist/config.d.ts +48 -45
  34. package/dist/config.js +6 -123
  35. package/dist/coverage.d.ts +82 -79
  36. package/dist/coverage.js +19 -469
  37. package/dist/environments.d.ts +11 -11
  38. package/dist/execute.d.ts +109 -109
  39. package/dist/index.d.ts +414 -412
  40. package/dist/index.js +3 -3
  41. package/dist/node.d.ts +51 -48
  42. package/dist/node.js +13 -10
  43. package/dist/reporters.d.ts +7 -4
  44. package/dist/reporters.js +3 -2
  45. package/dist/runners.d.ts +28 -28
  46. package/dist/runners.js +2 -3
  47. package/dist/snapshot.d.ts +2 -2
  48. package/dist/suite.d.ts +2 -2
  49. package/dist/suite.js +1 -1
  50. package/dist/workers/forks.js +1 -1
  51. package/dist/workers/runVmTests.js +8 -8
  52. package/dist/workers/threads.js +1 -1
  53. package/dist/workers.d.ts +13 -13
  54. package/dist/workers.js +1 -1
  55. package/package.json +11 -11
  56. package/dist/chunks/config.BCv-fVdT.d.ts +0 -215
  57. package/dist/chunks/environment.d8YfPkTm.d.ts +0 -173
  58. package/dist/chunks/global.CnI8_G5V.d.ts +0 -133
  59. package/dist/chunks/reporters.66aFHiyX.d.ts +0 -3051
  60. package/dist/chunks/vite.BCQa3xFG.d.ts +0 -11
package/dist/browser.d.ts CHANGED
@@ -1,42 +1,31 @@
1
- import { b as CoverageModuleLoader, c as CoverageProvider } from './chunks/reporters.66aFHiyX.js';
2
- import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.BCv-fVdT.js';
1
+ import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.d.DevWltVl.js';
2
+ import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.S9RMNXIe.js';
3
3
  import { SerializedDiffOptions } from '@vitest/utils/diff';
4
4
  import { VitestExecutor } from './execute.js';
5
5
  export { collectTests, processError, startTests } from '@vitest/runner';
6
6
  import * as spy from '@vitest/spy';
7
7
  export { spy as SpyModule };
8
- import './chunks/environment.d8YfPkTm.js';
9
- import '@vitest/utils';
10
- import 'node:stream';
11
- import 'vite';
12
- import '@vitest/utils/source-map';
13
8
  import '@vitest/pretty-format';
14
9
  import '@vitest/snapshot';
15
- import 'vite-node';
16
- import 'chai';
17
- import './chunks/benchmark.CFFwLv-O.js';
18
- import '@vitest/runner/utils';
19
- import 'tinybench';
20
- import '@vitest/snapshot/manager';
21
- import 'node:fs';
22
10
  import '@vitest/snapshot/environment';
23
11
  import 'vite-node/client';
24
- import './chunks/worker.BmVno_ab.js';
12
+ import 'vite-node';
13
+ import './chunks/worker.d.C58isfFm.js';
14
+ import './chunks/environment.d.C8UItCbf.js';
25
15
  import 'node:vm';
26
16
  import '@vitest/mocker';
27
- import './chunks/mocker.cRtM890J.js';
17
+ import './chunks/mocker.d.BE_2ls6u.js';
28
18
 
29
- declare function getCoverageProvider(options: SerializedCoverageConfig | undefined, loader: CoverageModuleLoader): Promise<CoverageProvider | null>;
30
- declare function startCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: CoverageModuleLoader, runtimeOptions: {
31
- isolate: boolean;
19
+ declare function startCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: RuntimeCoverageModuleLoader, runtimeOptions: {
20
+ isolate: boolean
32
21
  }): Promise<unknown>;
33
- declare function takeCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: CoverageModuleLoader): Promise<unknown>;
34
- declare function stopCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: CoverageModuleLoader, runtimeOptions: {
35
- isolate: boolean;
22
+ declare function takeCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: RuntimeCoverageModuleLoader): Promise<unknown>;
23
+ declare function stopCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: RuntimeCoverageModuleLoader, runtimeOptions: {
24
+ isolate: boolean
36
25
  }): Promise<unknown>;
37
26
 
38
27
  declare function setupCommonEnv(config: SerializedConfig): Promise<void>;
39
28
  declare function loadDiffConfig(config: SerializedConfig, executor: VitestExecutor): Promise<SerializedDiffOptions | undefined>;
40
29
  declare function loadSnapshotSerializers(config: SerializedConfig, executor: VitestExecutor): Promise<void>;
41
30
 
42
- export { getCoverageProvider, loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
31
+ export { loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
package/dist/browser.js CHANGED
@@ -1,8 +1,8 @@
1
- export { g as getCoverageProvider, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.DnNIv-kJ.js';
2
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.Uaw6Zgv9.js';
1
+ export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.CPvtqi8q.js';
3
2
  export { collectTests, processError, startTests } from '@vitest/runner';
4
3
  import * as spy from '@vitest/spy';
5
4
  export { spy as SpyModule };
5
+ import './chunks/coverage.A3sS5-Wm.js';
6
6
  import '@vitest/snapshot';
7
7
  import '@vitest/utils';
8
8
  import './chunks/run-once.2ogXb3JV.js';
@@ -28,7 +28,7 @@ async function runBaseTests(method, state) {
28
28
  ));
29
29
  const [executor, { run }] = await Promise.all([
30
30
  startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
31
- import('./runBaseTests.DnaAUBKD.js')
31
+ import('./runBaseTests.BVrL_ow3.js')
32
32
  ]);
33
33
  const fileSpecs = ctx.files.map(
34
34
  (f) => typeof f === "string" ? { filepath: f, testLocations: void 0 } : f
@@ -34,7 +34,7 @@ function createBenchmark(fn) {
34
34
  return benchmark;
35
35
  }
36
36
  function formatName(name) {
37
- return typeof name === "string" ? name : name instanceof Function ? name.name || "<anonymous>" : String(name);
37
+ return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
38
38
  }
39
39
 
40
40
  export { getBenchOptions as a, bench as b, getBenchFn as g };
@@ -3,22 +3,22 @@ import { ChainableFunction } from '@vitest/runner/utils';
3
3
  import { TaskResult, Bench, Options } from 'tinybench';
4
4
 
5
5
  interface Benchmark extends Test {
6
- meta: {
7
- benchmark: true;
8
- result?: TaskResult;
9
- };
6
+ meta: {
7
+ benchmark: true
8
+ result?: TaskResult
9
+ };
10
10
  }
11
11
  interface BenchmarkResult extends TaskResult {
12
- name: string;
13
- rank: number;
14
- sampleCount: number;
15
- median: number;
12
+ name: string;
13
+ rank: number;
14
+ sampleCount: number;
15
+ median: number;
16
16
  }
17
17
  type BenchFunction = (this: Bench) => Promise<void> | void;
18
- type ChainableBenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', (name: string | Function, fn?: BenchFunction, options?: Options) => void>;
18
+ type ChainableBenchmarkAPI = ChainableFunction<"skip" | "only" | "todo", (name: string | Function, fn?: BenchFunction, options?: Options) => void>;
19
19
  type BenchmarkAPI = ChainableBenchmarkAPI & {
20
- skipIf: (condition: any) => ChainableBenchmarkAPI;
21
- runIf: (condition: any) => ChainableBenchmarkAPI;
20
+ skipIf: (condition: any) => ChainableBenchmarkAPI
21
+ runIf: (condition: any) => ChainableBenchmarkAPI
22
22
  };
23
23
 
24
24
  export type { BenchmarkResult as B, BenchFunction as a, Benchmark as b, BenchmarkAPI as c };
@@ -2,7 +2,7 @@ import { toArray } from '@vitest/utils';
2
2
  import { EventEmitter } from 'events';
3
3
  import { normalize } from 'pathe';
4
4
  import c from 'tinyrainbow';
5
- import { d as defaultPort, a as defaultBrowserPort } from './constants.fzPh7AOq.js';
5
+ import { a as defaultPort, d as defaultBrowserPort } from './constants.DTYd6dNH.js';
6
6
 
7
7
  function toArr(any) {
8
8
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
618
618
 
619
619
  const cac = (name = "") => new CAC(name);
620
620
 
621
- var version = "3.0.8";
621
+ var version = "3.0.9";
622
622
 
623
623
  const apiConfig = (port) => ({
624
624
  port: {
@@ -1591,7 +1591,7 @@ async function start(mode, cliFilters, options) {
1591
1591
  } catch {
1592
1592
  }
1593
1593
  try {
1594
- const { startVitest } = await import('./cli-api.Dis64jtY.js').then(function (n) { return n.f; });
1594
+ const { startVitest } = await import('./cli-api.Ckwz_xSb.js').then(function (n) { return n.f; });
1595
1595
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
1596
1596
  if (!ctx.shouldKeepServer()) {
1597
1597
  await ctx.exit();
@@ -1613,7 +1613,7 @@ async function init(project) {
1613
1613
  console.error(new Error('Only the "browser" project is supported. Use "vitest init browser" to create a new project.'));
1614
1614
  process.exit(1);
1615
1615
  }
1616
- const { create } = await import('./creator.2CFRE1Yx.js');
1616
+ const { create } = await import('./creator.BsBnpTzI.js');
1617
1617
  await create();
1618
1618
  }
1619
1619
  async function collect(mode, cliFilters, options) {
@@ -1622,7 +1622,7 @@ async function collect(mode, cliFilters, options) {
1622
1622
  } catch {
1623
1623
  }
1624
1624
  try {
1625
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.Dis64jtY.js').then(function (n) { return n.f; });
1625
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.Ckwz_xSb.js').then(function (n) { return n.f; });
1626
1626
  const ctx = await prepareVitest(mode, {
1627
1627
  ...normalizeCliOptions(cliFilters, options),
1628
1628
  watch: false,
@@ -1,19 +1,19 @@
1
1
  import { promises, existsSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
2
2
  import { relative, extname, normalize, dirname, resolve, join, basename, isAbsolute } from 'pathe';
3
- import { g as getCoverageProvider, C as CoverageProviderMap } from './coverage.DnNIv-kJ.js';
3
+ import { C as CoverageProviderMap } from './coverage.A3sS5-Wm.js';
4
4
  import p, { resolve as resolve$1 } from 'node:path';
5
5
  import { noop, isPrimitive, createDefer, highlight, toArray, deepMerge, nanoid, slash, deepClone, notNullish } from '@vitest/utils';
6
6
  import { f as findUp, p as prompt } from './index.DBIGubLC.js';
7
7
  import * as vite from 'vite';
8
8
  import { searchForWorkspaceRoot, version, createServer, mergeConfig } from 'vite';
9
- import { A as API_PATH, c as configFiles, a as defaultBrowserPort, w as workspacesFiles, d as defaultPort } from './constants.fzPh7AOq.js';
9
+ import { A as API_PATH, c as configFiles, d as defaultBrowserPort, w as workspacesFiles, a as defaultPort } from './constants.DTYd6dNH.js';
10
10
  import { generateFileHash, createFileTask, limitConcurrency, hasFailed, getTasks, getTests } from '@vitest/runner/utils';
11
11
  import { SnapshotManager } from '@vitest/snapshot/manager';
12
12
  import { ViteNodeRunner } from 'vite-node/client';
13
13
  import { ViteNodeServer } from 'vite-node/server';
14
- import { v as version$1 } from './cac.VN5q-TPC.js';
14
+ import { v as version$1 } from './cac.CeVHgzve.js';
15
15
  import { c as createBirpc } from './index.68735LiX.js';
16
- import { p as parse, s as stringify, g as printError, h as generateCodeFrame, b as BenchmarkReportsMap, R as ReportersMap, i as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.B7vJpkTD.js';
16
+ import { p as parse, s as stringify, g as printError, h as generateCodeFrame, b as BenchmarkReportsMap, R as ReportersMap, i as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.B8tIoLPT.js';
17
17
  import require$$0$3 from 'events';
18
18
  import require$$1$1 from 'https';
19
19
  import require$$2 from 'http';
@@ -28,19 +28,21 @@ import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
28
28
  import { parseErrorStacktrace } from '@vitest/utils/source-map';
29
29
  import crypto from 'node:crypto';
30
30
  import { distDir, rootDir } from '../path.js';
31
- import { R as RandomSequencer, i as isPackageExists, h as hash, V as VitestCache, e as configDefaults, g as getFilePoolName, f as isBrowserEnabled, m as mm, a as resolveConfig, j as groupBy, w as wildcardPatternToRegExp, k as createPool, b as resolveApiServerConfig, s as stdout } from './resolveConfig.L1_HR0_0.js';
32
- import { i as isTTY, b as isWindows, c as convertTasksToEvents } from './typechecker.cZ0LjdSi.js';
31
+ import { R as RandomSequencer, i as isPackageExists, h as hash, V as VitestCache, g as getFilePoolName, d as isBrowserEnabled, m as mm, r as resolveConfig, e as groupBy, w as wildcardPatternToRegExp, f as getCoverageProvider, j as createPool, a as resolveApiServerConfig, s as stdout } from './coverage.gV8doR2Y.js';
32
+ import { c as convertTasksToEvents } from './typechecker.BlF3eHsb.js';
33
33
  import { Console } from 'node:console';
34
34
  import c from 'tinyrainbow';
35
35
  import { a as formatProjectName, w as withLabel, d as divider } from './utils.bLM2atbD.js';
36
36
  import { createRequire } from 'node:module';
37
37
  import url from 'node:url';
38
+ import { i as isTTY, a as isWindows } from './env.D4Lgay0q.js';
38
39
  import { rm } from 'node:fs/promises';
39
40
  import nodeos__default, { tmpdir } from 'node:os';
40
41
  import require$$0$4, { posix } from 'path';
41
42
  import require$$0$5 from 'fs';
42
43
  import { normalizeRequestId, cleanUrl } from 'vite-node/utils';
43
44
  import { hoistMocksPlugin, automockPlugin } from '@vitest/mocker/node';
45
+ import { c as configDefaults } from './defaults.C2Ndd9wx.js';
44
46
  import MagicString from 'magic-string';
45
47
  import assert$1 from 'node:assert';
46
48
  import { serializeError } from '@vitest/utils/error';
@@ -9067,7 +9069,10 @@ function serializeConfig(config, coreConfig, viteConfig) {
9067
9069
  screenshotFailures: browser.screenshotFailures,
9068
9070
  locators: {
9069
9071
  testIdAttribute: browser.locators.testIdAttribute
9070
- }
9072
+ },
9073
+ providerOptions: browser.provider === "playwright" ? {
9074
+ actionTimeout: browser.providerOptions?.context?.actionTimeout
9075
+ } : {}
9071
9076
  };
9072
9077
  })(config.browser),
9073
9078
  standalone: config.standalone,
@@ -12107,7 +12112,7 @@ async function resolveBrowserWorkspace(vitest, names, resolvedProjects) {
12107
12112
  }
12108
12113
  if (project.config.browser.providerOptions) {
12109
12114
  vitest.logger.warn(
12110
- withLabel("yellow", "Vitest", `"providerOptions"${originalName ? ` in "${originalName}" project` : ""} is ignored because it's overriden by the configs. To hide this warning, remove the "providerOptions" property from the browser configuration.`)
12115
+ withLabel("yellow", "Vitest", `"providerOptions"${originalName ? ` in "${originalName}" project` : ""} is ignored because it's overridden by the configs. To hide this warning, remove the "providerOptions" property from the browser configuration.`)
12111
12116
  );
12112
12117
  }
12113
12118
  filteredInstances.forEach((config, index) => {
@@ -0,0 +1,218 @@
1
+ import { PrettyFormatOptions } from '@vitest/pretty-format';
2
+ import { SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
3
+ import { SnapshotUpdateState } from '@vitest/snapshot';
4
+ import { SnapshotEnvironment } from '@vitest/snapshot/environment';
5
+ import { SerializedDiffOptions } from '@vitest/utils/diff';
6
+
7
+ /**
8
+ * Names of clock methods that may be faked by install.
9
+ */
10
+ type FakeMethod =
11
+ | "setTimeout"
12
+ | "clearTimeout"
13
+ | "setImmediate"
14
+ | "clearImmediate"
15
+ | "setInterval"
16
+ | "clearInterval"
17
+ | "Date"
18
+ | "nextTick"
19
+ | "hrtime"
20
+ | "requestAnimationFrame"
21
+ | "cancelAnimationFrame"
22
+ | "requestIdleCallback"
23
+ | "cancelIdleCallback"
24
+ | "performance"
25
+ | "queueMicrotask";
26
+
27
+ interface FakeTimerInstallOpts {
28
+ /**
29
+ * Installs fake timers with the specified unix epoch (default: 0)
30
+ */
31
+ now?: number | Date | undefined;
32
+
33
+ /**
34
+ * An array with names of global methods and APIs to fake.
35
+ * For instance, `vi.useFakeTimer({ toFake: ['setTimeout', 'performance'] })` will fake only `setTimeout()` and `performance.now()`
36
+ * @default everything available globally except `nextTick`
37
+ */
38
+ toFake?: FakeMethod[] | undefined;
39
+
40
+ /**
41
+ * The maximum number of timers that will be run when calling runAll()
42
+ * @default 10000
43
+ */
44
+ loopLimit?: number | undefined;
45
+
46
+ /**
47
+ * Tells @sinonjs/fake-timers to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by
48
+ * 20ms for every 20ms change in the real system time) (default: false)
49
+ */
50
+ shouldAdvanceTime?: boolean | undefined;
51
+
52
+ /**
53
+ * Relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change
54
+ * in the real system time (default: 20)
55
+ */
56
+ advanceTimeDelta?: number | undefined;
57
+
58
+ /**
59
+ * Tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers.
60
+ * @default true
61
+ */
62
+ shouldClearNativeTimers?: boolean | undefined;
63
+
64
+ /**
65
+ * Don't throw error when asked to fake timers that are not present.
66
+ * @default false
67
+ */
68
+ ignoreMissingTimers?: boolean | undefined;
69
+ }
70
+
71
+ /**
72
+ * Config that tests have access to.
73
+ */
74
+ interface SerializedConfig {
75
+ name: string | undefined;
76
+ globals: boolean;
77
+ base: string | undefined;
78
+ snapshotEnvironment?: string;
79
+ disableConsoleIntercept: boolean | undefined;
80
+ runner: string | undefined;
81
+ isolate: boolean;
82
+ mode: "test" | "benchmark";
83
+ bail: number | undefined;
84
+ environmentOptions?: Record<string, any>;
85
+ root: string;
86
+ setupFiles: string[];
87
+ passWithNoTests: boolean;
88
+ testNamePattern: RegExp | undefined;
89
+ allowOnly: boolean;
90
+ testTimeout: number;
91
+ hookTimeout: number;
92
+ clearMocks: boolean;
93
+ mockReset: boolean;
94
+ restoreMocks: boolean;
95
+ unstubGlobals: boolean;
96
+ unstubEnvs: boolean;
97
+ fakeTimers: FakeTimerInstallOpts;
98
+ maxConcurrency: number;
99
+ defines: Record<string, any>;
100
+ expect: {
101
+ requireAssertions?: boolean
102
+ poll?: {
103
+ timeout?: number
104
+ interval?: number
105
+ }
106
+ };
107
+ printConsoleTrace: boolean | undefined;
108
+ sequence: {
109
+ shuffle?: boolean
110
+ concurrent?: boolean
111
+ seed: number
112
+ hooks: SequenceHooks
113
+ setupFiles: SequenceSetupFiles
114
+ };
115
+ poolOptions: {
116
+ forks: {
117
+ singleFork: boolean
118
+ isolate: boolean
119
+ }
120
+ threads: {
121
+ singleThread: boolean
122
+ isolate: boolean
123
+ }
124
+ vmThreads: {
125
+ singleThread: boolean
126
+ }
127
+ vmForks: {
128
+ singleFork: boolean
129
+ }
130
+ };
131
+ deps: {
132
+ web: {
133
+ transformAssets?: boolean
134
+ transformCss?: boolean
135
+ transformGlobPattern?: RegExp | RegExp[]
136
+ }
137
+ optimizer: {
138
+ web: {
139
+ enabled: boolean
140
+ }
141
+ ssr: {
142
+ enabled: boolean
143
+ }
144
+ }
145
+ interopDefault: boolean | undefined
146
+ moduleDirectories: string[] | undefined
147
+ };
148
+ snapshotOptions: {
149
+ updateSnapshot: SnapshotUpdateState
150
+ expand: boolean | undefined
151
+ snapshotFormat: PrettyFormatOptions | undefined
152
+ /**
153
+ * only exists for tests, not available in the main process
154
+ */
155
+ snapshotEnvironment: SnapshotEnvironment
156
+ };
157
+ pool: string;
158
+ snapshotSerializers: string[];
159
+ chaiConfig: {
160
+ includeStack?: boolean
161
+ showDiff?: boolean
162
+ truncateThreshold?: number
163
+ } | undefined;
164
+ diff: string | SerializedDiffOptions | undefined;
165
+ retry: number;
166
+ includeTaskLocation: boolean | undefined;
167
+ inspect: boolean | string | undefined;
168
+ inspectBrk: boolean | string | undefined;
169
+ inspector: {
170
+ enabled?: boolean
171
+ port?: number
172
+ host?: string
173
+ waitForDebugger?: boolean
174
+ };
175
+ watch: boolean;
176
+ env: Record<string, any>;
177
+ browser: {
178
+ name: string
179
+ headless: boolean
180
+ isolate: boolean
181
+ fileParallelism: boolean
182
+ ui: boolean
183
+ viewport: {
184
+ width: number
185
+ height: number
186
+ }
187
+ locators: {
188
+ testIdAttribute: string
189
+ }
190
+ screenshotFailures: boolean
191
+ providerOptions: {
192
+ actionTimeout?: number
193
+ }
194
+ };
195
+ standalone: boolean;
196
+ logHeapUsage: boolean | undefined;
197
+ coverage: SerializedCoverageConfig;
198
+ benchmark?: {
199
+ includeSamples: boolean
200
+ };
201
+ }
202
+ interface SerializedCoverageConfig {
203
+ provider: "istanbul" | "v8" | "custom" | undefined;
204
+ reportsDirectory: string;
205
+ htmlReporter: {
206
+ subdir: string | undefined
207
+ } | undefined;
208
+ enabled: boolean;
209
+ customProviderModule: string | undefined;
210
+ }
211
+ type RuntimeConfig = Pick<SerializedConfig, "allowOnly" | "testTimeout" | "hookTimeout" | "clearMocks" | "mockReset" | "restoreMocks" | "fakeTimers" | "maxConcurrency" | "expect" | "printConsoleTrace"> & {
212
+ sequence?: {
213
+ hooks?: SequenceHooks
214
+ }
215
+ };
216
+ type RuntimeOptions = Partial<RuntimeConfig>;
217
+
218
+ export type { FakeTimerInstallOpts as F, RuntimeOptions as R, SerializedCoverageConfig as S, SerializedConfig as a, RuntimeConfig as b };
@@ -43,4 +43,4 @@ const globalApis = [
43
43
  "onTestFailed"
44
44
  ];
45
45
 
46
- export { API_PATH as A, defaultBrowserPort as a, defaultInspectPort as b, configFiles as c, defaultPort as d, extraInlineDeps as e, globalApis as g, workspacesFiles as w };
46
+ export { API_PATH as A, defaultPort as a, defaultInspectPort as b, configFiles as c, defaultBrowserPort as d, extraInlineDeps as e, globalApis as g, workspacesFiles as w };
@@ -36,33 +36,5 @@ async function resolveCoverageProviderModule(options, loader) {
36
36
  }
37
37
  return customProviderModule.default;
38
38
  }
39
- async function getCoverageProvider(options, loader) {
40
- const coverageModule = await resolveCoverageProviderModule(options, loader);
41
- if (coverageModule) {
42
- return coverageModule.getProvider();
43
- }
44
- return null;
45
- }
46
- async function startCoverageInsideWorker(options, loader, runtimeOptions) {
47
- const coverageModule = await resolveCoverageProviderModule(options, loader);
48
- if (coverageModule) {
49
- return coverageModule.startCoverage?.(runtimeOptions);
50
- }
51
- return null;
52
- }
53
- async function takeCoverageInsideWorker(options, loader) {
54
- const coverageModule = await resolveCoverageProviderModule(options, loader);
55
- if (coverageModule) {
56
- return coverageModule.takeCoverage?.({ moduleExecutionInfo: loader.moduleExecutionInfo });
57
- }
58
- return null;
59
- }
60
- async function stopCoverageInsideWorker(options, loader, runtimeOptions) {
61
- const coverageModule = await resolveCoverageProviderModule(options, loader);
62
- if (coverageModule) {
63
- return coverageModule.stopCoverage?.(runtimeOptions);
64
- }
65
- return null;
66
- }
67
39
 
68
- export { CoverageProviderMap as C, stopCoverageInsideWorker as a, getCoverageProvider as g, startCoverageInsideWorker as s, takeCoverageInsideWorker as t };
40
+ export { CoverageProviderMap as C, resolveCoverageProviderModule as r };
@@ -0,0 +1,35 @@
1
+ import { ModuleExecutionInfo } from 'vite-node/client';
2
+
3
+ interface RuntimeCoverageModuleLoader {
4
+ executeId: (id: string) => Promise<{
5
+ default: RuntimeCoverageProviderModule
6
+ }>;
7
+ isBrowser?: boolean;
8
+ moduleExecutionInfo?: ModuleExecutionInfo;
9
+ }
10
+ interface RuntimeCoverageProviderModule {
11
+ /**
12
+ * Factory for creating a new coverage provider
13
+ */
14
+ getProvider: () => any;
15
+ /**
16
+ * Executed before tests are run in the worker thread.
17
+ */
18
+ startCoverage?: (runtimeOptions: {
19
+ isolate: boolean
20
+ }) => unknown | Promise<unknown>;
21
+ /**
22
+ * Executed on after each run in the worker thread. Possible to return a payload passed to the provider
23
+ */
24
+ takeCoverage?: (runtimeOptions?: {
25
+ moduleExecutionInfo?: ModuleExecutionInfo
26
+ }) => unknown | Promise<unknown>;
27
+ /**
28
+ * Executed after all tests have been run in the worker thread.
29
+ */
30
+ stopCoverage?: (runtimeOptions: {
31
+ isolate: boolean
32
+ }) => unknown | Promise<unknown>;
33
+ }
34
+
35
+ export type { RuntimeCoverageModuleLoader as R, RuntimeCoverageProviderModule as a };