@voidzero-dev/vite-plus-test 0.1.8 → 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 +36 -27
  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
package/dist/index.d.ts CHANGED
@@ -1,22 +1,24 @@
1
- import { M as ModuleDefinitionDurationsDiagnostic, U as UntrackedModuleDefinitionDiagnostic, S as SerializedTestSpecification, a as ModuleDefinitionDiagnostic, b as ModuleDefinitionLocation, c as SourceModuleDiagnostic, d as SourceModuleLocations } from './chunks/browser.d.ChKACdzH.js';
2
- export { B as BrowserTesterOptions } from './chunks/browser.d.ChKACdzH.js';
3
- import './chunks/global.d.B15mdLcR.js';
1
+ import { M as ModuleDefinitionDurationsDiagnostic, U as UntrackedModuleDefinitionDiagnostic, S as SerializedTestSpecification, a as ModuleDefinitionDiagnostic, b as ModuleDefinitionLocation, c as SourceModuleDiagnostic, d as SourceModuleLocations } from './chunks/browser.d.X3SXoOCV.js';
2
+ export { B as BrowserTesterOptions } from './chunks/browser.d.X3SXoOCV.js';
3
+ import './chunks/global.d.x-ILCfAE.js';
4
4
  import { File, TestAnnotation, TestArtifact, TaskResultPack, TaskEventPack, Test, TaskPopulated } from './@vitest/runner/index.js';
5
- export { CancelReason, ImportDuration, OnTestFailedHandler, OnTestFinishedHandler, RunMode, 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, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestAnnotation, TestAnnotationArtifact, TestArtifact, TestArtifactBase, TestArtifactLocation, TestArtifactRegistry, TestAttachment, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, recordArtifact, suite, test } from './@vitest/runner/index.js';
5
+ export { CancelReason, ImportDuration, OnTestFailedHandler, OnTestFinishedHandler, RunMode, 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, SuiteOptions, TaskCustomOptions, TaskMeta, TaskState, TestAPI, TestAnnotation, TestAnnotationArtifact, TestArtifact, TestArtifactBase, TestArtifactLocation, TestArtifactRegistry, TestAttachment, TestContext, TestFunction, TestOptions, VitestRunnerConfig as TestRunnerConfig, TestTags, VitestRunner as VitestTestRunner, afterAll, afterEach, aroundAll, aroundEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, recordArtifact, suite, test } from './@vitest/runner/index.js';
6
6
  import { Awaitable } from './@vitest/utils/index.js';
7
7
  export { ParsedStack, SerializedError, TestError } from './@vitest/utils/index.js';
