@voidzero-dev/vite-plus-test 0.1.9 → 0.1.10

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 (205) hide show
  1. package/LICENSE.md +181 -1
  2. package/dist/@vitest/browser/client/.vite/manifest.json +6 -6
  3. package/dist/@vitest/browser/client/__vitest__/assets/index-Da0hb3oU.css +1 -0
  4. package/dist/@vitest/browser/client/__vitest__/assets/index-Di71CKDo.js +63 -0
  5. package/dist/@vitest/browser/client/__vitest__/favicon.ico +0 -0
  6. package/dist/@vitest/browser/client/__vitest__/favicon.svg +49 -4
  7. package/dist/@vitest/browser/client/__vitest__/index.html +2 -2
  8. package/dist/@vitest/browser/client/__vitest_browser__/{orchestrator-S_3e_uzt.js → orchestrator-CXs6qrFe.js} +70 -28
  9. package/dist/@vitest/browser/client/__vitest_browser__/{tester-k74mgIRa.js → tester-K5NNxh1O.js} +167 -58
  10. package/dist/@vitest/browser/client/__vitest_browser__/{utils-uxqdqUz8.js → utils-C2ISqq1C.js} +2 -2
  11. package/dist/@vitest/browser/client/favicon.svg +49 -4
  12. package/dist/@vitest/browser/client/orchestrator.html +2 -2
  13. package/dist/@vitest/browser/client/tester/tester.html +2 -2
  14. package/dist/@vitest/browser/client.js +20 -13
  15. package/dist/@vitest/browser/context.d.ts +160 -10
  16. package/dist/@vitest/browser/context.js +108 -22
  17. package/dist/@vitest/browser/expect-element.js +23 -28
  18. package/dist/@vitest/browser/index-5Pe7X7sp.js +7 -0
  19. package/dist/@vitest/browser/index.d.ts +20 -2
  20. package/dist/@vitest/browser/index.js +5706 -159
  21. package/dist/@vitest/browser/locators.d.ts +14 -3
  22. package/dist/@vitest/browser/locators.js +1 -1
  23. package/dist/@vitest/browser-playwright/index.d.ts +22 -5
  24. package/dist/@vitest/browser-playwright/index.js +169 -61
  25. package/dist/@vitest/browser-preview/index.d.ts +14 -1
  26. package/dist/@vitest/browser-preview/locators.js +31 -18
  27. package/dist/@vitest/browser-webdriverio/index.d.ts +17 -3
  28. package/dist/@vitest/browser-webdriverio/index.js +22 -2
  29. package/dist/@vitest/browser-webdriverio/locators.js +84 -7
  30. package/dist/@vitest/expect/index.d.ts +172 -54
  31. package/dist/@vitest/expect/index.js +124 -67
  32. package/dist/@vitest/mocker/auto-register.js +1 -0
  33. package/dist/@vitest/mocker/automock.d.ts +1 -0
  34. package/dist/@vitest/mocker/automock.js +5 -0
  35. package/dist/@vitest/mocker/browser.d.ts +4 -4
  36. package/dist/@vitest/mocker/browser.js +1 -0
  37. package/dist/@vitest/mocker/chunk-automock.js +182 -14
  38. package/dist/@vitest/mocker/chunk-helpers.js +44 -0
  39. package/dist/@vitest/mocker/chunk-hoistMocks.js +659 -0
  40. package/dist/@vitest/mocker/chunk-mocker.js +41 -30
  41. package/dist/@vitest/mocker/chunk-registry.js +21 -7
  42. package/dist/@vitest/mocker/chunk-utils.js +18 -7
  43. package/dist/@vitest/mocker/hoistMocks.d-w2ILr1dG.d.ts +739 -0
  44. package/dist/@vitest/mocker/{index.d-C-sLYZi-.d.ts → index.d-B41z0AuW.d.ts} +1 -1
  45. package/dist/@vitest/mocker/index.d.ts +2 -2
  46. package/dist/@vitest/mocker/index.js +18 -3
  47. package/dist/@vitest/mocker/{mocker.d-TnKRhz7N.d.ts → mocker.d-QEntlm6J.d.ts} +10 -5
  48. package/dist/@vitest/mocker/node.d.ts +5 -734
  49. package/dist/@vitest/mocker/node.js +29 -587
  50. package/dist/@vitest/mocker/redirect.js +4 -4
  51. package/dist/@vitest/mocker/register.d.ts +3 -3
  52. package/dist/@vitest/mocker/register.js +1 -0
  53. package/dist/@vitest/mocker/transforms.d.ts +6 -0
  54. package/dist/@vitest/mocker/transforms.js +8 -0
  55. package/dist/@vitest/mocker/{types.d-B8CCKmHt.d.ts → types.d-BjI5eAwu.d.ts} +23 -7
  56. package/dist/@vitest/pretty-format/index.d.ts +11 -1
  57. package/dist/@vitest/pretty-format/index.js +33 -4
  58. package/dist/@vitest/runner/chunk-tasks.js +305 -37
  59. package/dist/@vitest/runner/index.d.ts +5 -6
  60. package/dist/@vitest/runner/index.js +1146 -455
  61. package/dist/@vitest/runner/{tasks.d-C7UxawJ9.d.ts → tasks.d-D2GKpdwQ.d.ts} +726 -55
  62. package/dist/@vitest/runner/types.d.ts +2 -182
  63. package/dist/@vitest/runner/utils.d.ts +16 -8
  64. package/dist/@vitest/runner/utils.js +1 -1
  65. package/dist/@vitest/snapshot/{environment.d-DHdQ1Csl.d.ts → environment.d-DOJxxZV9.d.ts} +2 -7
  66. package/dist/@vitest/snapshot/environment.d.ts +2 -1
  67. package/dist/@vitest/snapshot/environment.js +1 -1
  68. package/dist/@vitest/snapshot/index.d.ts +4 -3
  69. package/dist/@vitest/snapshot/index.js +21 -550
  70. package/dist/@vitest/snapshot/manager.d.ts +3 -2
  71. package/dist/@vitest/snapshot/manager.js +1 -1
  72. package/dist/@vitest/snapshot/{rawSnapshot.d-lFsMJFUd.d.ts → rawSnapshot.d-U2kJUxDr.d.ts} +1 -1
  73. package/dist/@vitest/spy/index.d.ts +34 -4
  74. package/dist/@vitest/spy/index.js +69 -19
  75. package/dist/@vitest/utils/diff.js +11 -9
  76. package/dist/@vitest/utils/display.d.ts +2 -1
  77. package/dist/@vitest/utils/display.js +38 -5
  78. package/dist/@vitest/utils/error.d.ts +2 -1
  79. package/dist/@vitest/utils/error.js +1 -2
  80. package/dist/@vitest/utils/helpers.d.ts +4 -1
  81. package/dist/@vitest/utils/helpers.js +43 -1
  82. package/dist/@vitest/utils/resolver.js +1 -2
  83. package/dist/@vitest/utils/serialize.js +6 -6
  84. package/dist/@vitest/utils/source-map/node.d.ts +6 -0
  85. package/dist/@vitest/utils/source-map/node.js +23 -0
  86. package/dist/@vitest/utils/source-map.js +15 -5
  87. package/dist/browser.d.ts +3 -2
  88. package/dist/browser.js +2 -2
  89. package/dist/chunks/acorn.B2iPLyUM.js +5958 -0
  90. package/dist/chunks/{base.CJ0Y4ePK.js → base.DM0-RqVb.js} +54 -16
  91. package/dist/chunks/{benchmark.B3N2zMcH.js → benchmark.D0SlKNbZ.js} +1 -1
  92. package/dist/chunks/{browser.d.ChKACdzH.d.ts → browser.d.X3SXoOCV.d.ts} +4 -1
  93. package/dist/chunks/{cac.DVeoLl0M.js → cac.CWGDZnXT.js} +979 -20
  94. package/dist/chunks/{cli-api.B7PN_QUv.js → cli-api.DuT9iuvY.js} +8764 -7898
  95. package/dist/chunks/{config.d.Cy95HiCx.d.ts → config.d.EJLVE3es.d.ts} +30 -15
  96. package/dist/chunks/{console.Cf-YriPC.js → console.3WNpx0tS.js} +3 -2
  97. package/dist/chunks/{constants.D_Q9UYh-.js → constants.CPYnjOGj.js} +4 -2
  98. package/dist/chunks/coverage.Bri33R1t.js +1050 -0
  99. package/dist/chunks/{creator.DAmOKTvJ.js → creator.DgVhQm5q.js} +35 -4
  100. package/dist/chunks/{defaults.BOqNVLsY.js → defaults.CdU2lD-q.js} +4 -3
  101. package/dist/chunks/{global.d.B15mdLcR.d.ts → global.d.x-ILCfAE.d.ts} +1 -2
  102. package/dist/chunks/{globals.DOayXfHP.js → globals.BXNGLnTL.js} +11 -10
  103. package/dist/chunks/{coverage.AVPTjMgw.js → index.BCY_7LL2.js} +5 -959
  104. package/dist/chunks/{index.C5r1PdPD.js → index.CEzQDJGb.js} +1 -1
  105. package/dist/chunks/{index.D3XRDfWc.js → index.CMESou6r.js} +26 -1
  106. package/dist/chunks/{index.6Qv1eEA6.js → index.DGNSnENe.js} +95 -9
  107. package/dist/chunks/{index.M8mOzt4Y.js → index.DXMFO5MJ.js} +3279 -2914
  108. package/dist/chunks/{index.Z5E_ObnR.js → index.DlDSLQD3.js} +7 -3
  109. package/dist/chunks/{index.CyBMJtT7.js → index.EY6TCHpo.js} +10 -8
  110. package/dist/chunks/{index.D4KonVSU.js → index.og1WyBLx.js} +18 -3
  111. package/dist/chunks/{init-forks._y3TW739.js → init-forks.DeArv0jT.js} +1 -1
  112. package/dist/chunks/{init-threads.DBO2kn-p.js → init-threads.-2OUl4Nn.js} +1 -1
  113. package/dist/chunks/{init.B6MLFIaN.js → init.DICorXCo.js} +52 -13
  114. package/dist/chunks/native.DPzPHdi5.js +148 -0
  115. package/dist/chunks/nativeModuleMocker.DndvSdL6.js +206 -0
  116. package/dist/chunks/nativeModuleRunner.BIakptoF.js +36 -0
  117. package/dist/chunks/{node.Ce0vMQM7.js → node.COQbm6gK.js} +1 -1
  118. package/dist/chunks/{plugin.d.CtqpEehP.d.ts → plugin.d.BuW-flqo.d.ts} +1 -1
  119. package/dist/chunks/{reporters.d.CWXNI2jG.d.ts → reporters.d.DVUYHHhe.d.ts} +328 -79
  120. package/dist/chunks/rpc.MzXet3jl.js +144 -0
  121. package/dist/chunks/{rpc.d.RH3apGEf.d.ts → rpc.d.BFMWpdph.d.ts} +10 -2
  122. package/dist/chunks/{setup-common.Cm-kSBVi.js → setup-common.B41N_kPE.js} +3 -3
  123. package/dist/chunks/{startModuleRunner.DEj0jb3e.js → startVitestModuleRunner.C3ZR-4J3.js} +265 -405
  124. package/dist/chunks/{suite.d.BJWk38HB.d.ts → suite.d.udJtyAgw.d.ts} +1 -1
  125. package/dist/chunks/{vi.2VT5v0um.js → test.CTcmp4Su.js} +538 -181
  126. package/dist/chunks/{utils.DvEY5TfP.js → utils.BX5Fg8C4.js} +8 -1
  127. package/dist/chunks/{vm.D3epNOPZ.js → vm.Dh2rTtmP.js} +48 -8
  128. package/dist/chunks/{worker.d.Dyxm8DEL.d.ts → worker.d.B84sVRy0.d.ts} +2 -2
  129. package/dist/cli.js +6 -5
  130. package/dist/client/.vite/manifest.json +6 -6
  131. package/dist/client/__vitest__/assets/index-Da0hb3oU.css +1 -0
  132. package/dist/client/__vitest__/assets/index-Di71CKDo.js +63 -0
  133. package/dist/client/__vitest__/favicon.ico +0 -0
  134. package/dist/client/__vitest__/favicon.svg +49 -4
  135. package/dist/client/__vitest__/index.html +2 -2
  136. package/dist/client/__vitest_browser__/{orchestrator-S_3e_uzt.js → orchestrator-CXs6qrFe.js} +70 -28
  137. package/dist/client/__vitest_browser__/{tester-k74mgIRa.js → tester-K5NNxh1O.js} +167 -58
  138. package/dist/client/__vitest_browser__/{utils-uxqdqUz8.js → utils-C2ISqq1C.js} +2 -2
  139. package/dist/client/favicon.svg +49 -4
  140. package/dist/client/orchestrator.html +2 -2
  141. package/dist/client/tester/tester.html +2 -2
  142. package/dist/client.js +20 -13
  143. package/dist/config.cjs +3 -2
  144. package/dist/config.d.ts +13 -12
  145. package/dist/config.js +2 -2
  146. package/dist/context.js +108 -22
  147. package/dist/coverage.d.ts +12 -8
  148. package/dist/coverage.js +8 -5
  149. package/dist/environments.js +3 -1
  150. package/dist/expect-element.js +23 -23
  151. package/dist/index-5Pe7X7sp.js +7 -0
  152. package/dist/index.d.ts +66 -27
  153. package/dist/index.js +10 -9
  154. package/dist/locators.d.ts +14 -3
  155. package/dist/locators.js +1 -1
  156. package/dist/module-evaluator.d.ts +11 -1
  157. package/dist/module-evaluator.js +43 -26
  158. package/dist/node.d.ts +28 -14
  159. package/dist/node.js +42 -40
  160. package/dist/nodejs-worker-loader.js +41 -0
  161. package/dist/plugins/mocker-transforms.mjs +2 -0
  162. package/dist/plugins/utils-source-map-node.mjs +2 -0
  163. package/dist/reporters.d.ts +8 -8
  164. package/dist/reporters.js +7 -5
  165. package/dist/runners.d.ts +24 -5
  166. package/dist/runners.js +6 -6
  167. package/dist/runtime.d.ts +6 -0
  168. package/dist/runtime.js +35 -0
  169. package/dist/snapshot.js +4 -2
  170. package/dist/suite.d.ts +1 -1
  171. package/dist/suite.js +4 -2
  172. package/dist/vendor/blazediff_core.d.mts +1 -0
  173. package/dist/vendor/blazediff_core.mjs +117 -0
  174. package/dist/vendor/chai.mjs +4 -249
  175. package/dist/vendor/convert-source-map.d.mts +1 -0
  176. package/dist/vendor/convert-source-map.mjs +150 -0
  177. package/dist/vendor/expect-type.d.mts +14 -7
  178. package/dist/vendor/expect-type.mjs +5 -5
  179. package/dist/vendor/std-env.d.mts +131 -40
  180. package/dist/vendor/std-env.mjs +114 -117
  181. package/dist/worker.d.ts +6 -6
  182. package/dist/worker.js +27 -21
  183. package/dist/workers/forks.js +23 -17
  184. package/dist/workers/runVmTests.js +18 -16
  185. package/dist/workers/threads.js +23 -17
  186. package/dist/workers/vmForks.js +15 -12
  187. package/dist/workers/vmThreads.js +15 -12
  188. package/globals.d.ts +2 -0
  189. package/package.json +35 -26
  190. package/suppress-warnings.cjs +1 -0
  191. package/dist/@vitest/browser/client/__vitest__/assets/index-BUCFJtth.js +0 -57
  192. package/dist/@vitest/browser/client/__vitest__/assets/index-DlhE0rqZ.css +0 -1
  193. package/dist/@vitest/browser/index-D6m36C6U.js +0 -11
  194. package/dist/@vitest/utils/chunk-_commonjsHelpers.js +0 -5
  195. package/dist/@vitest/utils/highlight.d.ts +0 -9
  196. package/dist/@vitest/utils/highlight.js +0 -538
  197. package/dist/chunks/date.Bq6ZW5rf.js +0 -73
  198. package/dist/chunks/rpc.BoxB0q7B.js +0 -76
  199. package/dist/chunks/test.B8ej_ZHS.js +0 -254
  200. package/dist/client/__vitest__/assets/index-BUCFJtth.js +0 -57
  201. package/dist/client/__vitest__/assets/index-DlhE0rqZ.css +0 -1
  202. package/dist/index-D6m36C6U.js +0 -6
  203. package/dist/mocker.d.ts +0 -1
  204. package/dist/mocker.js +0 -1
  205. package/dist/module-runner.js +0 -17
