vitest 3.2.0-beta.2 → 3.2.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 (67) hide show
  1. package/dist/browser.d.ts +3 -3
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{base.DwtwORaC.js → base.D4119yLM.js} +4 -3
  4. package/dist/chunks/{benchmark.BoF7jW0Q.js → benchmark.Cf_PACH1.js} +1 -1
  5. package/dist/chunks/{cac.I9MLYfT-.js → cac.DWaWHIIE.js} +18 -15
  6. package/dist/chunks/{cli-api.d6IK1pnk.js → cli-api.CnmEXkxs.js} +250 -49
  7. package/dist/chunks/{config.d.UqE-KR0o.d.ts → config.d.D2ROskhv.d.ts} +2 -0
  8. package/dist/chunks/{console.K1NMVOSc.js → console.Cwr-MFPV.js} +3 -2
  9. package/dist/chunks/{constants.BZZyIeIE.js → constants.DnKduX2e.js} +1 -0
  10. package/dist/chunks/{coverage.OGU09Jbh.js → coverage.C73DaDgS.js} +116 -12
  11. package/dist/chunks/{creator.DGAdZ4Hj.js → creator.C8WKy2eW.js} +10 -7
  12. package/dist/chunks/{date.CDOsz-HY.js → date.ByMsSlOr.js} +25 -0
  13. package/dist/chunks/{defaults.DSxsTG0h.js → defaults.DpVH7vbg.js} +1 -0
  14. package/dist/chunks/{environment.d.D8YDy2v5.d.ts → environment.d.cL3nLXbE.d.ts} +1 -0
  15. package/dist/chunks/{execute.JlGHLJZT.js → execute.B3q-2LPV.js} +25 -0
  16. package/dist/chunks/{global.d.BPa1eL3O.d.ts → global.d.BNLIi6yo.d.ts} +3 -1
  17. package/dist/chunks/{globals.CpxW8ccg.js → globals.CI21aWXF.js} +7 -6
  18. package/dist/chunks/{index.DFXFpH3w.js → index.2jgTs_Q5.js} +19 -1
  19. package/dist/chunks/{index.CV36oG_L.js → index.Bter3jj9.js} +83 -16
  20. package/dist/chunks/{index.DswW_LEs.js → index.CbT4iuwc.js} +7 -4
  21. package/dist/chunks/index.D3XRDfWc.js +213 -0
  22. package/dist/chunks/{index.CfXMNXHg.js → index.DNgLEKsQ.js} +4 -2
  23. package/dist/chunks/{index.CmC5OK9L.js → index.JOzufsrU.js} +2 -1
  24. package/dist/chunks/{inspector.DbDkSkFn.js → inspector.BFsh5KO0.js} +3 -0
  25. package/dist/chunks/{node.3xsWotC9.js → node.Be-ntJnD.js} +1 -1
  26. package/dist/chunks/{reporters.d.CLC9rhKy.d.ts → reporters.d.Bt4IGtsa.d.ts} +24 -6
  27. package/dist/chunks/{rpc.D9_013TY.js → rpc.BKExFSRG.js} +2 -1
  28. package/dist/chunks/{runBaseTests.Dn2vyej_.js → runBaseTests.B_M1TTsK.js} +19 -10
  29. package/dist/chunks/{setup-common.CYo3Y0dD.js → setup-common.CF-O-dZX.js} +2 -1
  30. package/dist/chunks/{typechecker.DnTrplSJ.js → typechecker.BgzF-6iO.js} +78 -21
  31. package/dist/chunks/{utils.CgTj3MsC.js → utils.BlI4TC7Y.js} +1 -0
  32. package/dist/chunks/{utils.BfxieIyZ.js → utils.DPCq3gzW.js} +3 -0
  33. package/dist/chunks/{vi.BFR5YIgu.js → vi.pkoYCV6A.js} +25 -2
  34. package/dist/chunks/{vite.d.CBZ3M_ru.d.ts → vite.d.B-Kx3KCF.d.ts} +3 -1
  35. package/dist/chunks/{vm.C1HHjtNS.js → vm.DPYem2so.js} +72 -4
  36. package/dist/chunks/{worker.d.CoCI7hzP.d.ts → worker.d.BKbBp2ga.d.ts} +2 -2
  37. package/dist/chunks/{worker.d.D5Xdi-Zr.d.ts → worker.d.Bl1O4kuf.d.ts} +1 -1
  38. package/dist/cli.js +4 -4
  39. package/dist/config.cjs +2 -0
  40. package/dist/config.d.ts +7 -6
  41. package/dist/config.js +2 -2
  42. package/dist/coverage.d.ts +4 -4
  43. package/dist/coverage.js +5 -5
  44. package/dist/environments.d.ts +6 -2
  45. package/dist/environments.js +1 -1
  46. package/dist/execute.d.ts +9 -3
  47. package/dist/execute.js +1 -1
  48. package/dist/index.d.ts +24 -12
  49. package/dist/index.js +5 -5
  50. package/dist/node.d.ts +18 -10
  51. package/dist/node.js +14 -12
  52. package/dist/reporters.d.ts +4 -4
  53. package/dist/reporters.js +3 -3
  54. package/dist/runners.d.ts +1 -1
  55. package/dist/runners.js +13 -5
  56. package/dist/snapshot.js +2 -2
  57. package/dist/suite.js +2 -2
  58. package/dist/worker.js +9 -5
  59. package/dist/workers/forks.js +6 -4
  60. package/dist/workers/runVmTests.js +14 -9
  61. package/dist/workers/threads.js +4 -4
  62. package/dist/workers/vmForks.js +6 -6
  63. package/dist/workers/vmThreads.js +6 -6
  64. package/dist/workers.d.ts +4 -4
  65. package/dist/workers.js +10 -10
  66. package/package.json +18 -18
  67. package/dist/chunks/index.CK1YOQaa.js +0 -143
package/dist/config.cjs CHANGED
@@ -4,6 +4,7 @@ var os = require('node:os');
4
4
  var stdEnv = require('std-env');
5
5
  var vite = require('vite');
6
6
 
7
+ // if changed, update also jsdocs and docs
7
8
  const defaultBrowserPort = 63315;