8
- import { b as BirpcReturn } from './chunks/worker.d.Dyxm8DEL.js';
9
- export { C as ContextRPC, c as ContextTestEnvironment, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.Dyxm8DEL.js';
10
- import { S as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.Cy95HiCx.js';
11
- export { b as RuntimeConfig, a as SerializedCoverageConfig } from './chunks/config.d.Cy95HiCx.js';
12
- import { U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, P as ProvidedContext } from './chunks/rpc.d.RH3apGEf.js';
13
- export { A as AfterSuiteRunMeta, a as RunnerRPC, R as RuntimeRPC } from './chunks/rpc.d.RH3apGEf.js';
8
+ import { b as BirpcReturn } from './chunks/worker.d.B84sVRy0.js';
9
+ export { C as ContextRPC, c as ContextTestEnvironment, T as TestExecutionMethod, W as WorkerGlobalState } from './chunks/worker.d.B84sVRy0.js';
10
+ import { S as SerializedConfig, F as FakeTimerInstallOpts, R as RuntimeOptions } from './chunks/config.d.EJLVE3es.js';
11
+ export { b as RuntimeConfig, a as SerializedCoverageConfig } from './chunks/config.d.EJLVE3es.js';
12
+ import { U as UserConsoleLog, L as LabelColor, M as ModuleGraphData, P as ProvidedContext } from './chunks/rpc.d.BFMWpdph.js';
13
+ export { A as AfterSuiteRunMeta, a as RunnerRPC, R as RuntimeRPC } from './chunks/rpc.d.BFMWpdph.js';
14
14
  import { ExpectStatic } from './@vitest/expect/index.js';
15
- export { Assertion, AsymmetricMatchersContaining, DeeplyAllowMatchers, ExpectPollOptions, ExpectStatic, JestAssertion, Matchers, chai } from './@vitest/expect/index.js';
15
+ export { Assertion, AsymmetricMatchersContaining, DeeplyAllowMatchers, ExpectPollOptions, ExpectStatic, JestAssertion, RawMatcherFn as Matcher, ExpectationResult as MatcherResult, MatcherState, Matchers, chai } from './@vitest/expect/index.js';
16
16
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from './@vitest/spy/index.js';
17
17
  export { Mock, MockContext, MockInstance, MockResult, MockResultIncomplete, MockResultReturn, MockResultThrow, MockSettledResult, MockSettledResultFulfilled, MockSettledResultIncomplete, MockSettledResultRejected, Mocked, MockedClass, MockedFunction, MockedObject } from './@vitest/spy/index.js';
18
- export { b as bench } from './chunks/suite.d.BJWk38HB.js';
18
+ import { ModuleMockFactoryWithHelper, ModuleMockOptions } from './@vitest/mocker/index.js';
19
+ export { b as bench } from './chunks/suite.d.udJtyAgw.js';
19
20
  export { V as EvaluatedModules } from './chunks/evaluatedModules.d.BxJ5omdx.js';
21
+ export { NodeBenchmarkRunner as BenchmarkRunner, VitestTestRunner as TestRunner } from './runners.js';
20
22
  export { a as BenchFunction, b as Benchmark, c as BenchmarkAPI, B as BenchmarkResult } from './chunks/benchmark.d.DAaHLpsq.js';
21
23
  export { ExpectTypeOf, expectTypeOf } from './vendor/expect-type.mjs';
22
24
  export { SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotSerializer, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, UncheckedSnapshot } from './@vitest/snapshot/index.js';
@@ -55,7 +57,6 @@ interface TransformResultWithSource {
55
57
  untrackedModules?: UntrackedModuleDefinitionDiagnostic[];
56
58
  }
57
59
  interface WebSocketHandlers {
58
- onTaskUpdate: (packs: TaskResultPack[], events: TaskEventPack[]) => void;
59
60
  getFiles: () => File[];
60
61
  getTestFiles: () => Promise<SerializedTestSpecification[]>;
61
62
  getPaths: () => string[];
@@ -98,12 +99,6 @@ declare const should: () => Chai.Should;
98
99
  */
99
100
  declare function inject<T extends keyof ProvidedContext & string>(key: T): ProvidedContext[T];
100
101
 
101
- type Promisable<T> = T | Promise<T>;
102
- type MockFactoryWithHelper<M = unknown> = (importOriginal: <T extends M = M>() => Promise<T>) => Promisable<Partial<M>>;
103
- interface MockOptions {
104
- spy?: boolean;
105
- }
106
-
107
102
  type WaitForCallback<T> = () => T | Promise<T>;
108
103
  interface WaitForOptions {
109
104
  /**
@@ -149,12 +144,12 @@ interface VitestUtils {
149
144
  runOnlyPendingTimersAsync: () => Promise<VitestUtils>;
150
145
  /**
151
146
  * This method will invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimers` will be fired.
152
- * If you have an infinite interval, it will throw after 10,000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/#faketimers-looplimit)).
147
+ * If you have an infinite interval, it will throw after 10,000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/faketimers#faketimers-looplimit)).
153
148
  */
154
149
  runAllTimers: () => VitestUtils;
155
150
  /**
156
151
  * This method will asynchronously invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimersAsync` will be fired even asynchronous timers.
157
- * If you have an infinite interval, it will throw after 10 000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/#faketimers-looplimit)).
152
+ * If you have an infinite interval, it will throw after 10 000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/faketimers#faketimers-looplimit)).
158
153
  */
159
154
  runAllTimersAsync: () => Promise<VitestUtils>;
160
155
  /**
@@ -203,6 +198,15 @@ interface VitestUtils {
203
198
  */
204
199
  clearAllTimers: () => VitestUtils;
205
200
  /**
201
+ * Controls how fake timers are advanced.
202
+ * @param mode The mode to use for advancing timers.
203
+ * - `manual`: The default behavior. Timers will only advance when you call one of `vi.advanceTimers...()` methods.
204
+ * - `nextTimerAsync`: Timers will be advanced automatically to the next available timer after each macrotask.
205
+ * - `interval`: Timers are advanced automatically by a specified interval.
206
+ * @param interval The interval in milliseconds to use when `mode` is `'interval'`.
207
+ */
208
+ setTimerTickMode: ((mode: "manual" | "nextTimerAsync") => VitestUtils) & ((mode: "interval", interval?: number) => VitestUtils);
209
+ /**
206
210
  * Creates a spy on a method or getter/setter of an object similar to [`vi.fn()`](https://vitest.dev/api/vi#vi-fn). It returns a [mock function](https://vitest.dev/api/mock).
207
211
  * @example
208
212
  * ```ts
@@ -261,6 +265,39 @@ interface VitestUtils {
261
265
  */
262
266
  waitFor: typeof waitFor;
263
267
  /**
268
+ * Wraps a function to create an assertion helper. When an assertion fails inside the helper,
269
+ * the error stack trace will point to where the helper was called, not inside the helper itself.
270
+ * Works with both synchronous and asynchronous functions, and supports `expect.soft()`.
271
+ *
272
+ * @example
273
+ * ```ts
274
+ * const myEqual = vi.defineHelper((x, y) => {
275
+ * expect(x).toEqual(y)
276
+ * })
277
+ *
278
+ * test('example', () => {
279
+ * myEqual('left', 'right') // Error points to this line
280
+ * })
281
+ * ```
282
+ * Example output:
283
+ * ```
284
+ * FAIL example.test.ts > example
285
+ * AssertionError: expected 'left' to deeply equal 'right'
286
+ *
287
+ * Expected: "right"
288
+ * Received: "left"
289
+ *
290
+ * ❯ example.test.ts:6:3
291
+ * 4| test('example', () => {
292
+ * 5| myEqual('left', 'right')
293
+ * | ^
294
+ * 6| })
295
+ * ```
296
+ * @param fn The assertion function to wrap
297
+ * @returns A wrapped function with the same signature
298
+ */
299
+ defineHelper: <F extends (...args: any) => any>(fn: F) => F;
300
+ /**
264
301
  * This is similar to [`vi.waitFor`](https://vitest.dev/api/vi#vi-waitfor), but if the callback throws any errors, execution is immediately interrupted and an error message is received.
265
302
  *
266
303
  * If the callback returns a falsy value, the next check will continue until a truthy value is returned. This is useful when you need to wait for something to exist before taking the next step.
@@ -296,8 +333,8 @@ interface VitestUtils {
296
333
  * @param path Path to the module. Can be aliased, if your Vitest config supports it
297
334
  * @param factory Mocked module factory. The result of this function will be an exports object
298
335
  */
299
- mock(path: string, factory?: MockFactoryWithHelper | MockOptions): void;
300
- mock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T> | MockOptions): void;
336
+ mock(path: string, factory?: ModuleMockFactoryWithHelper | ModuleMockOptions): void;
337
+ mock<T>(module: Promise<T>, factory?: ModuleMockFactoryWithHelper<T> | ModuleMockOptions): void;
301
338
  /**
302
339
  * Removes module from mocked registry. All calls to import will return the original module even if it was mocked before.
303
340
  *
@@ -314,9 +351,11 @@ interface VitestUtils {
314
351
  * Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking/modules).
315
352
  * @param path Path to the module. Can be aliased, if your Vitest config supports it
316
353
  * @param factory Mocked module factory. The result of this function will be an exports object
354
+ *
355
+ * @returns A disposable object that calls {@link doUnmock()} when disposed
317
356
  */
318
- doMock(path: string, factory?: MockFactoryWithHelper | MockOptions): void;
319
- doMock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T> | MockOptions): void;
357
+ doMock(path: string, factory?: ModuleMockFactoryWithHelper | ModuleMockOptions): Disposable;
358
+ doMock<T>(module: Promise<T>, factory?: ModuleMockFactoryWithHelper<T> | ModuleMockOptions): Disposable;
320
359
  /**
321
360
  * Removes module from mocked registry. All subsequent calls to import will return original module.
322
361
  *
@@ -387,12 +426,12 @@ interface VitestUtils {
387
426
  * @param value - The object to be mocked
388
427
  * @returns A deeply mocked version of the input object
389
428
  */
390
- mockObject: <T>(value: T, options?: MockOptions) => MaybeMockedDeep<T>;
429
+ mockObject: <T>(value: T, options?: ModuleMockOptions) => MaybeMockedDeep<T>;
391
430
  /**
392
431
  * Type helper for TypeScript. Just returns the object that was passed.
393
432
  *
394
433
  * When `partial` is `true` it will expect a `Partial<T>` as a return value. By default, this will only make TypeScript believe that
395
- * the first level values are mocked. You can pass down `{ deep: true }` as a second argument to tell TypeScript that the whole object is mocked, if it actually is.
434
+ * the first level values are mocked. You can pass down `{ partial: true, deep: true }` to make nested objects also partial recursively.
396
435
  * @example
397
436
  * ```ts
398
437
  * import example from './example.js'
package/dist/index.js CHANGED
@@ -1,19 +1,20 @@
1
- export { b as assert, c as createExpect, g as expect, i as inject, s as should, v as vi, d as vitest } from './chunks/vi.2VT5v0um.js';
2
- export { b as bench } from './chunks/benchmark.B3N2zMcH.js';
1
+ export { N as BenchmarkRunner, T as TestRunner, a as assert, c as createExpect, g as expect, i as inject, s as should, v as vi, b as vitest } from './chunks/test.CTcmp4Su.js';
2
+ export { b as bench } from './chunks/benchmark.D0SlKNbZ.js';
3
3
  export { V as EvaluatedModules } from './chunks/evaluatedModules.Dg1zASAC.js';
4
- export { a as assertType } from './chunks/index.Z5E_ObnR.js';
4
+ export { a as assertType } from './chunks/index.DlDSLQD3.js';
5
5
  export { expectTypeOf } from './vendor/expect-type.mjs';
6
- export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, recordArtifact, suite, test } from './@vitest/runner/index.js';
6
+ export { afterAll, afterEach, aroundAll, aroundEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, recordArtifact, suite, test } from './@vitest/runner/index.js';
7
7
  export { chai } from './@vitest/expect/index.js';
8
- import './chunks/utils.DvEY5TfP.js';
8
+ import './@vitest/utils/helpers.js';
9
9
  import './@vitest/utils/timers.js';
10
+ import './chunks/utils.BX5Fg8C4.js';
10
11
  import './@vitest/runner/utils.js';
11
- import './@vitest/snapshot/index.js';
12
12
  import './@vitest/utils/error.js';
13
- import './@vitest/utils/helpers.js';
13
+ import './vendor/pathe.mjs';
14
+ import './@vitest/snapshot/index.js';
14
15
  import './@vitest/spy/index.js';
15
16
  import './@vitest/utils/offset.js';
16
17
  import './@vitest/utils/source-map.js';
17
18
  import './chunks/_commonjsHelpers.D26ty3Ew.js';
18
- import './chunks/date.Bq6ZW5rf.js';
19
- import './vendor/pathe.mjs';
19
+ import './chunks/rpc.MzXet3jl.js';
20
+ import './chunks/index.Chj8NDwU.js';
@@ -1,4 +1,4 @@
1
- import { UserEventClickOptions, UserEventClearOptions, UserEventHoverOptions, UserEventFillOptions, UserEventUploadOptions, UserEventDragAndDropOptions, UserEventSelectOptions, LocatorScreenshotOptions, LocatorByRoleOptions, LocatorOptions } from 'vitest/browser';
1
+ import { UserEventClickOptions, UserEventWheelOptions, UserEventClearOptions, UserEventHoverOptions, UserEventFillOptions, UserEventUploadOptions, UserEventDragAndDropOptions, UserEventSelectOptions, LocatorScreenshotOptions, MarkOptions, LocatorByRoleOptions, LocatorOptions, SelectorOptions } from 'vitest/browser';
2
2
 
3
3
  type ClauseCombinator = '' | '>' | '+' | '~' | '>=';
4
4
  type CSSFunctionArgument = CSSComplexSelector | number | string;
@@ -299,19 +299,23 @@ interface SelectorEngine {
299
299
  declare function convertElementToCssSelector(element: Element): string;
300
300
  declare function processTimeoutOptions<T extends {
301
301
  timeout?: number;
302
- }>(options_?: T): T | undefined;
302
+ }>(options_: T | undefined): T | undefined;
303
303
  declare function getIframeScale(): number;
304
304
 
305
+ declare function ensureAwaited<T>(promise: (error?: Error) => Promise<T>): Promise<T>;
306
+
305
307
  declare const selectorEngine: Ivya;
306
308
  declare abstract class Locator {
307
309
  abstract selector: string;
308
310
  private _parsedSelector;
309
311
  protected _container?: Element | undefined;
310
312
  protected _pwSelector?: string | undefined;
313
+ protected _errorSource?: Error;
311
314
  constructor();
312
315
  click(options?: UserEventClickOptions): Promise<void>;
313
316
  dblClick(options?: UserEventClickOptions): Promise<void>;
314
317
  tripleClick(options?: UserEventClickOptions): Promise<void>;
318
+ wheel(options: UserEventWheelOptions): Promise<void>;
315
319
  clear(options?: UserEventClearOptions): Promise<void>;
316
320
  hover(options?: UserEventHoverOptions): Promise<void>;
317
321
  unhover(options?: UserEventHoverOptions): Promise<void>;
@@ -326,6 +330,7 @@ declare abstract class Locator {
326
330
  base64: string;
327
331
  }>;
328
332
  screenshot(options?: LocatorScreenshotOptions): Promise<string>;
333
+ mark(name: string, options?: MarkOptions): Promise<void>;
329
334
  protected abstract locator(selector: string): Locator;
330
335
  protected abstract elementLocator(element: Element): Locator;
331
336
  getByRole(role: string, options?: LocatorByRoleOptions): Locator;
@@ -348,7 +353,13 @@ declare abstract class Locator {
348
353
  last(): Locator;
349
354
  toString(): string;
350
355
  toJSON(): string;
356
+ findElement(options_?: SelectorOptions): Promise<HTMLElement | SVGElement>;
351
357
  protected triggerCommand<T>(command: string, ...args: any[]): Promise<T>;
352
358
  }
359
+ declare function triggerCommandWithTrace<T>(options: {
360
+ name: string;
361
+ arguments: unknown[];
362
+ errorSource?: Error | undefined;
363
+ }): Promise<T>;
353
364
 
354
- export { Locator, convertElementToCssSelector, getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector, getIframeScale, processTimeoutOptions, selectorEngine };
365
+ export { Locator, convertElementToCssSelector, ensureAwaited, getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector, getIframeScale, processTimeoutOptions, selectorEngine, triggerCommandWithTrace };
package/dist/locators.js CHANGED
@@ -1 +1 @@
1
- export{L as Locator,n as convertElementToCssSelector,q as getByAltTextSelector,r as getByLabelSelector,t as getByPlaceholderSelector,u as getByRoleSelector,v as getByTestIdSelector,w as getByTextSelector,x as getByTitleSelector,o as getIframeScale,p as processTimeoutOptions,s as selectorEngine}from"./index-D6m36C6U.js";import"vitest/browser";import"vitest/internal/browser";
1
+ export{L as Locator,o as convertElementToCssSelector,q as ensureAwaited,r as getByAltTextSelector,s as getByLabelSelector,t as getByPlaceholderSelector,u as getByRoleSelector,v as getByTestIdSelector,w as getByTextSelector,x as getByTitleSelector,y as getIframeScale,p as processTimeoutOptions,z as selectorEngine,A as triggerCommandWithTrace}from"./index-5Pe7X7sp.js";import"vitest/browser";import"vitest/internal/browser";
@@ -1,7 +1,7 @@
1
1
  import { ModuleEvaluator, ModuleRunnerImportMeta, ModuleRunnerContext, EvaluatedModuleNode } from '@voidzero-dev/vite-plus-core/module-runner';
2
2
  import { V as VitestEvaluatedModules } from './chunks/evaluatedModules.d.BxJ5omdx.js';
3
3
  import vm from 'node:vm';
4
- import { R as RuntimeRPC } from './chunks/rpc.d.RH3apGEf.js';
4
+ import { R as RuntimeRPC } from './chunks/rpc.d.BFMWpdph.js';
5
5
  import './@vitest/runner/index.js';
6
6
  import './@vitest/snapshot/index.js';
7
7
  import './chunks/traces.d.402V_yFI.js';
@@ -82,6 +82,15 @@ declare module "vite/module-runner" {
82
82
  }
83
83
  }
84
84
 
85
+ declare module "vite/module-runner" {
86
+ interface EvaluatedModuleNode {
87
+ /**
88
+ * @internal
89
+ */
90
+ mockedExports?: Record<string, any>;
91
+ }
92
+ }
93
+
85
94
  interface VitestVmOptions {
86
95
  context: vm.Context;
87
96
  externalModulesExecutor: ExternalModulesExecutor;
@@ -110,6 +119,7 @@ declare class VitestModuleEvaluator implements ModuleEvaluator {
110
119
  private convertIdToImportUrl;
111
120
  runExternalModule(id: string): Promise<any>;
112
121
  runInlinedModule(context: ModuleRunnerContext, code: string, module: Readonly<EvaluatedModuleNode>): Promise<any>;
122
+ private _createCJSGlobals;
113
123
  private _runInlinedModule;
114
124
  private createRequire;
115
125
  private shouldInterop;
@@ -106,8 +106,7 @@ class VitestModuleEvaluator {
106
106
  async runInlinedModule(context, code, module) {
107
107
  return this._otel.$("vitest.module.inline", (span) => this._runInlinedModule(context, code, module, span));
108
108
  }
109
- async _runInlinedModule(context, code, module, span) {
110
- context.__vite_ssr_import_meta__.env = this.env;
109
+ _createCJSGlobals(context, module, span) {
111
110
  const { Reflect, Proxy, Object } = this.primitives;
112
111
  const exportsObject = context[ssrModuleExportsKey];
113
112
  const SYMBOL_NOT_DEFINED = Symbol("not defined");
@@ -143,46 +142,57 @@ class VitestModuleEvaluator {
143
142
  return true;
144
143
  }
145
144
  });
146
- const moduleProxy = {
147
- set exports(value) {
148
- span.addEvent("`module.exports` is assigned directly, copying all properties to `exports`");
149
- exportAll(cjsExports, value);
150
- exportsObject.default = value;
151
- moduleExports = value;
145
+ return {
146
+ exports: cjsExports,
147
+ module: {
148
+ set exports(value) {
149
+ span.addEvent("`module.exports` is assigned directly, copying all properties to `exports`");
150
+ exportAll(cjsExports, value);
151
+ exportsObject.default = value;
152
+ moduleExports = value;
153
+ },
154
+ get exports() {
155
+ return cjsExports;
156
+ }
152
157
  },
153
- get exports() {
154
- return cjsExports;
155
- }
158
+ require: this.createRequire(context[ssrImportMetaKey].url),
159
+ __filename: context[ssrImportMetaKey].filename,
160
+ __dirname: context[ssrImportMetaKey].dirname
156
161
  };
162
+ }
163
+ async _runInlinedModule(context, code, module, span) {
157
164
  const meta = context[ssrImportMetaKey];
165
+ meta.env = this.env;
158
166
  if (this.options.getCurrentTestFilepath?.() === module.file) {
159
167
  const globalNamespace = this.vm?.context || globalThis;
160
168
  Object.defineProperty(meta, "vitest", { get: () => globalNamespace.__vitest_index__ });
161
169
  }
162
- const filename = meta.filename;
163
- const dirname = meta.dirname;
164
- span.setAttributes({ "code.file.path": filename });
165
- const require = this.createRequire(meta.url);
170
+ span.setAttribute("code.file.path", meta.filename);
166
171
  const argumentsList = [
167
172
  ssrModuleExportsKey,
168
173
  ssrImportMetaKey,
169
174
  ssrImportKey,
170
175
  ssrDynamicImportKey,
171
176
  ssrExportAllKey,
172
- "__vite_ssr_exportName__",
177
+ "__vite_ssr_exportName__"
178
+ ];
179
+ const cjsGlobals = this._createCJSGlobals(context, module, span);
180
+ argumentsList.push(
181
+ // TODO@discuss deprecate in Vitest 5, remove in Vitest 6(?)
182
+ // backwards compat for vite-node
173
183
  "__filename",
174
184
  "__dirname",
175
185
  "module",
176
186
  "exports",
177
187
  "require"
178
- ];
188
+ );
179
189
  if (this.compiledFunctionArgumentsNames) argumentsList.push(...this.compiledFunctionArgumentsNames);
180
190
  span.setAttribute("vitest.module.arguments", argumentsList);
181
191
  // add 'use strict' since ESM enables it by default
182
192
  const codeDefinition = `'use strict';async (${argumentsList.join(",")})=>{{`;
183
193
  const wrappedCode = `${codeDefinition}${code}\n}}`;
184
194
  const options = {
185
- filename: module.id,
195
+ filename: module.id.startsWith("mock:") ? module.id.slice(5) : module.id,
186
196
  lineOffset: 0,
187
197
  columnOffset: -codeDefinition.length
188
198
  };
@@ -200,16 +210,16 @@ class VitestModuleEvaluator {
200
210
  context[ssrDynamicImportKey],
201
211
  context[ssrExportAllKey],
202
212
  // vite 7 support, remove when vite 7+ is supported
203
- context.__vite_ssr_exportName__ || ((name, getter) => Object.defineProperty(exportsObject, name, {
213
+ context.__vite_ssr_exportName__ || ((name, getter) => Object.defineProperty(context[ssrModuleExportsKey], name, {
204
214
  enumerable: true,
205
215
  configurable: true,
206
216
  get: getter
207
217
  })),
208
- filename,
209
- dirname,
210
- moduleProxy,
211
- cjsExports,
212
- require,
218
+ cjsGlobals.__filename,
219
+ cjsGlobals.__dirname,
220
+ cjsGlobals.module,
221
+ cjsGlobals.exports,
222
+ cjsGlobals.require,
213
223
  ...this.compiledFunctionArgumentsValues
214
224
  );
215
225
  } finally {
@@ -218,8 +228,15 @@ class VitestModuleEvaluator {
218
228
  this.options.moduleExecutionInfo?.set(options.filename, finishModuleExecutionInfo());
219
229
  }
220
230
  }
221
- createRequire(filename) {
222
- return this.vm ? this.vm.externalModulesExecutor.createRequire(filename) : createRequire(filename);
231
+ createRequire(url) {
232
+ if (url.startsWith("data:")) {
233
+ const _require = (id) => {
234
+ throw new SyntaxError(`require() is not supported in virtual modules. Trying to call require("${id}") in ${url}`);
235
+ };
236
+ _require.resolve = _require;
237
+ return _require;
238
+ }
239
+ return this.vm ? this.vm.externalModulesExecutor.createRequire(url) : createRequire(url);
223
240
  }
224
241
  shouldInterop(path, mod) {
225
242
  if (this.options.interopDefault === false) return false;
package/dist/node.d.ts CHANGED
@@ -3,25 +3,24 @@ import { InlineConfig, UserConfig as UserConfig$1, Plugin, ResolvedConfig as Res
3
3
  export { vite as Vite };
4
4
  export { esbuildVersion, isCSSRequest, isFileLoadingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from '@voidzero-dev/vite-plus-core';
5
5
  import { IncomingMessage } from 'node:http';
6
- import { h as ResolvedConfig, f as UserConfig, i as VitestRunMode, j as VitestOptions, V as Vitest, A as ApiConfig, k as TestSpecification, T as TestProject, P as PoolWorker, l as PoolOptions, m as WorkerRequest, n as TestSequencer, L as Logger } from './chunks/reporters.d.CWXNI2jG.js';
7
- export { at as BaseCoverageOptions, Y as BenchmarkUserOptions, Z as BrowserBuiltinProvider, $ as BrowserCommand, a0 as BrowserCommandContext, a1 as BrowserConfigOptions, a2 as BrowserInstanceOption, a3 as BrowserModuleMocker, a4 as BrowserOrchestrator, a5 as BrowserProvider, a6 as BrowserProviderOption, a7 as BrowserScript, a8 as BrowserServerFactory, a9 as BrowserServerOptions, aa as BrowserServerState, ab as BrowserServerStateSession, ai as BuiltinEnvironment, ac as CDPSession, aj as CSSModuleScopeStrategy, au as CoverageIstanbulOptions, av as CoverageOptions, aw as CoverageProvider, ax as CoverageProviderModule, ay as CoverageReporter, c as CoverageV8Options, az as CustomProviderOptions, ak as DepsOptimizationOptions, al as EnvironmentOptions, H as HTMLOptions, I as InlineConfig, t as JUnitOptions, J as JsonOptions, M as ModuleDiagnostic, O as OnServerRestartHandler, o as OnTestsRerunHandler, ad as ParentProjectBrowser, am as Pool, q as PoolRunnerInitializer, r as PoolTask, ae as ProjectBrowser, an as ProjectConfig, a as ReportContext, aB as ReportedHookContext, aC as Reporter, ap as ResolveSnapshotPathHandler, aq as ResolveSnapshotPathHandlerContext, af as ResolvedBrowserOptions, R as ResolvedCoverageOptions, ao as ResolvedProjectConfig, S as SerializedTestProject, u as TaskOptions, v as TestCase, w as TestCollection, x as TestDiagnostic, y as TestModule, z as TestModuleState, B as TestResult, D as TestResultFailed, E as TestResultPassed, F as TestResultSkipped, aD as TestRunEndReason, aA as TestRunResult, X as TestSequencerConstructor, G as TestState, K as TestSuite, N as TestSuiteState, ag as ToMatchScreenshotComparators, ah as ToMatchScreenshotOptions, ar as TypecheckConfig, U as UserWorkspaceConfig, as as VitestEnvironment, p as VitestPackageInstaller, W as WatcherTriggerPattern, s as WorkerResponse, _ as _BrowserNames, Q as experimental_getRunnerTask } from './chunks/reporters.d.CWXNI2jG.js';
8
- export { C as CacheKeyIdGenerator, a as CacheKeyIdGeneratorContext, V as VitestPluginContext } from './chunks/plugin.d.CtqpEehP.js';
6
+ import { f as ResolvedConfig, e as UserConfig, g as VitestRunMode, h as VitestOptions, V as Vitest, A as ApiConfig, L as Logger, i as TestSpecification, T as TestProject, P as PoolWorker, j as PoolOptions, k as WorkerRequest, l as TestSequencer } from './chunks/reporters.d.DVUYHHhe.js';
7
+ export { m as AgentReporter, B as BaseCoverageOptions, n as BaseReporter, o as BenchmarkBuiltinReporters, p as BenchmarkReporter, q as BenchmarkReportsMap, r as BenchmarkUserOptions, s as BrowserBuiltinProvider, t as BrowserCommand, u as BrowserCommandContext, v as BrowserConfigOptions, w as BrowserInstanceOption, x as BrowserModuleMocker, y as BrowserOrchestrator, z as BrowserProvider, D as BrowserProviderOption, E as BrowserScript, F as BrowserServerFactory, G as BrowserServerOptions, H as BrowserServerState, J as BrowserServerStateSession, K as BuiltinEnvironment, M as BuiltinReporterOptions, N as BuiltinReporters, O as CSSModuleScopeStrategy, Q as CoverageIstanbulOptions, S as CoverageOptions, X as CoverageProvider, Y as CoverageProviderModule, Z as CoverageReporter, C as CoverageV8Options, _ as CustomProviderOptions, $ as DefaultReporter, a0 as DepsOptimizationOptions, a1 as DotReporter, a2 as EnvironmentOptions, a3 as GithubActionsReporter, a4 as HTMLOptions, a5 as HangingProcessReporter, I as InlineConfig, a6 as JUnitOptions, a7 as JUnitReporter, a8 as JsonAssertionResult, a9 as JsonOptions, aa as JsonReporter, ab as JsonTestResult, ac as JsonTestResults, ad as ModuleDiagnostic, ae as OnServerRestartHandler, af as OnTestsRerunHandler, ag as ParentProjectBrowser, ah as Pool, ai as PoolRunnerInitializer, aj as PoolTask, ak as ProjectBrowser, al as ProjectConfig, am as ReportContext, an as ReportedHookContext, ao as Reporter, ap as ReportersMap, aq as ResolveSnapshotPathHandler, ar as ResolveSnapshotPathHandlerContext, as as ResolvedBrowserOptions, R as ResolvedCoverageOptions, at as ResolvedProjectConfig, au as SerializedTestProject, av as TapFlatReporter, aw as TapReporter, ax as TaskOptions, ay as TestCase, az as TestCollection, aA as TestDiagnostic, aB as TestModule, aC as TestModuleState, aD as TestResult, aE as TestResultFailed, aF as TestResultPassed, aG as TestResultSkipped, aH as TestRunEndReason, aI as TestRunResult, aJ as TestSequencerConstructor, aK as TestSpecificationOptions, aL as TestState, aM as TestSuite, aN as TestSuiteState, aO as ToMatchScreenshotComparators, aP as ToMatchScreenshotOptions, aQ as TypecheckConfig, U as UserWorkspaceConfig, aR as VerboseBenchmarkReporter, aS as VerboseReporter, aT as VitestEnvironment, aU as VitestPackageInstaller, W as WatcherTriggerPattern, aV as WorkerResponse, aW as _BrowserNames, aX as experimental_getRunnerTask } from './chunks/reporters.d.DVUYHHhe.js';
8
+ export { C as CacheKeyIdGenerator, a as CacheKeyIdGeneratorContext, V as VitestPluginContext } from './chunks/plugin.d.BuW-flqo.js';
9
+ export { BaseCoverageProvider } from './coverage.js';
9
10
  import { Awaitable } from './@vitest/utils/index.js';
10
11
  export { SerializedError } from './@vitest/utils/index.js';
11
- import { R as RuntimeRPC } from './chunks/rpc.d.RH3apGEf.js';
12
+ import { R as RuntimeRPC } from './chunks/rpc.d.BFMWpdph.js';
12
13
  import { Writable } from 'node:stream';
13
- import { C as ContextRPC } from './chunks/worker.d.Dyxm8DEL.js';
14
- export { T as TestExecutionType } from './chunks/worker.d.Dyxm8DEL.js';
14
+ import { C as ContextRPC } from './chunks/worker.d.B84sVRy0.js';
15
+ export { T as TestExecutionType } from './chunks/worker.d.B84sVRy0.js';
15
16
  import { Debugger } from './vendor/obug.mjs';
16
- import './chunks/global.d.B15mdLcR.js';
17
+ import './chunks/global.d.x-ILCfAE.js';
17
18
  export { Task as RunnerTask, TaskResult as RunnerTaskResult, TaskResultPack as RunnerTaskResultPack, Test as RunnerTestCase, File as RunnerTestFile, Suite as RunnerTestSuite, SequenceHooks, SequenceSetupFiles } from './@vitest/runner/index.js';
18
- export { b as RuntimeConfig } from './chunks/config.d.Cy95HiCx.js';
19
+ export { b as RuntimeConfig } from './chunks/config.d.EJLVE3es.js';
19
20
  export { generateFileHash } from './@vitest/runner/utils.js';
20
- import './chunks/browser.d.ChKACdzH.js';
21
+ export { CDPSession } from './@vitest/browser/index.js';
22
+ import './chunks/browser.d.X3SXoOCV.js';
21
23
  import './chunks/traces.d.402V_yFI.js';
22
- import './@vitest/mocker/index.js';
23
- import './@vitest/utils/source-map.js';
24
- import './@vitest/browser/index.js';
25
24
  import './@vitest/pretty-format/index.js';
26
25
  import './@vitest/snapshot/index.js';
27
26
  import './@vitest/utils/diff.js';
@@ -29,6 +28,8 @@ import './@vitest/expect/index.js';
29
28
  import 'vitest/optional-types.js';
30
29
  import './chunks/benchmark.d.DAaHLpsq.js';
31
30
  import './vendor/tinybench.mjs';
31
+ import './@vitest/mocker/index.js';
32
+ import './@vitest/utils/source-map.js';
32
33
  import './chunks/coverage.d.BZtK59WP.js';
33
34
  import './@vitest/snapshot/manager.js';
34
35
  import 'node:console';
@@ -82,7 +83,17 @@ interface CliOptions extends UserConfig {
82
83
  */
83
84
  filesOnly?: boolean;
84
85
  /**
85
- * Override vite config's configLoader from cli.
86
+ * Parse files statically instead of running them to collect tests
87
+ * @experimental
88
+ */
89
+ staticParse?: boolean;
90
+ /**
91
+ * How many tests to process at the same time
92
+ * @experimental
93
+ */
94
+ staticParseConcurrency?: number;
95
+ /**
96
+ * Override vite config's configLoader from CLI.
86
97
  * Use `bundle` to bundle the config with esbuild or `runner` (experimental) to process it on the fly (default: `bundle`).
87
98
  * This is only available with **vite version 6.1.0** and above.
88
99
  * @experimental
@@ -106,7 +117,10 @@ declare function parseCLI(argv: string | string[], config?: CliParseOptions): {
106
117
  options: CliOptions;
107
118
  };
108
119
 
109
- declare function resolveApiServerConfig<Options extends ApiConfig & Omit<UserConfig, "expect">>(options: Options, defaultPort: number): ApiConfig | undefined;
120
+ /**
121
+ * @deprecated Internal function
122
+ */
123
+ declare function resolveApiServerConfig<Options extends ApiConfig & Omit<UserConfig, "expect">>(options: Options, defaultPort: number, parentApi?: ApiConfig, logger?: Logger): ApiConfig | undefined;
110
124
 
111
125
  declare function createVitest(mode: VitestRunMode, options: CliOptions, viteOverrides?: UserConfig$1, vitestOptions?: VitestOptions): Promise<Vitest>;
112
126
 
package/dist/node.js CHANGED
@@ -1,37 +1,53 @@
1
1
  import * as vite from '@voidzero-dev/vite-plus-core';
2
2
  import { resolveConfig as resolveConfig$1, mergeConfig } from '@voidzero-dev/vite-plus-core';
3
3
  export { esbuildVersion, isCSSRequest, isFileLoadingAllowed, parseAst, parseAstAsync, rollupVersion, version as viteVersion } from '@voidzero-dev/vite-plus-core';
4
- import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.B7PN_QUv.js';
5
- export { f as ForksPoolWorker, G as GitNotFoundError, F as TestsNotFoundError, T as ThreadsPoolWorker, h as TypecheckPoolWorker, b as VitestPackageInstaller, j as VmForksPoolWorker, k as VmThreadsPoolWorker, p as createDebugger, d as createMethodsRPC, o as createViteLogger, c as createVitest, e as escapeTestName, l as experimental_getRunnerTask, g as getFilePoolName, n as isFileServingAllowed, i as isValidApiRequest, m as registerConsoleShortcuts, r as resolveFsAllow, s as startVitest } from './chunks/cli-api.B7PN_QUv.js';
6
- export { p as parseCLI } from './chunks/cac.DVeoLl0M.js';
7
- import { r as resolveConfig$2 } from './chunks/coverage.AVPTjMgw.js';
8
- export { b as BaseSequencer, a as resolveApiServerConfig } from './chunks/coverage.AVPTjMgw.js';
4
+ import { V as Vitest, a as VitestPlugin } from './chunks/cli-api.DuT9iuvY.js';
5
+ export { F as ForksPoolWorker, G as GitNotFoundError, b as TestsNotFoundError, T as ThreadsPoolWorker, c as TypecheckPoolWorker, d as VitestPackageInstaller, e as VmForksPoolWorker, f as VmThreadsPoolWorker, g as createDebugger, h as createMethodsRPC, i as createViteLogger, j as createVitest, k as escapeTestName, l as experimental_getRunnerTask, m as getFilePoolName, n as isFileServingAllowed, o as isValidApiRequest, r as registerConsoleShortcuts, p as resolveFsAllow, s as startVitest } from './chunks/cli-api.DuT9iuvY.js';
6
+ export { p as parseCLI } from './chunks/cac.CWGDZnXT.js';
7
+ import { r as resolveConfig$2 } from './chunks/coverage.Bri33R1t.js';
8
+ export { B as BaseCoverageProvider, a as BaseSequencer, b as resolveApiServerConfig } from './chunks/coverage.Bri33R1t.js';
9
9
  import { slash, deepClone } from './@vitest/utils/helpers.js';
10
- import { a as any } from './chunks/index.D4KonVSU.js';
10
+ import { a as any } from './chunks/index.og1WyBLx.js';
11
11
  import { resolve } from './vendor/pathe.mjs';
12
- import { c as configFiles } from './chunks/constants.D_Q9UYh-.js';
12
+ import { c as configFiles } from './chunks/constants.CPYnjOGj.js';
13
+ export { A as AgentReporter, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, J as JUnitReporter, b as JsonReporter, R as ReportersMap, T as TapFlatReporter, c as TapReporter, V as VerboseReporter } from './chunks/index.DXMFO5MJ.js';
13
14
  export { distDir, rootDir } from './path.js';
14
15
  export { generateFileHash } from './@vitest/runner/utils.js';
16
+ export { B as BenchmarkReporter, a as BenchmarkReportsMap, V as VerboseBenchmarkReporter } from './chunks/index.CEzQDJGb.js';
15
17
  import 'node:fs';
16
18
  import './chunks/coverage.D_JHT54q.js';
17
19
  import 'node:path';
20
+ import './chunks/index.BCY_7LL2.js';
21
+ import 'node:module';
22
+ import 'node:process';
23
+ import 'node:fs/promises';
24
+ import 'node:url';
25
+ import 'node:assert';
26
+ import 'node:v8';
27
+ import 'node:util';
18
28
  import 'node:os';
19
29
  import './@vitest/snapshot/manager.js';
20
- import 'node:perf_hooks';
21
- import './chunks/index.Chj8NDwU.js';
22
- import './chunks/index.M8mOzt4Y.js';
23
- import 'node:fs/promises';
24
- import './@vitest/utils/source-map.js';
30
+ import './@vitest/utils/serialize.js';
31
+ import './chunks/nativeModuleRunner.BIakptoF.js';
32
+ import '@voidzero-dev/vite-plus-core/module-runner';
33
+ import './chunks/traces.CCmnQaNT.js';
34
+ import './vendor/obug.mjs';
25
35
  import './vendor/tinyrainbow.mjs';
36
+ import '#module-evaluator';
37
+ import 'node:console';
38
+ import './chunks/_commonjsHelpers.D26ty3Ew.js';
26
39
  import './chunks/env.D4Lgay0q.js';
27
40
  import './vendor/std-env.mjs';
28
- import 'node:util';
29
- import 'node:console';
30
- import 'node:stream';
31
- import './@vitest/utils/display.js';
32
- import './vendor/tinyexec.mjs';
33
- import './@vitest/utils/offset.js';
34
- import 'node:module';
41
+ import 'node:tty';
42
+ import 'node:crypto';
43
+ import 'node:events';
44
+ import './chunks/index.Chj8NDwU.js';
45
+ import './chunks/modules.BJuCwlRJ.js';
46
+ import 'node:child_process';
47
+ import 'node:worker_threads';
48
+ import './vendor/picomatch.mjs';
49
+ import './vendor/tinyglobby.mjs';
50
+ import 'node:perf_hooks';
35
51
  import 'events';
36
52
  import 'https';
37
53
  import 'http';
@@ -42,34 +58,20 @@ import 'stream';
42
58
  import 'url';
43
59
  import 'zlib';
44
60
  import 'buffer';
45
- import './chunks/_commonjsHelpers.D26ty3Ew.js';
46
- import 'node:crypto';
47
- import './chunks/traces.CCmnQaNT.js';
48
- import './vendor/obug.mjs';
49
- import '#module-evaluator';
50
- import '@voidzero-dev/vite-plus-core/module-runner';
51
- import './@vitest/utils/highlight.js';
52
- import 'node:url';
53
- import 'node:tty';
54
- import 'node:events';
55
- import './chunks/modules.BJuCwlRJ.js';
56
- import 'node:child_process';
57
- import 'node:worker_threads';
58
- import './vendor/picomatch.mjs';
59
- import './vendor/tinyglobby.mjs';
61
+ import './chunks/defaults.CdU2lD-q.js';
60
62
  import './vendor/magic-string.mjs';
61
63
  import './@vitest/mocker/node.js';
62
- import './chunks/defaults.BOqNVLsY.js';
63
64
  import './@vitest/utils/constants.js';
64
65
  import './@vitest/utils/resolver.js';
65
66
  import './vendor/es-module-lexer.mjs';
66
- import './chunks/index.C5r1PdPD.js';
67
- import 'node:assert';
68
- import './@vitest/utils/serialize.js';
67
+ import './@vitest/utils/source-map.js';
68
+ import './@vitest/utils/source-map/node.js';
69
69
  import 'node:readline';
70
- import 'node:process';
71
- import 'node:v8';
72
70
  import 'readline';
71
+ import 'node:stream';
72
+ import './@vitest/utils/display.js';
73
+ import './vendor/tinyexec.mjs';
74
+ import './@vitest/utils/offset.js';
73
75
 
74
76
  // this is only exported as a public function and not used inside vitest
75
77
  async function resolveConfig(options = {}, viteOverrides = {}) {