@@ -1,27 +1,27 @@
1
- import { TaskMeta, Suite, File, TestAnnotation, TestArtifact, ImportDuration, Test, Task, TaskResultPack, FileSpecification, CancelReason, SequenceSetupFiles, SequenceHooks } from '../@vitest/runner/index.js';
1
+ import { TaskMeta, Suite, File, SerializableRetry, TestAnnotation, TestArtifact, ImportDuration, Test, Task, TaskResultPack, FileSpecification, CancelReason, SequenceSetupFiles, SequenceHooks, TestTagDefinition } from '../@vitest/runner/index.js';
2
2
  import { TestError, SerializedError, Arrayable, ParsedStack, Awaitable } from '../@vitest/utils/index.js';
3
- import { A as AfterSuiteRunMeta, U as UserConsoleLog, P as ProvidedContext, L as LabelColor } from './rpc.d.RH3apGEf.js';
3
+ import { A as AfterSuiteRunMeta, U as UserConsoleLog, b as AsyncLeak, P as ProvidedContext, L as LabelColor } from './rpc.d.BFMWpdph.js';
4
4
  import { Writable } from 'node:stream';
5
5
  import { DevEnvironment, TransformResult as TransformResult$1, ViteDevServer, Plugin, UserConfig as UserConfig$1, DepOptimizationConfig, ServerOptions, ConfigEnv, AliasOptions } from '@voidzero-dev/vite-plus-core';