8
9
  const extraInlineDeps = [
9
10
  /^(?!.*node_modules).*\.mjs$/,
@@ -43,6 +44,7 @@ const defaultCoverageExcludes = [
43
44
  "**/vitest.{workspace,projects}.[jt]s?(on)",
44
45
  "**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
45
46
  ];
47
+ // These are the generic defaults for coverage. Providers may also set some provider specific defaults.
46
48
  const coverageConfigDefaults = {
47
49
  provider: "v8",
48
50
  enabled: false,
package/dist/config.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
3
- import { c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport, b as TestProjectConfiguration } from './chunks/reporters.d.CLC9rhKy.js';
4
- export { f as TestProjectInlineConfiguration, g as WatcherTriggerPattern, W as WorkspaceProjectConfiguration } from './chunks/reporters.d.CLC9rhKy.js';
5
- import './chunks/vite.d.CBZ3M_ru.js';
6
- import { F as FakeTimerInstallOpts } from './chunks/config.d.UqE-KR0o.js';
3
+ import { c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport, b as TestProjectConfiguration } from './chunks/reporters.d.Bt4IGtsa.js';
4
+ export { f as TestProjectInlineConfiguration, g as WatcherTriggerPattern, W as WorkspaceProjectConfiguration } from './chunks/reporters.d.Bt4IGtsa.js';
5
+ import './chunks/vite.d.B-Kx3KCF.js';
6
+ import { F as FakeTimerInstallOpts } from './chunks/config.d.D2ROskhv.js';
7
7
  import '@vitest/runner';
8
- import './chunks/environment.d.D8YDy2v5.js';
8
+ import './chunks/environment.d.cL3nLXbE.js';
9
9
  import 'vitest/optional-types.js';
10
10
  import '@vitest/utils';
11
11
  import 'node:stream';
12
12
  import 'node:console';
13
13
  import '@vitest/mocker';
14
14
  import '@vitest/utils/source-map';
15
- import './chunks/worker.d.CoCI7hzP.js';
15
+ import './chunks/worker.d.BKbBp2ga.js';
16
16
  import 'vite-node';
17
17
  import '@vitest/snapshot';
18
18
  import '@vitest/pretty-format';
@@ -32,6 +32,7 @@ declare const extraInlineDeps: RegExp[];
32
32
 
33
33
  declare const defaultInclude: string[];
34
34
  declare const defaultExclude: string[];
35
+ // These are the generic defaults for coverage. Providers may also set some provider specific defaults.
35
36
  declare const coverageConfigDefaults: ResolvedCoverageOptions;
36
37
  declare const configDefaults: Readonly<{
37
38
  allowOnly: boolean
package/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
- export { d as defaultBrowserPort, e as extraInlineDeps } from './chunks/constants.BZZyIeIE.js';
2
- export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.DSxsTG0h.js';
1
+ export { d as defaultBrowserPort, e as extraInlineDeps } from './chunks/constants.DnKduX2e.js';
2
+ export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.DpVH7vbg.js';
3
3
  export { mergeConfig } from 'vite';
4
4
  import 'node:os';
5
5
  import './chunks/env.Dq0hM4Xv.js';
@@ -1,15 +1,15 @@
1
- import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.d.CLC9rhKy.js';
1
+ import { R as ResolvedCoverageOptions, V as Vitest, C as CoverageMap, a as ReportContext } from './chunks/reporters.d.Bt4IGtsa.js';
2
2
  import { TransformResult } from 'vite';
3
- import { A as AfterSuiteRunMeta } from './chunks/environment.d.D8YDy2v5.js';
3
+ import { A as AfterSuiteRunMeta } from './chunks/environment.d.cL3nLXbE.js';
4
4
  import '@vitest/runner';
5
5
  import '@vitest/utils';
6
6
  import 'node:stream';
7
7
  import 'node:console';
8
8
  import '@vitest/mocker';
9
9
  import '@vitest/utils/source-map';
10
- import './chunks/worker.d.CoCI7hzP.js';
10
+ import './chunks/worker.d.BKbBp2ga.js';
11
11
  import 'vite-node';
12
- import './chunks/config.d.UqE-KR0o.js';
12
+ import './chunks/config.d.D2ROskhv.js';
13
13
  import '@vitest/pretty-format';
14
14
  import '@vitest/snapshot';
15
15
  import '@vitest/snapshot/environment';
package/dist/coverage.js CHANGED
@@ -1,9 +1,9 @@
1
- export { B as BaseCoverageProvider } from './chunks/coverage.OGU09Jbh.js';
1
+ export { B as BaseCoverageProvider } from './chunks/coverage.C73DaDgS.js';
2
2
  import 'node:fs';
3
3
  import 'pathe';
4
4
  import 'picomatch';
5
5
  import 'tinyrainbow';
6
- import './chunks/defaults.DSxsTG0h.js';
6
+ import './chunks/defaults.DpVH7vbg.js';
7
7
  import 'node:os';
8
8
  import './chunks/env.Dq0hM4Xv.js';
9
9
  import 'std-env';
@@ -17,13 +17,13 @@ import 'node:url';
17
17
  import 'node:assert';
18
18
  import 'node:v8';
19
19
  import 'node:util';
20
- import './chunks/constants.BZZyIeIE.js';
21
- import 'node:tty';
22
20
  import 'vite';
21
+ import './chunks/constants.DnKduX2e.js';
22
+ import 'node:tty';
23
23
  import 'node:events';
24
24
  import './chunks/index.CJ0plNrh.js';
25
25
  import 'tinypool';
26
- import './chunks/typechecker.DnTrplSJ.js';
26
+ import './chunks/typechecker.BgzF-6iO.js';
27
27
  import 'node:perf_hooks';
28
28
  import '@vitest/utils/source-map';
29
29
  import 'tinyexec';
@@ -1,5 +1,5 @@
1
- import { E as Environment } from './chunks/environment.d.D8YDy2v5.js';
2
- export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d.D8YDy2v5.js';
1
+ import { E as Environment } from './chunks/environment.d.cL3nLXbE.js';
2
+ export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d.cL3nLXbE.js';
3
3
  import 'vitest/optional-types.js';
4
4
 
5
5
  declare const environments: {
@@ -10,6 +10,10 @@ declare const environments: {
10
10
  };
11
11
 
12
12
  interface PopulateOptions {
13
+ // we bind functions such as addEventListener and others
14
+ // because they rely on `this` in happy-dom, and in jsdom it
15
+ // has a priority for getting implementation from symbols
16
+ // (global doesn't have these symbols, but window - does)
13
17
  bindFunctions?: boolean;
14
18
  additionalKeys?: string[];
15
19
  }
@@ -1,2 +1,2 @@
1
- export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.DFXFpH3w.js';
1
+ export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.2jgTs_Q5.js';
2
2
  import 'node:console';
package/dist/execute.d.ts CHANGED
@@ -1,16 +1,16 @@
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.CoCI7hzP.js';
3
+ import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.d.BKbBp2ga.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.UqE-KR0o.js';
8
+ import './chunks/config.d.D2ROskhv.js';
9
9
  import '@vitest/pretty-format';
10
10
  import '@vitest/snapshot';
11
11
  import '@vitest/snapshot/environment';
12
12
  import '@vitest/utils/diff';
13
- import './chunks/environment.d.D8YDy2v5.js';
13
+ import './chunks/environment.d.cL3nLXbE.js';
14
14
  import 'vitest/optional-types.js';
15
15
 
16
16
  declare class FileMap {
@@ -21,6 +21,8 @@ declare class FileMap {
21
21
  readBuffer(path: string): Buffer;
22
22
  }
23
23
 
24
+ // need to copy paste types for vm
25
+ // because they require latest @types/node which we don't bundle
24
26
  interface ModuleEvaluateOptions {
25
27
  timeout?: vm.RunningScriptOptions["timeout"] | undefined;
26
28
  breakOnSigint?: vm.RunningScriptOptions["breakOnSigint"] | undefined;
@@ -48,6 +50,7 @@ interface ExternalModulesExecutorOptions {
48
50
  interopDefault?: boolean;
49
51
  viteClientModule: Record<string, unknown>;
50
52
  }
53
+ // TODO: improve Node.js strict mode support in #2854
51
54
  declare class ExternalModulesExecutor {
52
55
  #private;
53
56
  private options;
@@ -61,6 +64,7 @@ declare class ExternalModulesExecutor {
61
64
  import(identifier: string): Promise<object>;
62
65
  require(identifier: string): any;
63
66
  createRequire(identifier: string): NodeJS.Require;
67
+ // dynamic import can be used in both ESM and CJS, so we have it in the executor
64
68
  importModuleDynamically: (specifier: string, referencer: VMModule) => Promise<VMModule>;
65
69
  resolveModule: (specifier: string, referencer: string) => Promise<VMModule>;
66
70
  resolve(specifier: string, parent: string): string;
@@ -98,7 +102,9 @@ declare class VitestMocker {
98
102
  private resolvePath;
99
103
  resolveMocks(): Promise<void>;
100
104
  private callFunctionMock;
105
+ // public method to avoid circular dependency
101
106
  getMockContext(): MockContext;
107
+ // path used to store mocked dependencies
102
108
  getMockPath(dep: string): string;
103
109
  getDependencyMock(id: string): MockedModule | undefined;
104
110
  normalizePath(path: string): string;
package/dist/execute.js CHANGED
@@ -1,4 +1,4 @@
1
- export { V as VitestExecutor } from './chunks/execute.JlGHLJZT.js';
1
+ export { V as VitestExecutor } from './chunks/execute.B3q-2LPV.js';
2
2
  import 'node:fs';
3
3
  import 'node:url';
4
4
  import 'node:vm';
package/dist/index.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  import { File as File$1, TaskResultPack as TaskResultPack$1, TaskEventPack, 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, TaskEventPack as RunnerTaskEventPack, 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 { S as SerializedTestSpecification, h as CoverageProvider$1, a as ReportContext$1, i as CoverageProviderModule$1, j as CoverageReporter$1, k as CoverageProviderName, l as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, m as CoverageIstanbulOptions$1, c as CoverageV8Options$1, n as CustomProviderOptions$1, o as Reporter$1, V as Vitest$1, p as BrowserScript$1, q as BrowserConfigOptions$1, r as BuiltinEnvironment$1, s as VitestEnvironment$1, P as Pool$1, t as PoolOptions$1, u as CSSModuleScopeStrategy$1, A as ApiConfig$1, v as VitestRunMode$1, D as DepsOptimizationOptions$1, w as TransformModePatterns$1, I as InlineConfig$1, x as TypecheckConfig$1, y as UserConfig$1, z as ResolvedConfig$1, E as ProjectConfig$1, U as UserWorkspaceConfig$1, F as BenchmarkUserOptions$1 } from './chunks/reporters.d.CLC9rhKy.js';
4
- export { G as BrowserTesterOptions } from './chunks/reporters.d.CLC9rhKy.js';
5
- import { W as WorkerContext$1 } from './chunks/worker.d.D5Xdi-Zr.js';
6
- 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/global.d.BPa1eL3O.js';
7
- import { b as Awaitable$1, U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, 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.d.D8YDy2v5.js';
8
- export { A as AfterSuiteRunMeta, g as ModuleCache } from './chunks/environment.d.D8YDy2v5.js';
9
- import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.d.CoCI7hzP.js';
10
- export { C as ContextRPC, d as ContextTestEnvironment, e as ResolveIdFunction, c as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.CoCI7hzP.js';
11
- import './chunks/vite.d.CBZ3M_ru.js';
12
- import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.UqE-KR0o.js';
13
- export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.UqE-KR0o.js';
3
+ import { S as SerializedTestSpecification, h as CoverageProvider$1, a as ReportContext$1, i as CoverageProviderModule$1, j as CoverageReporter$1, k as CoverageProviderName, l as CoverageOptions$1, R as ResolvedCoverageOptions$1, B as BaseCoverageOptions$1, m as CoverageIstanbulOptions$1, c as CoverageV8Options$1, n as CustomProviderOptions$1, o as Reporter$1, V as Vitest$1, p as BrowserScript$1, q as BrowserConfigOptions$1, r as BuiltinEnvironment$1, s as VitestEnvironment$1, P as Pool$1, t as PoolOptions$1, u as CSSModuleScopeStrategy$1, A as ApiConfig$1, v as VitestRunMode$1, D as DepsOptimizationOptions$1, w as TransformModePatterns$1, I as InlineConfig$1, x as TypecheckConfig$1, y as UserConfig$1, z as ResolvedConfig$1, E as ProjectConfig$1, U as UserWorkspaceConfig$1, F as BenchmarkUserOptions$1 } from './chunks/reporters.d.Bt4IGtsa.js';
4
+ export { G as BrowserTesterOptions } from './chunks/reporters.d.Bt4IGtsa.js';
5
+ import { W as WorkerContext$1 } from './chunks/worker.d.Bl1O4kuf.js';
6
+ 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/global.d.BNLIi6yo.js';
7
+ import { b as Awaitable$1, U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, 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.d.cL3nLXbE.js';
8
+ export { A as AfterSuiteRunMeta, g as ModuleCache } from './chunks/environment.d.cL3nLXbE.js';
9
+ import { a as BirpcReturn, b as WorkerRPC$1 } from './chunks/worker.d.BKbBp2ga.js';
10
+ export { C as ContextRPC, d as ContextTestEnvironment, e as ResolveIdFunction, c as RunnerRPC, R as RuntimeRPC, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.BKbBp2ga.js';
11
+ import './chunks/vite.d.B-Kx3KCF.js';
12
+ import { a as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.D2ROskhv.js';
13
+ export { b as RuntimeConfig, S as SerializedCoverageConfig } from './chunks/config.d.D2ROskhv.js';
14
14
  import { ExpectStatic } from '@vitest/expect';
15
- export { Assertion, AsymmetricMatchersContaining, ExpectPollOptions, ExpectStatic, JestAssertion } from '@vitest/expect';
15
+ export { Assertion, AsymmetricMatchersContaining, ExpectPollOptions, ExpectStatic, JestAssertion, Matchers } from '@vitest/expect';
16
16
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
17
17
  export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject } from '@vitest/spy';
18
18
  import { M as MockFactoryWithHelper, a as MockOptions } from './chunks/mocker.d.BE_2ls6u.js';
@@ -68,6 +68,7 @@ interface WebSocketHandlers {
68
68
  getTestFiles: () => Promise<SerializedTestSpecification[]>;
69
69
  getPaths: () => string[];
70
70
  getConfig: () => SerializedConfig;
71
+ // TODO: Remove in v4
71
72
  /** @deprecated -- Use `getResolvedProjectLabels` instead */
72
73
  getResolvedProjectNames: () => string[];
73
74
  getResolvedProjectLabels: () => {
@@ -94,6 +95,8 @@ interface WebSocketEvents {
94
95
  }
95
96
  type WebSocketRPC = BirpcReturn<WebSocketEvents, WebSocketHandlers>;
96
97
 
98
+ // CI fails only for this file, but it works locally
99
+
97
100
  declare function createExpect(test?: TaskPopulated): ExpectStatic;
98
101
  declare const globalExpect: ExpectStatic;
99
102
 
@@ -103,6 +106,7 @@ declare const globalExpect: ExpectStatic;
103
106
  */
104
107
  declare function inject<T extends keyof ProvidedContext & string>(key: T): ProvidedContext[T];
105
108
 
109
+ // The waitFor function was inspired by https://github.com/testing-library/web-testing-library/pull/2
106
110
  type WaitForCallback<T> = () => T | Promise<T>;
107
111
  interface WaitForOptions {
108
112
  /**
@@ -295,7 +299,9 @@ interface VitestUtils {
295
299
  * @param path Path to the module. Can be aliased, if your Vitest config supports it
296
300
  * @param factory Mocked module factory. The result of this function will be an exports object
297
301
  */
302
+ // eslint-disable-next-line ts/method-signature-style
298
303
  mock(path: string, factory?: MockFactoryWithHelper | MockOptions): void;
304
+ // eslint-disable-next-line ts/method-signature-style
299
305
  mock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T> | MockOptions): void;
300
306
  /**
301
307
  * Removes module from mocked registry. All calls to import will return the original module even if it was mocked before.
@@ -303,7 +309,9 @@ interface VitestUtils {
303
309
  * This call is hoisted to the top of the file, so it will only unmock modules that were defined in `setupFiles`, for example.
304
310
  * @param path Path to the module. Can be aliased, if your Vitest config supports it
305
311
  */
312
+ // eslint-disable-next-line ts/method-signature-style
306
313
  unmock(path: string): void;
314
+ // eslint-disable-next-line ts/method-signature-style
307
315
  unmock(module: Promise<unknown>): void;
308
316
  /**
309
317
  * Mocks every subsequent [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) call.
@@ -314,7 +322,9 @@ interface VitestUtils {
314
322
  * @param path Path to the module. Can be aliased, if your Vitest config supports it
315
323
  * @param factory Mocked module factory. The result of this function will be an exports object
316
324
  */
325
+ // eslint-disable-next-line ts/method-signature-style
317
326
  doMock(path: string, factory?: MockFactoryWithHelper | MockOptions): void;
327
+ // eslint-disable-next-line ts/method-signature-style
318
328
  doMock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T> | MockOptions): void;
319
329
  /**
320
330
  * Removes module from mocked registry. All subsequent calls to import will return original module.
@@ -322,7 +332,9 @@ interface VitestUtils {
322
332
  * Unlike [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock), this method is not hoisted to the top of the file.
323
333
  * @param path Path to the module. Can be aliased, if your Vitest config supports it
324
334
  */
335
+ // eslint-disable-next-line ts/method-signature-style
325
336
  doUnmock(path: string): void;
337
+ // eslint-disable-next-line ts/method-signature-style
326
338
  doUnmock(module: Promise<unknown>): void;
327
339
  /**
328
340
  * Imports module, bypassing all checks if it should be mocked.
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.BFR5YIgu.js';
2
- export { b as bench } from './chunks/benchmark.BoF7jW0Q.js';
3
- export { a as assertType } from './chunks/index.CfXMNXHg.js';
1
+ export { c as createExpect, a as expect, i as inject, v as vi, b as vitest } from './chunks/vi.pkoYCV6A.js';
2
+ export { b as bench } from './chunks/benchmark.Cf_PACH1.js';
3
+ export { a as assertType } from './chunks/index.DNgLEKsQ.js';
4
4
  export { expectTypeOf } from 'expect-type';
5
5
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
6
6
  import * as chai from 'chai';
@@ -8,11 +8,11 @@ export { chai };
8
8
  export { assert, should } from 'chai';
9
9
  import '@vitest/expect';
10
10
  import '@vitest/runner/utils';
11
- import './chunks/utils.CgTj3MsC.js';
11
+ import './chunks/utils.BlI4TC7Y.js';
12
12
  import '@vitest/utils';
13
13
  import './chunks/_commonjsHelpers.BFTU3MAI.js';
14
14
  import '@vitest/snapshot';
15
15
  import '@vitest/utils/error';
16
16
  import '@vitest/spy';
17
17
  import '@vitest/utils/source-map';
18
- import './chunks/date.CDOsz-HY.js';
18
+ import './chunks/date.ByMsSlOr.js';
package/dist/node.d.ts CHANGED
@@ -1,21 +1,21 @@
1
- import { z as ResolvedConfig, y as UserConfig, v as VitestRunMode, H as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, J as TestSequencer, K as TestSpecification, L as Logger, M as TestModule, N as ModuleDiagnostic } from './chunks/reporters.d.CLC9rhKy.js';
2
- export { B as BaseCoverageOptions, F as BenchmarkUserOptions, ag as BrowserBuiltinProvider, ah as BrowserCommand, ai as BrowserCommandContext, q as BrowserConfigOptions, aj as BrowserInstanceOption, ak as BrowserModuleMocker, al as BrowserOrchestrator, am as BrowserProvider, an as BrowserProviderInitializationOptions, ao as BrowserProviderModule, ap as BrowserProviderOptions, p as BrowserScript, aq as BrowserServerState, ar as BrowserServerStateSession, r as BuiltinEnvironment, as as CDPSession, u as CSSModuleScopeStrategy, m as CoverageIstanbulOptions, l as CoverageOptions, h as CoverageProvider, i as CoverageProviderModule, j as CoverageReporter, c as CoverageV8Options, n as CustomProviderOptions, D as DepsOptimizationOptions, a0 as HTMLOptions, I as InlineConfig, a2 as JUnitOptions, a1 as JsonOptions, O as OnServerRestartHandler, Q as OnTestsRerunHandler, at as ParentProjectBrowser, P as Pool, t as PoolOptions, Y as ProcessPool, au as ProjectBrowser, E as ProjectConfig, a as ReportContext, aA as ReportedHookContext, o as Reporter, ax as ResolveSnapshotPathHandler, ay as ResolveSnapshotPathHandlerContext, av as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aw as ResolvedProjectConfig, $ as SerializedTestProject, a3 as TaskOptions, a4 as TestCase, a5 as TestCollection, a6 as TestDiagnostic, a7 as TestModuleState, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, aB as TestRunEndReason, az as TestRunResult, af as TestSequencerConstructor, ac as TestState, ad as TestSuite, ae as TestSuiteState, w as TransformModePatterns, x as TypecheckConfig, U as UserWorkspaceConfig, s as VitestEnvironment, X as VitestPackageInstaller, g as WatcherTriggerPattern, Z as WorkspaceSpec, _ as getFilePoolName } from './chunks/reporters.d.CLC9rhKy.js';
1
+ import { z as ResolvedConfig, y as UserConfig, v as VitestRunMode, H as VitestOptions, V as Vitest, A as ApiConfig, T as TestProject, J as TestSequencer, K as TestSpecification, L as Logger, M as TestModule, N as ModuleDiagnostic } from './chunks/reporters.d.Bt4IGtsa.js';
2
+ export { B as BaseCoverageOptions, F as BenchmarkUserOptions, ag as BrowserBuiltinProvider, ah as BrowserCommand, ai as BrowserCommandContext, q as BrowserConfigOptions, aj as BrowserInstanceOption, ak as BrowserModuleMocker, al as BrowserOrchestrator, am as BrowserProvider, an as BrowserProviderInitializationOptions, ao as BrowserProviderModule, ap as BrowserProviderOptions, p as BrowserScript, aq as BrowserServerState, ar as BrowserServerStateSession, r as BuiltinEnvironment, as as CDPSession, u as CSSModuleScopeStrategy, m as CoverageIstanbulOptions, l as CoverageOptions, h as CoverageProvider, i as CoverageProviderModule, j as CoverageReporter, c as CoverageV8Options, n as CustomProviderOptions, D as DepsOptimizationOptions, a0 as HTMLOptions, I as InlineConfig, a2 as JUnitOptions, a1 as JsonOptions, O as OnServerRestartHandler, Q as OnTestsRerunHandler, at as ParentProjectBrowser, P as Pool, t as PoolOptions, Y as ProcessPool, au as ProjectBrowser, E as ProjectConfig, a as ReportContext, aA as ReportedHookContext, o as Reporter, ax as ResolveSnapshotPathHandler, ay as ResolveSnapshotPathHandlerContext, av as ResolvedBrowserOptions, R as ResolvedCoverageOptions, aw as ResolvedProjectConfig, $ as SerializedTestProject, a3 as TaskOptions, a4 as TestCase, a5 as TestCollection, a6 as TestDiagnostic, a7 as TestModuleState, a8 as TestResult, a9 as TestResultFailed, aa as TestResultPassed, ab as TestResultSkipped, aB as TestRunEndReason, az as TestRunResult, af as TestSequencerConstructor, ac as TestState, ad as TestSuite, ae as TestSuiteState, w as TransformModePatterns, x as TypecheckConfig, U as UserWorkspaceConfig, s as VitestEnvironment, X as VitestPackageInstaller, g as WatcherTriggerPattern, Z as WorkspaceSpec, _ as getFilePoolName } from './chunks/reporters.d.Bt4IGtsa.js';
3
3
  import { InlineConfig, UserConfig as UserConfig$1, 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
6
  export { esbuildVersion, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
7
7
  import { IncomingMessage } from 'node:http';
8
- import { R as RuntimeRPC } from './chunks/worker.d.CoCI7hzP.js';
9
- export { T as TestExecutionType } from './chunks/worker.d.CoCI7hzP.js';
8
+ import { R as RuntimeRPC } from './chunks/worker.d.BKbBp2ga.js';
9
+ export { T as TestExecutionType } from './chunks/worker.d.BKbBp2ga.js';
10
10
  import { Writable } from 'node:stream';
11
- export { V as VitestPluginContext } from './chunks/vite.d.CBZ3M_ru.js';
12
- export { W as WorkerContext } from './chunks/worker.d.D5Xdi-Zr.js';
13
- export { C as TypeCheckCollectLineNumbers, a as TypeCheckCollectLines, c as TypeCheckContext, T as TypeCheckErrorInfo, R as TypeCheckRawErrorsMap, b as TypeCheckRootAndTarget } from './chunks/global.d.BPa1eL3O.js';
11
+ export { V as VitestPluginContext } from './chunks/vite.d.B-Kx3KCF.js';
12
+ export { W as WorkerContext } from './chunks/worker.d.Bl1O4kuf.js';
13
+ export { C as TypeCheckCollectLineNumbers, a as TypeCheckCollectLines, c as TypeCheckContext, T as TypeCheckErrorInfo, R as TypeCheckRawErrorsMap, b as TypeCheckRootAndTarget } from './chunks/global.d.BNLIi6yo.js';
14
14
  import { Debugger } from 'debug';
15
15
  export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from '@vitest/runner';
16
- export { f as EnvironmentOptions, H as HappyDOMOptions, J as JSDOMOptions } from './chunks/environment.d.D8YDy2v5.js';
16
+ export { f as EnvironmentOptions, H as HappyDOMOptions, J as JSDOMOptions } from './chunks/environment.d.cL3nLXbE.js';
17
17
  export { SerializedError } from '@vitest/utils';
18
- export { b as RuntimeConfig } from './chunks/config.d.UqE-KR0o.js';
18
+ export { b as RuntimeConfig } from './chunks/config.d.D2ROskhv.js';
19
19
  export { generateFileHash } from '@vitest/runner/utils';
20
20
  import 'node:console';
21
21
  import '@vitest/mocker';
@@ -96,8 +96,9 @@ declare class GitNotFoundError extends Error {
96
96
  /** @deprecated use `TestProject` instead */
97
97
  type GlobalSetupContext = TestProject;
98
98
 
99
- declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin[]>;
99
+ declare function VitestPlugin(options?: UserConfig, vitest?: Vitest): Promise<Plugin[]>;
100
100
 
101
+ // this is only exported as a public function and not used inside vitest
101
102
  declare function resolveConfig(options?: UserConfig, viteOverrides?: UserConfig$1): Promise<{
102
103
  vitestConfig: ResolvedConfig
103
104
  viteConfig: ResolvedConfig$1
@@ -107,6 +108,7 @@ declare function resolveFsAllow(projectRoot: string, rootConfigFile: string | fa
107
108
 
108
109
  interface MethodsOptions {
109
110
  cacheFs?: boolean;
111
+ // do not report files
110
112
  collect?: boolean;
111
113
  }
112
114
  declare function createMethodsRPC(project: TestProject, options?: MethodsOptions): RuntimeRPC;
@@ -114,12 +116,18 @@ declare function createMethodsRPC(project: TestProject, options?: MethodsOptions
114
116
  declare class BaseSequencer implements TestSequencer {
115
117
  protected ctx: Vitest;
116
118
  constructor(ctx: Vitest);
119
+ // async so it can be extended by other sequelizers
117
120
  shard(files: TestSpecification[]): Promise<TestSpecification[]>;
121
+ // async so it can be extended by other sequelizers
118
122
  sort(files: TestSpecification[]): Promise<TestSpecification[]>;
119
123
  }
120
124
 
121
125
  declare function registerConsoleShortcuts(ctx: Vitest, stdin: NodeJS.ReadStream | undefined, stdout: NodeJS.WriteStream | Writable): () => void;
122
126
 
127
+ // This is copy-pasted and needs to be synced from time to time. Ideally, Vite's `createLogger` should accept a custom `console`
128
+ // https://github.com/vitejs/vite/blob/main/packages/vite/src/node/logger.ts?rgh-link-date=2024-10-16T23%3A29%3A19Z
129
+ // When Vitest supports only Vite 6 and above, we can use Vite's `createLogger({ console })`
130
+ // https://github.com/vitejs/vite/pull/18379
123
131
  declare function createViteLogger(console: Logger, level?: LogLevel, options?: LoggerOptions): Logger$1;
124
132
 
125
133
  declare const rootDir: string;
package/dist/node.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { resolveConfig as resolveConfig$1, mergeConfig, createServer as createServer$1 } from 'vite';
2
2
  export { esbuildVersion, isFileServingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from 'vite';
3
- import { V as Vitest, a as VitestPlugin, T as TestModule } from './chunks/cli-api.d6IK1pnk.js';
4
- export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, e as createViteLogger, c as createVitest, i as isValidApiRequest, d as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.d6IK1pnk.js';
5
- export { p as parseCLI } from './chunks/cac.I9MLYfT-.js';
6
- import { r as resolveConfig$2 } from './chunks/coverage.OGU09Jbh.js';
7
- export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.OGU09Jbh.js';
8
- import { slash } from '@vitest/utils';
3
+ import { V as Vitest, a as VitestPlugin, T as TestModule } from './chunks/cli-api.CnmEXkxs.js';
4
+ export { G as GitNotFoundError, F as TestsNotFoundError, b as VitestPackageInstaller, e as createViteLogger, c as createVitest, i as isValidApiRequest, d as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.CnmEXkxs.js';
5
+ export { p as parseCLI } from './chunks/cac.DWaWHIIE.js';
6
+ import { r as resolveConfig$2 } from './chunks/coverage.C73DaDgS.js';
7
+ export { b as BaseSequencer, c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig } from './chunks/coverage.C73DaDgS.js';
8
+ import { slash, deepClone } from '@vitest/utils';
9
9
  import { f as findUp } from './chunks/index.X0nbfr6-.js';
10
10
  import { resolve } from 'pathe';
11
- import { c as configFiles } from './chunks/constants.BZZyIeIE.js';
11
+ import { c as configFiles } from './chunks/constants.DnKduX2e.js';
12
12
  export { distDir, rootDir } from './path.js';
13
13
  import createDebug from 'debug';
14
14
  export { generateFileHash } from '@vitest/runner/utils';
@@ -19,13 +19,13 @@ import '@vitest/snapshot/manager';
19
19
  import 'vite-node/client';
20
20
  import 'vite-node/server';
21
21
  import './chunks/index.CJ0plNrh.js';
22
- import './chunks/index.CV36oG_L.js';
22
+ import './chunks/index.Bter3jj9.js';
23
23
  import 'node:perf_hooks';
24
24
  import '@vitest/utils/source-map';
25
25
  import 'tinyrainbow';
26
26
  import './chunks/env.Dq0hM4Xv.js';
27
27
  import 'std-env';
28
- import './chunks/typechecker.DnTrplSJ.js';
28
+ import './chunks/typechecker.BgzF-6iO.js';
29
29
  import 'node:os';
30
30
  import 'tinyexec';
31
31
  import 'node:util';
@@ -50,9 +50,9 @@ import 'picomatch';
50
50
  import 'tinyglobby';
51
51
  import 'vite-node/utils';
52
52
  import '@vitest/mocker/node';
53
- import './chunks/defaults.DSxsTG0h.js';
53
+ import './chunks/defaults.DpVH7vbg.js';
54
54
  import 'magic-string';
55
- import './chunks/index.CmC5OK9L.js';
55
+ import './chunks/index.JOzufsrU.js';
56
56
  import 'node:assert';
57
57
  import '@vitest/utils/error';
58
58
  import 'node:readline';
@@ -64,16 +64,18 @@ import 'tinypool';
64
64
  import 'node:worker_threads';
65
65
  import 'readline';
66
66
 
67
+ // this is only exported as a public function and not used inside vitest
67
68
  async function resolveConfig(options = {}, viteOverrides = {}) {
68
69
  const root = slash(resolve(options.root || process.cwd()));
69
70
  const configPath = options.config === false ? false : options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
70
71
  options.config = configPath;
71
- const vitest = new Vitest("test");
72
+ const vitest = new Vitest("test", deepClone(options));
72
73
  const config = await resolveConfig$1(mergeConfig({
73
74
  configFile: configPath,
74
75
  mode: options.mode || "test",
75
76
  plugins: [await VitestPlugin(options, vitest)]
76
77
  }, mergeConfig(viteOverrides, { root: options.root })), "serve");
78
+ // Reflect just to avoid type error
77
79
  const updatedOptions = Reflect.get(config, "_vitest");
78
80
  const vitestConfig = resolveConfig$2(vitest, updatedOptions, config);
79
81
  await vitest.close();
@@ -1,6 +1,6 @@
1
- export { aQ as BaseReporter, aC as BasicReporter, aR as BenchmarkBuiltinReporters, aD as BenchmarkReporter, aE as BenchmarkReportsMap, aS as BuiltinReporterOptions, aT as BuiltinReporters, aF as DefaultReporter, aG as DotReporter, aH as GithubActionsReporter, aI as HangingProcessReporter, aK as JUnitReporter, aU as JsonAssertionResult, aJ as JsonReporter, aV as JsonTestResult, aW as JsonTestResults, aA as ReportedHookContext, o as Reporter, aL as ReportersMap, aM as TapFlatReporter, aN as TapReporter, aB as TestRunEndReason, aO as VerboseBenchmarkReporter, aP as VerboseReporter } from './chunks/reporters.d.CLC9rhKy.js';
1
+ export { aQ as BaseReporter, aC as BasicReporter, aR as BenchmarkBuiltinReporters, aD as BenchmarkReporter, aE as BenchmarkReportsMap, aS as BuiltinReporterOptions, aT as BuiltinReporters, aF as DefaultReporter, aG as DotReporter, aH as GithubActionsReporter, aI as HangingProcessReporter, aK as JUnitReporter, aU as JsonAssertionResult, aJ as JsonReporter, aV as JsonTestResult, aW as JsonTestResults, aA as ReportedHookContext, o as Reporter, aL as ReportersMap, aM as TapFlatReporter, aN as TapReporter, aB as TestRunEndReason, aO as VerboseBenchmarkReporter, aP as VerboseReporter } from './chunks/reporters.d.Bt4IGtsa.js';
2
2
  import '@vitest/runner';
3
- import './chunks/environment.d.D8YDy2v5.js';
3
+ import './chunks/environment.d.cL3nLXbE.js';
4
4
  import 'vitest/optional-types.js';
5
5
  import '@vitest/utils';
6
6
  import 'node:stream';
@@ -8,9 +8,9 @@ import 'vite';
8
8
  import 'node:console';
9
9
  import '@vitest/mocker';
10
10
  import '@vitest/utils/source-map';
11
- import './chunks/worker.d.CoCI7hzP.js';
11
+ import './chunks/worker.d.BKbBp2ga.js';
12
12
  import 'vite-node';
13
- import './chunks/config.d.UqE-KR0o.js';
13
+ import './chunks/config.d.D2ROskhv.js';
14
14
  import '@vitest/pretty-format';
15
15
  import '@vitest/snapshot';
16
16
  import '@vitest/snapshot/environment';
package/dist/reporters.js CHANGED
@@ -1,5 +1,5 @@
1
- export { B as BasicReporter, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.CV36oG_L.js';
2
- export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.CmC5OK9L.js';
1
+ export { B as BasicReporter, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.Bter3jj9.js';
2
+ export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.JOzufsrU.js';
3
3
  import 'node:perf_hooks';
4
4
  import '@vitest/runner/utils';
5
5
  import '@vitest/utils';
@@ -8,7 +8,7 @@ import 'pathe';
8
8
  import 'tinyrainbow';
9
9
  import './chunks/env.Dq0hM4Xv.js';
10
10
  import 'std-env';
11
- import './chunks/typechecker.DnTrplSJ.js';
11
+ import './chunks/typechecker.BgzF-6iO.js';
12
12
  import 'node:os';
13
13
  import 'tinyexec';
14
14
  import './path.js';
package/dist/runners.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as tinybench from 'tinybench';
2
2
  import { VitestRunner, VitestRunnerImportSource, Suite, File, Task, CancelReason, TestContext } from '@vitest/runner';
3
3
  export { VitestRunner } from '@vitest/runner';
4
- import { a as SerializedConfig } from './chunks/config.d.UqE-KR0o.js';
4
+ import { a as SerializedConfig } from './chunks/config.d.D2ROskhv.js';
5
5
  import '@vitest/pretty-format';
6
6
  import '@vitest/snapshot';
7
7
  import '@vitest/snapshot/environment';
package/dist/runners.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import { updateTask } from '@vitest/runner';
2
2
  import { createDefer, getSafeTimers } from '@vitest/utils';
3
- import { a as getBenchOptions, g as getBenchFn } from './chunks/benchmark.BoF7jW0Q.js';
4
- import { g as getWorkerState } from './chunks/utils.CgTj3MsC.js';
3
+ import { a as getBenchOptions, g as getBenchFn } from './chunks/benchmark.Cf_PACH1.js';
4
+ import { g as getWorkerState } from './chunks/utils.BlI4TC7Y.js';
5
5
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
6
6
  import { getTests, getNames, getTestName } from '@vitest/runner/utils';
7
- import { g as getSnapshotClient, i as inject, c as createExpect, v as vi } from './chunks/vi.BFR5YIgu.js';
8
- import { r as rpc } from './chunks/rpc.D9_013TY.js';
7
+ import { g as getSnapshotClient, i as inject, c as createExpect, v as vi } from './chunks/vi.pkoYCV6A.js';
8
+ import { r as rpc } from './chunks/rpc.BKExFSRG.js';
9
9
  import 'chai';
10
10
  import './chunks/_commonjsHelpers.BFTU3MAI.js';
11
11
  import '@vitest/snapshot';
12
12
  import '@vitest/utils/error';
13
13
  import '@vitest/spy';
14
14
  import '@vitest/utils/source-map';
15
- import './chunks/date.CDOsz-HY.js';
15
+ import './chunks/date.ByMsSlOr.js';
16
16
  import './chunks/index.CJ0plNrh.js';
17
17
 
18
18
  function createBenchmarkResult(name) {
@@ -39,6 +39,7 @@ async function runBenchmarkSuite(suite, runner) {
39
39
  benchmarkSuiteGroup.push(task);
40
40
  }
41
41
  }
42
+ // run sub suites sequentially
42
43
  for (const subSuite of benchmarkSuiteGroup) {
43
44
  await runBenchmarkSuite(subSuite, runner);
44
45
  }
@@ -57,6 +58,7 @@ async function runBenchmarkSuite(suite, runner) {
57
58
  const result = benchmark.result.benchmark;
58
59
  benchmark.result.state = "pass";
59
60
  Object.assign(result, taskRes);
61
+ // compute extra stats and free raw samples as early as possible
60
62
  const samples = result.samples;
61
63
  result.sampleCount = samples.length;
62
64
  result.median = samples.length % 2 ? samples[Math.floor(samples.length / 2)] : (samples[samples.length / 2] + samples[samples.length / 2 - 1]) / 2;
@@ -153,6 +155,7 @@ class VitestTestRunner {
153
155
  suite.result.heap = process.memoryUsage().heapUsed;
154
156
  }
155
157
  if (suite.mode !== "skip" && "filepath" in suite) {
158
+ // mark snapshots in skipped tests as not obsolete
156
159
  for (const test of getTests(suite)) {
157
160
  if (test.mode === "skip") {
158
161
  const name = getNames(test).slice(1).join(" > ");
@@ -174,6 +177,8 @@ class VitestTestRunner {
174
177
  this.cancelRun = true;
175
178
  }
176
179
  injectValue(key) {
180
+ // inject has a very limiting type controlled by ProvidedContext
181
+ // some tests override it which causes the build to fail
177
182
  return inject(key);
178
183
  }
179
184
  async onBeforeRunTask(test) {
@@ -189,6 +194,7 @@ class VitestTestRunner {
189
194
  if (this.cancelRun) {
190
195
  suite.mode = "skip";
191
196
  }
197
+ // initialize snapshot state before running file suite
192
198
  if (suite.mode !== "skip" && "filepath" in suite) {
193
199
  await this.snapshotClient.setup(suite.file.filepath, this.workerState.config.snapshotOptions);
194
200
  }
@@ -220,6 +226,7 @@ class VitestTestRunner {
220
226
  }
221
227
  }
222
228
  extendTaskContext(context) {
229
+ // create error during the test initialization so we have a nice stack trace
223
230
  if (this.config.expect.requireAssertions) {
224
231
  this.assertionsErrors.set(context.task, new Error("expected any number of assertion, but got none"));
225
232
  }
@@ -238,6 +245,7 @@ class VitestTestRunner {
238
245
  }
239
246
  function clearModuleMocks(config) {
240
247
  const { clearMocks, mockReset, restoreMocks, unstubEnvs, unstubGlobals } = config;
248
+ // since each function calls another, we can just call one
241
249
  if (restoreMocks) {
242
250
  vi.restoreAllMocks();
243
251
  } else if (mockReset) {
package/dist/snapshot.js CHANGED
@@ -1,4 +1,4 @@
1
- export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/node.3xsWotC9.js';
1
+ export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/node.Be-ntJnD.js';
2
2
  import '@vitest/snapshot/environment';
3
- import './chunks/utils.CgTj3MsC.js';
3
+ import './chunks/utils.BlI4TC7Y.js';
4
4
  import '@vitest/utils';
package/dist/suite.js CHANGED
@@ -1,5 +1,5 @@
1
- export { g as getBenchFn, a as getBenchOptions } from './chunks/benchmark.BoF7jW0Q.js';
1
+ export { g as getBenchFn, a as getBenchOptions } from './chunks/benchmark.Cf_PACH1.js';
2
2
  export { createTaskCollector, getCurrentSuite, getCurrentTest, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
3
3
  export { createChainable } from '@vitest/runner/utils';
4
4
  import '@vitest/utils';
5
- import './chunks/utils.CgTj3MsC.js';
5
+ import './chunks/utils.BlI4TC7Y.js';