6
- import { S as SerializedTestSpecification, c as SourceModuleDiagnostic, B as BrowserTesterOptions } from './browser.d.ChKACdzH.js';
7
- import { MockedModule } from '../@vitest/mocker/index.js';
8
- import { StackTraceParserOptions } from '../@vitest/utils/source-map.js';
9
- import { BrowserCommands } from '../@vitest/browser/index.js';
10
- import { B as BrowserTraceViewMode, S as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.Cy95HiCx.js';
6
+ import { S as SerializedTestSpecification, c as SourceModuleDiagnostic, B as BrowserTesterOptions } from './browser.d.X3SXoOCV.js';
7
+ import { B as BrowserTraceViewMode, S as SerializedConfig, F as FakeTimerInstallOpts } from './config.d.EJLVE3es.js';
11
8
  import { PrettyFormatOptions } from '../@vitest/pretty-format/index.js';
12
9
  import { SnapshotSummary, SnapshotStateOptions } from '../@vitest/snapshot/index.js';
13
10
  import { SerializedDiffOptions } from '../@vitest/utils/diff.js';
14
11
  import { chai } from '../@vitest/expect/index.js';
15
12
  import { happyDomTypes, jsdomTypes } from 'vitest/optional-types.js';
16
- import { c as ContextTestEnvironment, d as WorkerExecuteContext, e as WorkerTestEnvironment } from './worker.d.Dyxm8DEL.js';
13
+ import { c as ContextTestEnvironment, d as WorkerExecuteContext, e as WorkerTestEnvironment } from './worker.d.B84sVRy0.js';
17
14
  import { O as OTELCarrier } from './traces.d.402V_yFI.js';
18
15
  import { B as BenchmarkResult } from './benchmark.d.DAaHLpsq.js';
16
+ import { MockedModule } from '../@vitest/mocker/index.js';
17
+ import { StackTraceParserOptions } from '../@vitest/utils/source-map.js';
18
+ import { CDPSession, BrowserCommands } from '../@vitest/browser/index.js';
19
19
  import { a as RuntimeCoverageProviderModule } from './coverage.d.BZtK59WP.js';
20
20
  import { SnapshotManager } from '../@vitest/snapshot/manager.js';
21
21
  import { Console } from 'node:console';
22
22
  import { Stats } from 'node:fs';
23
23
 
24
- type ChaiConfig = Omit<Partial<typeof chai.config>, "useProxy" | "proxyExcludedKeys">;
24
+ type ChaiConfig = Omit<Partial<typeof chai.config>, "useProxy" | "proxyExcludedKeys" | "deepEqual">;
25
25
 
26
26
  type HappyDOMOptions = Omit<NonNullable<ConstructorParameters<typeof happyDomTypes.Window>[0]>, "console">;
27
27
 
@@ -72,6 +72,52 @@ interface ConstructorOptionsOverride {
72
72
  resources?: "usable";
73
73
  }
74
74
 
75
+ interface TestSpecificationOptions {
76
+ testNamePattern?: RegExp;
77
+ testIds?: string[];
78
+ testLines?: number[];
79
+ testTagsFilter?: string[];
80
+ }
81
+ declare class TestSpecification {
82
+ /**
83
+ * The task id associated with the test module.
84
+ */
85
+ readonly taskId: string;
86
+ /**
87
+ * The test project that the module belongs to.
88
+ */
89
+ readonly project: TestProject;
90
+ /**
91
+ * The id of the module in the Vite module graph. It is usually an absolute file path.
92
+ */
93
+ readonly moduleId: string;
94
+ /**
95
+ * The current test pool. It's possible to have multiple pools in a single test project with `typecheck.enabled`.
96
+ */
97
+ readonly pool: Pool;
98
+ /**
99
+ * Line numbers of the test locations to run.
100
+ */
101
+ readonly testLines: number[] | undefined;
102
+ /**
103
+ * Regular expression pattern to filter test names.
104
+ */
105
+ readonly testNamePattern: RegExp | undefined;
106
+ /**
107
+ * The ids of tasks inside of this specification to run.
108
+ */
109
+ readonly testIds: string[] | undefined;
110
+ /**
111
+ * The tags of tests to run.
112
+ */
113
+ readonly testTagsFilter: string[] | undefined;
114
+ /**
115
+ * Test module associated with the specification. This will be `undefined` if tests have not been run yet.
116
+ */
117
+ get testModule(): TestModule | undefined;
118
+ toJSON(): SerializedTestSpecification;
119
+ }
120
+
75
121
  declare class ReportedTaskImplementation {
76
122
  /**
77
123
  * The project associated with the test or suite.
@@ -120,6 +166,10 @@ declare class TestCase extends ReportedTaskImplementation {
120
166
  */
121
167
  readonly parent: TestSuite | TestModule;
122
168
  /**
169
+ * Tags associated with the test.
170
+ */
171
+ readonly tags: string[];
172
+ /**
123
173
  * Full name of the test including all parent suites separated with `>`.
124
174
  */
125
175
  get fullName(): string;
@@ -146,6 +196,10 @@ declare class TestCase extends ReportedTaskImplementation {
146
196
  * Diagnostic is only available after the test has finished.
147
197
  */
148
198
  diagnostic(): TestDiagnostic | undefined;
199
+ /**
200
+ * Returns a new test specification that can be used to filter or run this specific test case.
201
+ */
202
+ toTestSpecification(): TestSpecification;
149
203
  }
150
204
  declare class TestCollection {
151
205
  #private;
@@ -231,6 +285,10 @@ declare class TestSuite extends SuiteImplementation {
231
285
  */
232
286
  state(): TestSuiteState;
233
287
  /**
288
+ * Returns a new test specification that can be used to filter or run this specific test suite.
289
+ */
290
+ toTestSpecification(): TestSpecification;
291
+ /**
234
292
  * Full name of the suite including all parent suites separated with `>`.
235
293
  */
236
294
  get fullName(): string;
@@ -255,6 +313,10 @@ declare class TestModule extends SuiteImplementation {
255
313
  */
256
314
  readonly relativeModuleId: string;
257
315
  /**
316
+ * Returns a new test specification that can be used to filter or run this specific test module.
317
+ */
318
+ toTestSpecification(testCases?: TestCase[]): TestSpecification;
319
+ /**
258
320
  * Checks the running state of the test file.
259
321
  */
260
322
  state(): TestModuleState;
@@ -278,8 +340,13 @@ interface TaskOptions {
278
340
  readonly fails: boolean | undefined;
279
341
  readonly concurrent: boolean | undefined;
280
342
  readonly shuffle: boolean | undefined;
281
- readonly retry: number | undefined;
343
+ readonly retry: SerializableRetry | undefined;
282
344
  readonly repeats: number | undefined;
345
+ readonly tags: string[] | undefined;
346
+ /**
347
+ * Only tests have a `timeout` option.
348
+ */
349
+ readonly timeout: number | undefined;
283
350
  readonly mode: "run" | "only" | "skip" | "todo";
284
351
  }
285
352
  type TestSuiteState = "skipped" | "pending" | "failed" | "passed";
@@ -402,36 +469,6 @@ declare function experimental_getRunnerTask(entity: TestSuite): Suite;
402
469
  declare function experimental_getRunnerTask(entity: TestModule): File;
403
470
  declare function experimental_getRunnerTask(entity: TestCase | TestSuite | TestModule): Suite | File | Test;
404
471
 
405
- declare class TestSpecification {
406
- /**
407
- * The task ID associated with the test module.
408
- */
409
- readonly taskId: string;
410
- /**
411
- * The test project that the module belongs to.
412
- */
413
- readonly project: TestProject;
414
- /**
415
- * The ID of the module in the Vite module graph. It is usually an absolute file path.
416
- */
417
- readonly moduleId: string;
418
- /**
419
- * The current test pool. It's possible to have multiple pools in a single test project with `poolMatchGlob` and `typecheck.enabled`.
420
- * @experimental In Vitest 4, the project will only support a single pool and this property will be removed.
421
- */
422
- readonly pool: Pool;
423
- /**
424
- * Line numbers of the test locations to run.
425
- */
426
- readonly testLines: number[] | undefined;
427
- constructor(project: TestProject, moduleId: string, pool: Pool, testLines?: number[] | undefined);
428
- /**
429
- * Test module associated with the specification.
430
- */
431
- get testModule(): TestModule | undefined;
432
- toJSON(): SerializedTestSpecification;
433
- }
434
-
435
472
  interface CoverageSummaryData {
436
473
  lines: Totals;
437
474
  statements: Totals;
@@ -623,7 +660,9 @@ interface CoverageProvider {
623
660
  clean: (clean?: boolean) => void | Promise<void>;
624
661
  /** Called with coverage results after a single test file has been run */
625
662
  onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void | Promise<void>;
626
- /** Callback called when test run fails */
663
+ /** Callback called when test run starts */
664
+ onTestRunStart?: () => void | Promise<void>;
665
+ /** Callback called when test run fails due to test failures */
627
666
  onTestFailure?: () => void | Promise<void>;
628
667
  /** Callback to generate final coverage results */
629
668
  generateCoverage: (reportContext: ReportContext) => CoverageResults | Promise<CoverageResults>;
@@ -673,6 +712,7 @@ type CoverageOptions<T extends CoverageProviderName = CoverageProviderName> = T
673
712
  type FieldsWithDefaultValues = "enabled" | "clean" | "cleanOnRerun" | "reportsDirectory" | "exclude" | "reportOnFailure" | "allowExternal" | "processingConcurrency";
674
713
  type ResolvedCoverageOptions<T extends CoverageProviderName = CoverageProviderName> = CoverageOptions<T> & Required<Pick<CoverageOptions<T>, FieldsWithDefaultValues>> & {
675
714
  reporter: CoverageReporterWithOptions[];
715
+ htmlDir?: string;
676
716
  };
677
717
  interface BaseCoverageOptions {
678
718
  /**
@@ -795,10 +835,23 @@ interface BaseCoverageOptions {
795
835
  * @default []
796
836
  */
797
837
  ignoreClassMethods?: string[];
838
+ /**
839
+ * Directory of HTML coverage output to be served in UI mode and HTML reporter.
840
+ * This is automatically configured for builtin reporter with html output (`html`, `html-spa`, and `lcov` reporters).
841
+ * Use this option to override with custom coverage reporting location.
842
+ */
843
+ htmlDir?: string;
844
+ /**
845
+ * Collect coverage only for files changed since a specified commit or branch.
846
+ * Inherits the default value from `test.changed`.
847
+ *
848
+ * @default false
849
+ */
850
+ changed?: boolean | string;
798
851
  }
799
852
  interface CoverageIstanbulOptions extends BaseCoverageOptions {}
800
853
  interface CoverageV8Options extends BaseCoverageOptions {}
801
- interface CustomProviderOptions extends Pick<BaseCoverageOptions, FieldsWithDefaultValues> {
854
+ interface CustomProviderOptions extends Pick<BaseCoverageOptions, FieldsWithDefaultValues | "changed"> {
802
855
  /** Name of the module or path to a file to load the custom provider from */
803
856
  customProviderModule: string;
804
857
  }
@@ -865,6 +918,8 @@ declare class Logger {
865
918
  deprecate(message: string): void;
866
919
  clearHighlightCache(filename?: string): void;
867
920
  highlight(filename: string, source: string): string;
921
+ printNoTestTagsFound(): void;
922
+ printTags(): void;
868
923
  printNoTestFound(filters?: string[]): void;
869
924
  printBanner(): void;
870
925
  printBrowserBanner(project: TestProject): void;
@@ -931,7 +986,6 @@ interface Reporter {
931
986
  /**
932
987
  * Called when the project initiated the browser instance.
933
988
  * project.browser will always be defined.
934
- * @experimental
935
989
  */
936
990
  onBrowserInit?: (project: TestProject) => Awaitable<void>;
937
991
  onTestRemoved?: (trigger?: string) => Awaitable<void>;
@@ -1029,6 +1083,7 @@ declare class StateManager {
1029
1083
  idMap: Map<string, Task>;
1030
1084
  taskFileMap: WeakMap<Task, File>;
1031
1085
  errorsSet: Set<unknown>;
1086
+ leakSet: Set<AsyncLeak>;
1032
1087
  reportedTasksMap: WeakMap<Task, TestModule | TestCase | TestSuite>;
1033
1088
  blobs?: MergedBlobs;
1034
1089
  transformTime: number;
@@ -1047,6 +1102,7 @@ declare class StateManager {
1047
1102
  onUnhandledError?: OnUnhandledErrorCallback;
1048
1103
  });
1049
1104
  catchError(error: unknown, type: string): void;
1105
+ catchLeaks(leaks: AsyncLeak[]): void;
1050
1106
  clearErrors(): void;
1051
1107
  getUnhandledErrors(): unknown[];
1052
1108
  getPaths(): string[];
@@ -1081,6 +1137,7 @@ declare class VitestWatcher {
1081
1137
  readonly changedTests: Set<string>;
1082
1138
  private readonly _onRerun;
1083
1139
  constructor(vitest: Vitest);
1140
+ close(): void;
1084
1141
  unregisterWatcher: () => void;
1085
1142
  registerWatcher(): this;
1086
1143
  private scheduleRerun;
@@ -1149,7 +1206,6 @@ declare class Vitest {
1149
1206
  private restartsCount;
1150
1207
  private readonly specifications;
1151
1208
  private pool;
1152
- private _config?;
1153
1209
  private _vite?;
1154
1210
  private _state?;
1155
1211
  private _cache?;
@@ -1183,6 +1239,7 @@ declare class Vitest {
1183
1239
  * Test results and test file stats cache. Primarily used by the sequencer to sort tests.
1184
1240
  */
1185
1241
  get cache(): VitestCache;
1242
+ listTags(): Promise<void>;
1186
1243
  enableCoverage(): Promise<void>;
1187
1244
  disableCoverage(): void;
1188
1245
  private clearAllCachePaths;
@@ -1235,7 +1292,10 @@ declare class Vitest {
1235
1292
  * Returns the seed, if tests are running in a random order.
1236
1293
  */
1237
1294
  getSeed(): number | null;
1238
- collect(filters?: string[]): Promise<TestRunResult>;
1295
+ collect(filters?: string[], options?: {
1296
+ staticParse?: boolean;
1297
+ staticParseConcurrency?: number;
1298
+ }): Promise<TestRunResult>;
1239
1299
  /**
1240
1300
  * Returns the list of test files that match the config and filters.
1241
1301
  * @param filters String filters to match the test files
@@ -1278,6 +1338,12 @@ declare class Vitest {
1278
1338
  */
1279
1339
  runTestSpecifications(specifications: TestSpecification[], allTestsRun?: boolean): Promise<TestRunResult>;
1280
1340
  /**
1341
+ * Runs tests for the given file paths. This does not trigger `onWatcher*` events.
1342
+ * @param filepaths A list of file paths to run tests for.
1343
+ * @param allTestsRun Indicates whether all tests were run. This only matters for coverage.
1344
+ */
1345
+ runTestFiles(filepaths: string[], allTestsRun?: boolean): Promise<TestRunResult>;
1346
+ /**
1281
1347
  * Rerun files and trigger `onWatcherRerun`, `onWatcherStart` and `onTestsRerun` events.
1282
1348
  * @param specifications A list of specifications to run.
1283
1349
  * @param allTestsRun Indicates whether all tests were run. This only matters for coverage.
@@ -1390,12 +1456,6 @@ declare class Vitest {
1390
1456
  type OnServerRestartHandler = (reason?: string) => Promise<void> | void;
1391
1457
  type OnTestsRerunHandler = (testFiles: TestSpecification[]) => Promise<void> | void;
1392
1458
 
1393
- interface CDPSession {
1394
- send: (method: string, params?: Record<string, unknown>) => Promise<unknown>;
1395
- on: (event: string, listener: (...args: unknown[]) => void) => void;
1396
- once: (event: string, listener: (...args: unknown[]) => void) => void;
1397
- off: (event: string, listener: (...args: unknown[]) => void) => void;
1398
- }
1399
1459
  interface BrowserModuleMocker {
1400
1460
  register: (sessionId: string, module: MockedModule) => Promise<void>;
1401
1461
  delete: (sessionId: string, url: string) => Promise<void>;
@@ -1428,7 +1488,9 @@ interface BrowserProvider {
1428
1488
  */
1429
1489
  supportsParallelism: boolean;
1430
1490
  getCommandsContext: (sessionId: string) => Record<string, unknown>;
1431
- openPage: (sessionId: string, url: string) => Promise<void>;
1491
+ openPage: (sessionId: string, url: string, options: {
1492
+ parallel: boolean;
1493
+ }) => Promise<void>;
1432
1494
  getCDPSession?: (sessionId: string) => Promise<CDPSession>;
1433
1495
  close: () => Awaitable<void>;
1434
1496
  }
@@ -1503,6 +1565,13 @@ interface BrowserConfigOptions {
1503
1565
  */
1504
1566
  ui?: boolean;
1505
1567
  /**
1568
+ * Default position for the details panel in browser mode
1569
+ * 'right' shows the details panel on the right side (horizontal split)
1570
+ * 'bottom' shows the details panel at the bottom (vertical split)
1571
+ * @default 'right'
1572
+ */
1573
+ detailsPanelPosition?: "right" | "bottom";
1574
+ /**
1506
1575
  * Default viewport size
1507
1576
  */
1508
1577
  viewport?: {
@@ -1597,7 +1666,7 @@ interface BrowserConfigOptions {
1597
1666
  /**
1598
1667
  * Enables tracking uncaught errors and exceptions so they can be reported by Vitest.
1599
1668
  *
1600
- * If you need to hide certain errors, it is recommended to use [`onUnhandledError`](https://vitest.dev/config/#onunhandlederror) option instead.
1669
+ * If you need to hide certain errors, it is recommended to use [`onUnhandledError`](https://vitest.dev/config/onunhandlederror) option instead.
1601
1670
  *
1602
1671
  * Disabling this will completely remove all Vitest error handlers, which can help debugging with the "Pause on exceptions" checkbox turned on.
1603
1672
  * @default true
@@ -1695,6 +1764,7 @@ interface ResolvedBrowserOptions extends BrowserConfigOptions {
1695
1764
  tracesDir?: string;
1696
1765
  screenshots?: boolean;
1697
1766
  snapshots?: boolean;
1767
+ sources?: boolean;
1698
1768
  };
1699
1769
  }
1700
1770
  type ToMatchScreenshotResolvePath = (data: {
@@ -1742,12 +1812,12 @@ type ToMatchScreenshotResolvePath = (data: {
1742
1812
  screenshotDirectory: string;
1743
1813
  /**
1744
1814
  * Absolute path to the project's
1745
- * {@linkcode https://vitest.dev/config/#root|root}.
1815
+ * {@linkcode https://vitest.dev/config/root|root}.
1746
1816
  */
1747
1817
  root: string;
1748
1818
  /**
1749
1819
  * Path to the test file, relative to the project's
1750
- * {@linkcode https://vitest.dev/config/#root|root}.
1820
+ * {@linkcode https://vitest.dev/config/root|root}.
1751
1821
  */
1752
1822
  testFileDirectory: string;
1753
1823
  /**
@@ -1761,7 +1831,7 @@ type ToMatchScreenshotResolvePath = (data: {
1761
1831
  testName: string;
1762
1832
  /**
1763
1833
  * The value provided to
1764
- * {@linkcode https://vitest.dev/config/#attachmentsdir|attachmentsDir},
1834
+ * {@linkcode https://vitest.dev/config/attachmentsdir|attachmentsDir},
1765
1835
  * if none is provided, its default value.
1766
1836
  */
1767
1837
  attachmentsDir: string;
@@ -1825,7 +1895,7 @@ declare class TestProject {
1825
1895
  * Creates a new test specification. Specifications describe how to run tests.
1826
1896
  * @param moduleId The file path
1827
1897
  */
1828
- createSpecification(moduleId: string, locations?: number[] | undefined, pool?: string): TestSpecification;
1898
+ createSpecification(moduleId: string, locationsOrOptions?: number[] | TestSpecificationOptions | undefined, pool?: string): TestSpecification;
1829
1899
  toJSON(): SerializedTestProject;
1830
1900
  /**
1831
1901
  * Vite's dev server instance. Every workspace project has its own server.
@@ -1995,6 +2065,7 @@ type WorkerResponse = {
1995
2065
 
1996
2066
  interface BaseOptions {
1997
2067
  isTTY?: boolean;
2068
+ silent?: boolean | "passed-only";
1998
2069
  }
1999
2070
  declare abstract class BaseReporter implements Reporter {
2000
2071
  start: number;
@@ -2005,6 +2076,7 @@ declare abstract class BaseReporter implements Reporter {
2005
2076
  ctx: Vitest;
2006
2077
  renderSucceed: boolean;
2007
2078
  protected verbose: boolean;
2079
+ protected silent?: boolean | "passed-only";
2008
2080
  private _filesInWatchMode;
2009
2081
  private _timeStart;
2010
2082
  constructor(options?: BaseOptions);
@@ -2017,7 +2089,7 @@ declare abstract class BaseReporter implements Reporter {
2017
2089
  onTestCaseResult(testCase: TestCase): void;
2018
2090
  onTestSuiteResult(testSuite: TestSuite): void;
2019
2091
  onTestModuleEnd(testModule: TestModule): void;
2020
- private logFailedTask;
2092
+ protected logFailedTask(task: Task): void;
2021
2093
  protected printTestModule(testModule: TestModule): void;
2022
2094
  protected printTestCase(moduleState: TestModuleState, test: TestCase): void;
2023
2095
  private getModuleLog;
@@ -2037,11 +2109,12 @@ declare abstract class BaseReporter implements Reporter {
2037
2109
  shouldLog(log: UserConsoleLog, taskState?: TestResult["state"]): boolean;
2038
2110
  onServerRestart(reason?: string): void;
2039
2111
  reportSummary(files: File[], errors: unknown[]): void;
2040
- reportTestSummary(files: File[], errors: unknown[]): void;
2041
- private printImportsBreakdown;
2112
+ reportTestSummary(files: File[], errors: unknown[], leakCount: number): void;
2113
+ private reportImportDurations;
2042
2114
  private importDurationTime;
2043
2115
  private ellipsisPath;
2044
2116
  private printErrorsSummary;
2117
+ private printLeaksSummary;
2045
2118
  reportBenchmarkSummary(files: File[]): void;
2046
2119
  private printTaskErrors;
2047
2120
  }
@@ -2071,10 +2144,58 @@ interface GithubActionsReporterOptions {
2071
2144
  * @default true
2072
2145
  */
2073
2146
  displayAnnotations?: boolean;
2147
+ /**
2148
+ * Configuration for the GitHub Actions Job Summary.
2149
+ *
2150
+ * When enabled, a markdown summary of test results is written to the path specified by `outputPath`.
2151
+ */
2152
+ jobSummary?: Partial<JobSummaryOptions>;
2074
2153
  }
2154
+ interface JobSummaryOptions {
2155
+ /**
2156
+ * Whether to generate the summary.
2157
+ *
2158
+ * @default true
2159
+ */
2160
+ enabled: boolean;
2161
+ /**
2162
+ * File path to write the summary to.
2163
+ *
2164
+ * @default process.env.GITHUB_STEP_SUMMARY
2165
+ */
2166
+ outputPath: string | undefined;
2167
+ /**
2168
+ * Configuration for generating permalink URLs to source files in the GitHub repository.
2169
+ *
2170
+ * When all three values are available (either from this config or the defaults picked from environment variables), test names in the summary will link to the relevant source lines.
2171
+ */
2172
+ fileLinks: {
2173
+ /**
2174
+ * The GitHub repository in `owner/repo` format.
2175
+ *
2176
+ * @default process.env.GITHUB_REPOSITORY
2177
+ */
2178
+ repository?: string | undefined;
2179
+ /**
2180
+ * The commit SHA to use in permalink URLs.
2181
+ *
2182
+ * @default process.env.GITHUB_SHA
2183
+ */
2184
+ commitHash?: string | undefined;
2185
+ /**
2186
+ * The absolute path to the root of the repository on disk.
2187
+ *
2188
+ * This value is used to compute relative file paths for the permalink URLs.
2189
+ *
2190
+ * @default process.env.GITHUB_WORKSPACE
2191
+ */
2192
+ workspacePath?: string | undefined;
2193
+ };
2194
+ }
2195
+ type ResolvedOptions = Required<GithubActionsReporterOptions>;
2075
2196
  declare class GithubActionsReporter implements Reporter {
2076
2197
  ctx: Vitest;
2077
- options: GithubActionsReporterOptions;
2198
+ options: ResolvedOptions;
2078
2199
  constructor(options?: GithubActionsReporterOptions);
2079
2200
  onInit(ctx: Vitest): void;
2080
2201
  onTestCaseAnnotate(testCase: TestCase, annotation: TestAnnotation): void;
@@ -2100,6 +2221,7 @@ interface JsonAssertionResult {
2100
2221
  duration?: Milliseconds | null;
2101
2222
  failureMessages: Array<string> | null;
2102
2223
  location?: Callsite | null;
2224
+ tags: string[];
2103
2225
  }
2104
2226
  interface JsonTestResult {
2105
2227
  message: string;
@@ -2166,6 +2288,10 @@ interface JUnitOptions {
2166
2288
  * @default false
2167
2289
  */
2168
2290
  addFileAttribute?: boolean;
2291
+ /**
2292
+ * Hostname to use in the report. By default, it uses os.hostname()
2293
+ */
2294
+ hostname?: string;
2169
2295
  }
2170
2296
  declare class JUnitReporter implements Reporter {
2171
2297
  private ctx;
@@ -2183,12 +2309,21 @@ declare class JUnitReporter implements Reporter {
2183
2309
  onTestRunEnd(testModules: ReadonlyArray<TestModule>): Promise<void>;
2184
2310
  }
2185
2311
 
2312
+ declare class AgentReporter extends DefaultReporter {
2313
+ renderSucceed: boolean;
2314
+ constructor(options?: DefaultReporterOptions);
2315
+ onTestRunStart(specifications: ReadonlyArray<TestSpecification>): void;
2316
+ protected printTestModule(testModule: TestModule): void;
2317
+ protected printTestCase(moduleState: TestModuleState, test: TestCase): void;
2318
+ }
2319
+
2186
2320
  declare class DotReporter extends BaseReporter {
2187
2321
  private renderer?;
2188
2322
  private tests;
2189
2323
  private finishedTests;
2190
2324
  onInit(ctx: Vitest): void;
2191
2325
  printTestModule(): void;
2326
+ onTestRunStart(_specifications: ReadonlyArray<TestSpecification>): void;
2192
2327
  onWatcherRerun(files: string[], trigger?: string): void;
2193
2328
  onTestRunEnd(testModules: ReadonlyArray<TestModule>, unhandledErrors: ReadonlyArray<SerializedError>, reason: TestRunEndReason): void;
2194
2329
  onTestModuleCollected(module: TestModule): void;
@@ -2267,6 +2402,7 @@ type BenchmarkBuiltinReporters = keyof typeof BenchmarkReportsMap;
2267
2402
 
2268
2403
  declare const ReportersMap: {
2269
2404
  default: typeof DefaultReporter;
2405
+ agent: typeof AgentReporter;
2270
2406
  blob: typeof BlobReporter;
2271
2407
  verbose: typeof VerboseReporter;
2272
2408
  dot: typeof DotReporter;
@@ -2281,6 +2417,7 @@ declare const ReportersMap: {
2281
2417
  type BuiltinReporters = keyof typeof ReportersMap;
2282
2418
  interface BuiltinReporterOptions {
2283
2419
  "default": DefaultReporterOptions;
2420
+ "agent": DefaultReporterOptions;
2284
2421
  "verbose": DefaultReporterOptions;
2285
2422
  "dot": BaseOptions;
2286
2423
  "tree": BaseOptions;
@@ -2325,12 +2462,12 @@ interface BenchmarkUserOptions {
2325
2462
  */
2326
2463
  includeSource?: string[];
2327
2464
  /**
2328
- * Custom reporter for output. Can contain one or more built-in report names, reporter instances,
2329
- * and/or paths to custom reporters
2465
+ * Custom reporters to use for output. Can contain one or more built-in reporter names, reporter instances,
2466
+ * and/or paths to custom reporter files to import.
2330
2467
  *
2331
2468
  * @default ['default']
2332
2469
  */
2333
- reporters?: Arrayable<BenchmarkBuiltinReporters | Reporter>;
2470
+ reporters?: Arrayable<BenchmarkBuiltinReporters | Reporter | (string & {})>;
2334
2471
  /**
2335
2472
  * @deprecated Use `benchmark.outputJson` instead
2336
2473
  */
@@ -2354,7 +2491,22 @@ interface BenchmarkUserOptions {
2354
2491
  type BuiltinEnvironment = "node" | "jsdom" | "happy-dom" | "edge-runtime";
2355
2492
  type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
2356
2493
  type CSSModuleScopeStrategy = "stable" | "scoped" | "non-scoped";
2357
- type ApiConfig = Pick<ServerOptions, "port" | "strictPort" | "host" | "middlewareMode">;
2494
+ type ApiConfig = Pick<ServerOptions, "port" | "strictPort" | "host" | "middlewareMode"> & {
2495
+ /**
2496
+ * Allow any write operations from the API server.
2497
+ *
2498
+ * @default true if `api.host` is exposed to network, false otherwise
2499
+ */
2500
+ allowWrite?: boolean;
2501
+ /**
2502
+ * Allow running test files via the API.
2503
+ * If `api.host` is exposed to network and `allowWrite` is true,
2504
+ * anyone connected to the API server can run arbitrary code on your machine.
2505
+ *
2506
+ * @default true if `api.host` is exposed to network, false otherwise
2507
+ */
2508
+ allowExec?: boolean;
2509
+ };
2358
2510
  interface EnvironmentOptions {
2359
2511
  /**
2360
2512
  * jsdom options.
@@ -2624,7 +2776,7 @@ interface InlineConfig {
2624
2776
  *
2625
2777
  * @default false
2626
2778
  */
2627
- update?: boolean;
2779
+ update?: boolean | "all" | "new" | "none";
2628
2780
  /**
2629
2781
  * Watch mode
2630
2782
  *
@@ -2638,10 +2790,10 @@ interface InlineConfig {
2638
2790
  */
2639
2791
  root?: string;
2640
2792
  /**
2641
- * Custom reporter for output. Can contain one or more built-in report names, reporter instances,
2793
+ * Custom reporter for output. Can contain one or more built-in reporter names, reporter instances,
2642
2794
  * and/or paths to custom reporters.
2643
2795
  *
2644
- * @default []
2796
+ * @default ['default'] (or ['default', 'github-actions'] when `process.env.GITHUB_ACTIONS === 'true'`)
2645
2797
  */
2646
2798
  reporters?: Arrayable<ReporterName | InlineReporter> | ((ReporterName | InlineReporter) | [ReporterName] | ReporterWithOptions)[];
2647
2799
  /**
@@ -2707,7 +2859,7 @@ interface InlineConfig {
2707
2859
  */
2708
2860
  coverage?: CoverageOptions;
2709
2861
  /**
2710
- * run test names with the specified pattern
2862
+ * Run test names with the specified pattern
2711
2863
  */
2712
2864
  testNamePattern?: string | RegExp;
2713
2865
  /**
@@ -2804,6 +2956,12 @@ interface InlineConfig {
2804
2956
  */
2805
2957
  logHeapUsage?: boolean;
2806
2958
  /**
2959
+ * Detect asynchronous resources leaking from the test file.
2960
+ *
2961
+ * @default false
2962
+ */
2963
+ detectAsyncLeaks?: boolean;
2964
+ /**
2807
2965
  * Custom environment variables assigned to `process.env` before running tests.
2808
2966
  */
2809
2967
  env?: Partial<NodeJS.ProcessEnv>;
@@ -2976,11 +3134,17 @@ interface InlineConfig {
2976
3134
  */
2977
3135
  bail?: number;
2978
3136
  /**
2979
- * Retry the test specific number of times if it fails.
3137
+ * Retry configuration for tests.
3138
+ * - If a number, specifies how many times to retry failed tests
3139
+ * - If an object, allows fine-grained retry control
2980
3140
  *
2981
- * @default 0
3141
+ * ⚠️ WARNING: Function form is NOT supported in a config file
3142
+ * because configurations are serialized when passed to worker threads.
3143
+ * Use the function form only in test files directly.
3144
+ *
3145
+ * @default 0 // Don't retry
2982
3146
  */
2983
- retry?: number;
3147
+ retry?: SerializableRetry;
2984
3148
  /**
2985
3149
  * Show full diff when snapshot fails instead of a patch.
2986
3150
  */
@@ -3037,12 +3201,76 @@ interface InlineConfig {
3037
3201
  browserSdkPath?: string;
3038
3202
  };
3039
3203
  /**
3040
- * Show imports (top 10) that take a long time.
3204
+ * Configure import duration collection and display.
3041
3205
  *
3042
- * Enabling this will also show a breakdown by default in UI, but you can always press a button to toggle it.
3206
+ * The `limit` option controls how many imports to collect and display.
3207
+ * The `print` option controls CLI terminal output.
3208
+ * UI can always toggle the breakdown display regardless of `print` setting.
3043
3209
  */
3044
- printImportBreakdown?: boolean;
3210
+ importDurations?: {
3211
+ /**
3212
+ * When to print import breakdown to CLI terminal after tests finish.
3213
+ * - `true`: Always print
3214
+ * - `false`: Never print (default)
3215
+ * - `'on-warn'`: Print only when any import exceeds the warn threshold
3216
+ * @default false
3217
+ */
3218
+ print?: boolean | "on-warn";
3219
+ /**
3220
+ * Maximum number of imports to collect and display.
3221
+ * @default 0 (or 10 if `print` or UI is enabled)
3222
+ */
3223
+ limit?: number;
3224
+ /**
3225
+ * Fail the test run if any import exceeds the danger threshold.
3226
+ * When failing, the breakdown is always printed regardless of `print` setting.
3227
+ * @default false
3228
+ */
3229
+ failOnDanger?: boolean;
3230
+ /**
3231
+ * Duration thresholds in milliseconds for coloring and warnings.
3232
+ */
3233
+ thresholds?: {
3234
+ /**
3235
+ * Warning threshold - imports exceeding this are shown in yellow/orange.
3236
+ * @default 100
3237
+ */
3238
+ warn?: number;
3239
+ /**
3240
+ * Danger threshold - imports exceeding this are shown in red.
3241
+ * @default 500
3242
+ */
3243
+ danger?: number;
3244
+ };
3245
+ };
3246
+ /**
3247
+ * Controls whether Vitest uses Vite's module runner to run the code or fallback to the native `import`.
3248
+ *
3249
+ * If Node.js cannot process the code, consider registering [module loader](https://nodejs.org/api/module.html#customization-hooks) via `execArgv`.
3250
+ * @default true
3251
+ */
3252
+ viteModuleRunner?: boolean;
3253
+ /**
3254
+ * If module runner is disabled, Vitest uses a module loader to transform files to support
3255
+ * `import.meta.vitest` and `vi.mock`.
3256
+ *
3257
+ * If you don't use these features, you can disable this.
3258
+ *
3259
+ * This option only affects `loader.load` method, Vitest always defines a `loader.resolve` to populate the module graph.
3260
+ */
3261
+ nodeLoader?: boolean;
3045
3262
  };
3263
+ /**
3264
+ * Define tags available in your test files.
3265
+ *
3266
+ * If test defines a tag that is not listed here, an error will be thrown.
3267
+ */
3268
+ tags?: TestTagDefinition[];
3269
+ /**
3270
+ * Should Vitest throw an error if test has a tag that is not defined in the config.
3271
+ * @default true
3272
+ */
3273
+ strictTags?: boolean;
3046
3274
  }
3047
3275
  interface TypecheckConfig {
3048
3276
  /**
@@ -3163,11 +3391,20 @@ interface UserConfig extends InlineConfig {
3163
3391
  * @experimental
3164
3392
  */
3165
3393
  clearCache?: boolean;
3394
+ /**
3395
+ * Tags expression to filter tests to run. Multiple filters will be applied using AND logic.
3396
+ * @see {@link https://vitest.dev/guide/test-tags#syntax}
3397
+ */
3398
+ tagsFilter?: string[];
3399
+ /**
3400
+ * Log all available tags instead of running tests.
3401
+ */
3402
+ listTags?: boolean | "json";
3166
3403
  }
3167
3404
  type OnUnhandledErrorCallback = (error: (TestError | Error) & {
3168
3405
  type: string;
3169
3406
  }) => boolean | void;
3170
- interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config" | "filters" | "browser" | "coverage" | "testNamePattern" | "related" | "api" | "reporters" | "resolveSnapshotPath" | "benchmark" | "shard" | "cache" | "sequence" | "typecheck" | "runner" | "pool" | "cliExclude" | "diff" | "setupFiles" | "snapshotEnvironment" | "bail" | "name" | "vmMemoryLimit" | "fileParallelism"> {
3407
+ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config" | "filters" | "browser" | "coverage" | "testNamePattern" | "related" | "api" | "reporters" | "resolveSnapshotPath" | "benchmark" | "shard" | "cache" | "sequence" | "typecheck" | "runner" | "pool" | "cliExclude" | "diff" | "setupFiles" | "snapshotEnvironment" | "bail" | "name" | "vmMemoryLimit" | "fileParallelism" | "tagsFilter"> {
3171
3408
  mode: VitestRunMode;
3172
3409
  name: ProjectName["label"];
3173
3410
  color?: ProjectName["color"];
@@ -3220,8 +3457,20 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, "project" | "config"
3220
3457
  maxWorkers: number;
3221
3458
  vmMemoryLimit?: UserConfig["vmMemoryLimit"];
3222
3459
  dumpDir?: string;
3460
+ tagsFilter?: string[];
3461
+ experimental: Omit<Required<UserConfig>["experimental"], "importDurations"> & {
3462
+ importDurations: {
3463
+ print: boolean | "on-warn";
3464
+ limit: number;
3465
+ failOnDanger: boolean;
3466
+ thresholds: {
3467
+ warn: number;
3468
+ danger: number;
3469
+ };
3470
+ };
3471
+ };
3223
3472
  }
3224
- type NonProjectOptions = "shard" | "watch" | "run" | "cache" | "update" | "reporters" | "outputFile" | "teardownTimeout" | "silent" | "forceRerunTriggers" | "testNamePattern" | "ui" | "open" | "uiBase" | "snapshotFormat" | "resolveSnapshotPath" | "passWithNoTests" | "onConsoleLog" | "onStackTrace" | "dangerouslyIgnoreUnhandledErrors" | "slowTestThreshold" | "inspect" | "inspectBrk" | "coverage" | "watchTriggerPatterns";
3473
+ type NonProjectOptions = "shard" | "watch" | "run" | "cache" | "update" | "reporters" | "outputFile" | "teardownTimeout" | "silent" | "forceRerunTriggers" | "testNamePattern" | "ui" | "open" | "uiBase" | "snapshotFormat" | "resolveSnapshotPath" | "passWithNoTests" | "onConsoleLog" | "onStackTrace" | "dangerouslyIgnoreUnhandledErrors" | "slowTestThreshold" | "inspect" | "inspectBrk" | "coverage" | "watchTriggerPatterns" | "tagsFilter";
3225
3474
  interface ServerDepsOptions {
3226
3475
  /**
3227
3476
  * Externalize means that Vite will bpass the package to native Node.
@@ -3267,5 +3516,5 @@ type TestProjectInlineConfiguration = (UserWorkspaceConfig & {
3267
3516
  });
3268
3517
  type TestProjectConfiguration = string | TestProjectInlineConfiguration | Promise<UserWorkspaceConfig> | UserProjectConfigFn;
3269
3518
 
3270
- export { CoverageMap as C, TestSuite as K, Logger as L, experimental_getRunnerTask as Q, TestProject as T, Vitest as V, BenchmarkReporter as aE, BenchmarkReportsMap as aF, DefaultReporter as aG, DotReporter as aH, GithubActionsReporter as aI, HangingProcessReporter as aJ, JsonReporter as aK, JUnitReporter as aL, ReportersMap as aM, TapFlatReporter as aN, TapReporter as aO, VerboseBenchmarkReporter as aP, VerboseReporter as aQ, BaseReporter as aR, TestSpecification as k, VitestPackageInstaller as p, TestCase as v, TestCollection as w, TestModule as y };
3271
- export type { BrowserCommand as $, ApiConfig as A, TestResult as B, TestResultFailed as D, TestResultPassed as E, TestResultSkipped as F, TestState as G, HTMLOptions as H, InlineConfig as I, JsonOptions as J, ModuleDiagnostic as M, TestSuiteState as N, OnServerRestartHandler as O, PoolWorker as P, ResolvedCoverageOptions as R, SerializedTestProject as S, UserWorkspaceConfig as U, WatcherTriggerPattern as W, TestSequencerConstructor as X, BenchmarkUserOptions as Y, BrowserBuiltinProvider as Z, _BrowserNames as _, ReportContext as a, BrowserCommandContext as a0, BrowserConfigOptions as a1, BrowserInstanceOption as a2, BrowserModuleMocker as a3, BrowserOrchestrator as a4, BrowserProvider as a5, BrowserProviderOption as a6, BrowserScript as a7, BrowserServerFactory as a8, BrowserServerOptions as a9, TestRunResult as aA, ReportedHookContext as aB, Reporter as aC, TestRunEndReason as aD, BenchmarkBuiltinReporters as aS, BuiltinReporterOptions as aT, BuiltinReporters as aU, JsonAssertionResult as aV, JsonTestResult as aW, JsonTestResults as aX, BrowserServerState as aa, BrowserServerStateSession as ab, CDPSession as ac, ParentProjectBrowser as ad, ProjectBrowser as ae, ResolvedBrowserOptions as af, ToMatchScreenshotComparators as ag, ToMatchScreenshotOptions as ah, BuiltinEnvironment as ai, CSSModuleScopeStrategy as aj, DepsOptimizationOptions as ak, EnvironmentOptions as al, Pool as am, ProjectConfig as an, ResolvedProjectConfig as ao, ResolveSnapshotPathHandler as ap, ResolveSnapshotPathHandlerContext as aq, TypecheckConfig as ar, VitestEnvironment as as, BaseCoverageOptions as at, CoverageIstanbulOptions as au, CoverageOptions as av, CoverageProvider as aw, CoverageProviderModule as ax, CoverageReporter as ay, CustomProviderOptions as az, TestProjectConfiguration as b, CoverageV8Options as c, UserProjectConfigFn as d, UserProjectConfigExport as e, UserConfig as f, TestProjectInlineConfiguration as g, ResolvedConfig as h, VitestRunMode as i, VitestOptions as j, PoolOptions as l, WorkerRequest as m, TestSequencer as n, OnTestsRerunHandler as o, PoolRunnerInitializer as q, PoolTask as r, WorkerResponse as s, JUnitOptions as t, TaskOptions as u, TestDiagnostic as x, TestModuleState as z };
3519
+ export { DefaultReporter as $, Logger as L, TestProject as T, Vitest as V, DotReporter as a1, GithubActionsReporter as a3, HangingProcessReporter as a5, JUnitReporter as a7, TestModule as aB, TestSuite as aM, VerboseBenchmarkReporter as aR, VerboseReporter as aS, VitestPackageInstaller as aU, experimental_getRunnerTask as aX, CoverageMap as aY, JsonReporter as aa, ReportersMap as ap, TapFlatReporter as av, TapReporter as aw, TestCase as ay, TestCollection as az, TestSpecification as i, AgentReporter as m, BaseReporter as n, BenchmarkReporter as p, BenchmarkReportsMap as q };
3520
+ export type { ApiConfig as A, BaseCoverageOptions as B, CoverageV8Options as C, BrowserProviderOption as D, BrowserScript as E, BrowserServerFactory as F, BrowserServerOptions as G, BrowserServerState as H, InlineConfig as I, BrowserServerStateSession as J, BuiltinEnvironment as K, BuiltinReporterOptions as M, BuiltinReporters as N, CSSModuleScopeStrategy as O, PoolWorker as P, CoverageIstanbulOptions as Q, ResolvedCoverageOptions as R, CoverageOptions as S, UserWorkspaceConfig as U, WatcherTriggerPattern as W, CoverageProvider as X, CoverageProviderModule as Y, CoverageReporter as Z, CustomProviderOptions as _, TestProjectConfiguration as a, DepsOptimizationOptions as a0, EnvironmentOptions as a2, HTMLOptions as a4, JUnitOptions as a6, JsonAssertionResult as a8, JsonOptions as a9, TestDiagnostic as aA, TestModuleState as aC, TestResult as aD, TestResultFailed as aE, TestResultPassed as aF, TestResultSkipped as aG, TestRunEndReason as aH, TestRunResult as aI, TestSequencerConstructor as aJ, TestSpecificationOptions as aK, TestState as aL, TestSuiteState as aN, ToMatchScreenshotComparators as aO, ToMatchScreenshotOptions as aP, TypecheckConfig as aQ, VitestEnvironment as aT, WorkerResponse as aV, _BrowserNames as aW, JsonTestResult as ab, JsonTestResults as ac, ModuleDiagnostic as ad, OnServerRestartHandler as ae, OnTestsRerunHandler as af, ParentProjectBrowser as ag, Pool as ah, PoolRunnerInitializer as ai, PoolTask as aj, ProjectBrowser as ak, ProjectConfig as al, ReportContext as am, ReportedHookContext as an, Reporter as ao, ResolveSnapshotPathHandler as aq, ResolveSnapshotPathHandlerContext as ar, ResolvedBrowserOptions as as, ResolvedProjectConfig as at, SerializedTestProject as au, TaskOptions as ax, UserProjectConfigFn as b, UserProjectConfigExport as c, TestProjectInlineConfiguration as d, UserConfig as e, ResolvedConfig as f, VitestRunMode as g, VitestOptions as h, PoolOptions as j, WorkerRequest as k, TestSequencer as l, BenchmarkBuiltinReporters as o, BenchmarkUserOptions as r, BrowserBuiltinProvider as s, BrowserCommand as t, BrowserCommandContext as u, BrowserConfigOptions as v, BrowserInstanceOption as w, BrowserModuleMocker as x, BrowserOrchestrator as y, BrowserProvider as z };