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

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 (206) 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} +168 -59
  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 +23 -6
  24. package/dist/@vitest/browser-playwright/index.js +169 -61
  25. package/dist/@vitest/browser-playwright/locators.js +1 -1
  26. package/dist/@vitest/browser-preview/index.d.ts +14 -1
  27. package/dist/@vitest/browser-preview/locators.js +32 -20
  28. package/dist/@vitest/browser-webdriverio/index.d.ts +17 -3
  29. package/dist/@vitest/browser-webdriverio/index.js +22 -2
  30. package/dist/@vitest/browser-webdriverio/locators.js +85 -9
  31. package/dist/@vitest/expect/index.d.ts +172 -54
  32. package/dist/@vitest/expect/index.js +124 -67
  33. package/dist/@vitest/mocker/auto-register.js +1 -0
  34. package/dist/@vitest/mocker/automock.d.ts +1 -0
  35. package/dist/@vitest/mocker/automock.js +5 -0
  36. package/dist/@vitest/mocker/browser.d.ts +4 -4
  37. package/dist/@vitest/mocker/browser.js +1 -0
  38. package/dist/@vitest/mocker/chunk-automock.js +182 -14
  39. package/dist/@vitest/mocker/chunk-helpers.js +44 -0
  40. package/dist/@vitest/mocker/chunk-hoistMocks.js +659 -0
  41. package/dist/@vitest/mocker/chunk-mocker.js +41 -30
  42. package/dist/@vitest/mocker/chunk-registry.js +21 -7
  43. package/dist/@vitest/mocker/chunk-utils.js +18 -7
  44. package/dist/@vitest/mocker/hoistMocks.d-w2ILr1dG.d.ts +739 -0
  45. package/dist/@vitest/mocker/{index.d-C-sLYZi-.d.ts → index.d-B41z0AuW.d.ts} +1 -1
  46. package/dist/@vitest/mocker/index.d.ts +2 -2
  47. package/dist/@vitest/mocker/index.js +18 -3
  48. package/dist/@vitest/mocker/{mocker.d-TnKRhz7N.d.ts → mocker.d-QEntlm6J.d.ts} +10 -5
  49. package/dist/@vitest/mocker/node.d.ts +5 -734
  50. package/dist/@vitest/mocker/node.js +29 -587
  51. package/dist/@vitest/mocker/redirect.js +4 -4
  52. package/dist/@vitest/mocker/register.d.ts +3 -3
  53. package/dist/@vitest/mocker/register.js +1 -0
  54. package/dist/@vitest/mocker/transforms.d.ts +6 -0
  55. package/dist/@vitest/mocker/transforms.js +8 -0
  56. package/dist/@vitest/mocker/{types.d-B8CCKmHt.d.ts → types.d-BjI5eAwu.d.ts} +23 -7
  57. package/dist/@vitest/pretty-format/index.d.ts +11 -1
  58. package/dist/@vitest/pretty-format/index.js +33 -4
  59. package/dist/@vitest/runner/chunk-tasks.js +305 -37
  60. package/dist/@vitest/runner/index.d.ts +5 -6
  61. package/dist/@vitest/runner/index.js +1146 -455
  62. package/dist/@vitest/runner/{tasks.d-C7UxawJ9.d.ts → tasks.d-D2GKpdwQ.d.ts} +726 -55
  63. package/dist/@vitest/runner/types.d.ts +2 -182
  64. package/dist/@vitest/runner/utils.d.ts +16 -8
  65. package/dist/@vitest/runner/utils.js +1 -1
  66. package/dist/@vitest/snapshot/{environment.d-DHdQ1Csl.d.ts → environment.d-DOJxxZV9.d.ts} +2 -7
  67. package/dist/@vitest/snapshot/environment.d.ts +2 -1
  68. package/dist/@vitest/snapshot/environment.js +1 -1
  69. package/dist/@vitest/snapshot/index.d.ts +4 -3
  70. package/dist/@vitest/snapshot/index.js +21 -550
  71. package/dist/@vitest/snapshot/manager.d.ts +3 -2
  72. package/dist/@vitest/snapshot/manager.js +1 -1
  73. package/dist/@vitest/snapshot/{rawSnapshot.d-lFsMJFUd.d.ts → rawSnapshot.d-U2kJUxDr.d.ts} +1 -1
  74. package/dist/@vitest/spy/index.d.ts +34 -4
  75. package/dist/@vitest/spy/index.js +69 -19
  76. package/dist/@vitest/utils/diff.js +11 -9
  77. package/dist/@vitest/utils/display.d.ts +2 -1
  78. package/dist/@vitest/utils/display.js +38 -5
  79. package/dist/@vitest/utils/error.d.ts +2 -1
  80. package/dist/@vitest/utils/error.js +1 -2
  81. package/dist/@vitest/utils/helpers.d.ts +4 -1
  82. package/dist/@vitest/utils/helpers.js +43 -1
  83. package/dist/@vitest/utils/resolver.js +1 -2
  84. package/dist/@vitest/utils/serialize.js +6 -6
  85. package/dist/@vitest/utils/source-map/node.d.ts +6 -0
  86. package/dist/@vitest/utils/source-map/node.js +23 -0
  87. package/dist/@vitest/utils/source-map.js +15 -5
  88. package/dist/browser.d.ts +3 -2
  89. package/dist/browser.js +2 -2
  90. package/dist/chunks/acorn.B2iPLyUM.js +5958 -0
  91. package/dist/chunks/{base.CJ0Y4ePK.js → base.DM0-RqVb.js} +54 -16
  92. package/dist/chunks/{benchmark.B3N2zMcH.js → benchmark.D0SlKNbZ.js} +1 -1
  93. package/dist/chunks/{browser.d.ChKACdzH.d.ts → browser.d.X3SXoOCV.d.ts} +4 -1
  94. package/dist/chunks/{cac.DVeoLl0M.js → cac.CWGDZnXT.js} +979 -20
  95. package/dist/chunks/{cli-api.B7PN_QUv.js → cli-api.DuT9iuvY.js} +8764 -7898
  96. package/dist/chunks/{config.d.Cy95HiCx.d.ts → config.d.EJLVE3es.d.ts} +30 -15
  97. package/dist/chunks/{console.Cf-YriPC.js → console.3WNpx0tS.js} +3 -2
  98. package/dist/chunks/{constants.D_Q9UYh-.js → constants.CPYnjOGj.js} +4 -2
  99. package/dist/chunks/coverage.Bri33R1t.js +1050 -0
  100. package/dist/chunks/{creator.DAmOKTvJ.js → creator.DgVhQm5q.js} +35 -4
  101. package/dist/chunks/{defaults.BOqNVLsY.js → defaults.CdU2lD-q.js} +4 -3
  102. package/dist/chunks/{global.d.B15mdLcR.d.ts → global.d.x-ILCfAE.d.ts} +1 -2
  103. package/dist/chunks/{globals.DOayXfHP.js → globals.BXNGLnTL.js} +11 -10
  104. package/dist/chunks/{coverage.AVPTjMgw.js → index.BCY_7LL2.js} +5 -959
  105. package/dist/chunks/{index.C5r1PdPD.js → index.CEzQDJGb.js} +1 -1
  106. package/dist/chunks/{index.D3XRDfWc.js → index.CMESou6r.js} +26 -1
  107. package/dist/chunks/{index.6Qv1eEA6.js → index.DGNSnENe.js} +95 -9
  108. package/dist/chunks/{index.M8mOzt4Y.js → index.DXMFO5MJ.js} +3279 -2914
  109. package/dist/chunks/{index.Z5E_ObnR.js → index.DlDSLQD3.js} +7 -3
  110. package/dist/chunks/{index.CyBMJtT7.js → index.EY6TCHpo.js} +10 -8
  111. package/dist/chunks/{index.D4KonVSU.js → index.og1WyBLx.js} +18 -3
  112. package/dist/chunks/{init-forks._y3TW739.js → init-forks.DeArv0jT.js} +1 -1
  113. package/dist/chunks/{init-threads.DBO2kn-p.js → init-threads.-2OUl4Nn.js} +1 -1
  114. package/dist/chunks/{init.B6MLFIaN.js → init.DICorXCo.js} +52 -13
  115. package/dist/chunks/native.DPzPHdi5.js +148 -0
  116. package/dist/chunks/nativeModuleMocker.DndvSdL6.js +206 -0
  117. package/dist/chunks/nativeModuleRunner.BIakptoF.js +36 -0
  118. package/dist/chunks/{node.Ce0vMQM7.js → node.COQbm6gK.js} +1 -1
  119. package/dist/chunks/{plugin.d.CtqpEehP.d.ts → plugin.d.BuW-flqo.d.ts} +1 -1
  120. package/dist/chunks/{reporters.d.CWXNI2jG.d.ts → reporters.d.DVUYHHhe.d.ts} +328 -79
  121. package/dist/chunks/rpc.MzXet3jl.js +144 -0
  122. package/dist/chunks/{rpc.d.RH3apGEf.d.ts → rpc.d.BFMWpdph.d.ts} +10 -2
  123. package/dist/chunks/{setup-common.Cm-kSBVi.js → setup-common.B41N_kPE.js} +3 -3
  124. package/dist/chunks/{startModuleRunner.DEj0jb3e.js → startVitestModuleRunner.C3ZR-4J3.js} +265 -405
  125. package/dist/chunks/{suite.d.BJWk38HB.d.ts → suite.d.udJtyAgw.d.ts} +1 -1
  126. package/dist/chunks/{vi.2VT5v0um.js → test.CTcmp4Su.js} +538 -181
  127. package/dist/chunks/{utils.DvEY5TfP.js → utils.BX5Fg8C4.js} +8 -1
  128. package/dist/chunks/{vm.D3epNOPZ.js → vm.Dh2rTtmP.js} +48 -8
  129. package/dist/chunks/{worker.d.Dyxm8DEL.d.ts → worker.d.B84sVRy0.d.ts} +2 -2
  130. package/dist/cli.js +6 -5
  131. package/dist/client/.vite/manifest.json +6 -6
  132. package/dist/client/__vitest__/assets/index-Da0hb3oU.css +1 -0
  133. package/dist/client/__vitest__/assets/index-Di71CKDo.js +63 -0
  134. package/dist/client/__vitest__/favicon.ico +0 -0
  135. package/dist/client/__vitest__/favicon.svg +49 -4
  136. package/dist/client/__vitest__/index.html +2 -2
  137. package/dist/client/__vitest_browser__/{orchestrator-S_3e_uzt.js → orchestrator-CXs6qrFe.js} +70 -28
  138. package/dist/client/__vitest_browser__/{tester-k74mgIRa.js → tester-K5NNxh1O.js} +167 -58
  139. package/dist/client/__vitest_browser__/{utils-uxqdqUz8.js → utils-C2ISqq1C.js} +2 -2
  140. package/dist/client/favicon.svg +49 -4
  141. package/dist/client/orchestrator.html +2 -2
  142. package/dist/client/tester/tester.html +2 -2
  143. package/dist/client.js +20 -13
  144. package/dist/config.cjs +3 -2
  145. package/dist/config.d.ts +13 -12
  146. package/dist/config.js +2 -2
  147. package/dist/context.js +108 -22
  148. package/dist/coverage.d.ts +12 -8
  149. package/dist/coverage.js +8 -5
  150. package/dist/environments.js +3 -1
  151. package/dist/expect-element.js +23 -23
  152. package/dist/index-5Pe7X7sp.js +7 -0
  153. package/dist/index.d.ts +66 -27
  154. package/dist/index.js +10 -9
  155. package/dist/locators.d.ts +14 -3
  156. package/dist/locators.js +1 -1
  157. package/dist/module-evaluator.d.ts +11 -1
  158. package/dist/module-evaluator.js +43 -26
  159. package/dist/node.d.ts +28 -14
  160. package/dist/node.js +42 -40
  161. package/dist/nodejs-worker-loader.js +41 -0
  162. package/dist/plugins/mocker-transforms.mjs +2 -0
  163. package/dist/plugins/utils-source-map-node.mjs +2 -0
  164. package/dist/reporters.d.ts +8 -8
  165. package/dist/reporters.js +7 -5
  166. package/dist/runners.d.ts +24 -5
  167. package/dist/runners.js +6 -6
  168. package/dist/runtime.d.ts +6 -0
  169. package/dist/runtime.js +35 -0
  170. package/dist/snapshot.js +4 -2
  171. package/dist/suite.d.ts +1 -1
  172. package/dist/suite.js +4 -2
  173. package/dist/vendor/blazediff_core.d.mts +1 -0
  174. package/dist/vendor/blazediff_core.mjs +117 -0
  175. package/dist/vendor/chai.mjs +4 -249
  176. package/dist/vendor/convert-source-map.d.mts +1 -0
  177. package/dist/vendor/convert-source-map.mjs +150 -0
  178. package/dist/vendor/expect-type.d.mts +14 -7
  179. package/dist/vendor/expect-type.mjs +5 -5
  180. package/dist/vendor/std-env.d.mts +131 -40
  181. package/dist/vendor/std-env.mjs +114 -117
  182. package/dist/worker.d.ts +6 -6
  183. package/dist/worker.js +27 -21
  184. package/dist/workers/forks.js +23 -17
  185. package/dist/workers/runVmTests.js +18 -16
  186. package/dist/workers/threads.js +23 -17
  187. package/dist/workers/vmForks.js +15 -12
  188. package/dist/workers/vmThreads.js +15 -12
  189. package/globals.d.ts +2 -0
  190. package/package.json +35 -26
  191. package/suppress-warnings.cjs +1 -0
  192. package/dist/@vitest/browser/client/__vitest__/assets/index-BUCFJtth.js +0 -57
  193. package/dist/@vitest/browser/client/__vitest__/assets/index-DlhE0rqZ.css +0 -1
  194. package/dist/@vitest/browser/index-D6m36C6U.js +0 -11
  195. package/dist/@vitest/utils/chunk-_commonjsHelpers.js +0 -5
  196. package/dist/@vitest/utils/highlight.d.ts +0 -9
  197. package/dist/@vitest/utils/highlight.js +0 -538
  198. package/dist/chunks/date.Bq6ZW5rf.js +0 -73
  199. package/dist/chunks/rpc.BoxB0q7B.js +0 -76
  200. package/dist/chunks/test.B8ej_ZHS.js +0 -254
  201. package/dist/client/__vitest__/assets/index-BUCFJtth.js +0 -57
  202. package/dist/client/__vitest__/assets/index-DlhE0rqZ.css +0 -1
  203. package/dist/index-D6m36C6U.js +0 -6
  204. package/dist/mocker.d.ts +0 -1
  205. package/dist/mocker.js +0 -1
  206. package/dist/module-runner.js +0 -17
@@ -1,5 +1,5 @@
1
1
  import fs from 'node:fs';
2
- import nodeModule from 'node:module';
2
+ import module$1 from 'node:module';
3
3
  import { d as dirname, j as join, b as basename, r as resolve, e as extname } from './chunk-pathe.M-eThtNZ.js';
4
4
 
5
5
  const { existsSync, readdirSync, statSync } = fs;
@@ -42,7 +42,7 @@ function findMockRedirect(root, mockPath, external) {
42
42
  return existsSync(fullPath) ? fullPath : null;
43
43
  }
44
44
  const builtins = new Set([
45
- ...nodeModule.builtinModules,
45
+ ...module$1.builtinModules,
46
46
  "assert/strict",
47
47
  "diagnostics_channel",
48
48
  "dns/promises",
@@ -67,8 +67,8 @@ const prefixedBuiltins = new Set([
67
67
  const NODE_BUILTIN_NAMESPACE = "node:";
68
68
  function isNodeBuiltin(id) {
69
69
  // Added in v18.6.0
70
- if (nodeModule.isBuiltin) {
71
- return nodeModule.isBuiltin(id);
70
+ if (module$1.isBuiltin) {
71
+ return module$1.isBuiltin(id);
72
72
  }
73
73
  if (prefixedBuiltins.has(id)) {
74
74
  return true;
@@ -1,7 +1,7 @@
1
- import { M as ModuleMockerInterceptor, a as ModuleMockerCompilerHints, b as ModuleMocker } from './mocker.d-TnKRhz7N.js';
1
+ import { M as ModuleMockerInterceptor, a as ModuleMockerCompilerHints, b as ModuleMocker } from './mocker.d-QEntlm6J.js';
2
2
  import '../spy/index.js';
3
- import './types.d-B8CCKmHt.js';
4
- import './index.d-C-sLYZi-.js';
3
+ import './types.d-BjI5eAwu.js';
4
+ import './index.d-B41z0AuW.js';
5
5
 
6
6
  declare function registerModuleMocker(interceptor: (accessor: string) => ModuleMockerInterceptor): ModuleMockerCompilerHints;
7
7
  declare function registerNativeFactoryResolver(mocker: ModuleMocker): void;
@@ -1,5 +1,6 @@
1
1
  import { createMockInstance } from '../spy/index.js';
2
2
  import { M as ModuleMocker, r as rpc, c as createCompilerHints, h as hot } from './chunk-mocker.js';
3
+ import './chunk-helpers.js';
3
4
  import './index.js';
4
5
  import './chunk-registry.js';
5
6
  import './chunk-pathe.M-eThtNZ.js';
@@ -0,0 +1,6 @@
1
+ export { c as createManualModuleSource, h as hoistMocks } from './hoistMocks.d-w2ILr1dG.js';
2
+ export { automockModule } from './automock.js';
3
+ declare function initSyntaxLexers(): Promise<void>;
4
+ declare function collectModuleExports(filename: string, code: string, format: "module" | "commonjs", exports?: string[]): string[];
5
+
6
+ export { collectModuleExports, initSyntaxLexers };
@@ -0,0 +1,8 @@
1
+ export { c as createManualModuleSource } from './chunk-utils.js';
2
+ export { a as automockModule, c as collectModuleExports, i as initSyntaxLexers } from './chunk-automock.js';
3
+ export { h as hoistMocks } from './chunk-hoistMocks.js';
4
+ import 'node:fs';
5
+ import 'node:url';
6
+ import 'node:module';
7
+ import 'node:path';
8
+ import './chunk-helpers.js';
@@ -65,15 +65,15 @@ interface RedirectedModuleSerialized {
65
65
  raw: string;
66
66
  redirect: string;
67
67
  }
68
- declare class ManualMockedModule {
68
+ declare class ManualMockedModule<T = any> {
69
69
  raw: string;
70
70
  id: string;
71
71
  url: string;
72
- factory: () => any;
73
- cache: Record<string | symbol, any> | undefined;
72
+ factory: () => T;
73
+ cache: T | undefined;
74
74
  readonly type = "manual";
75
- constructor(raw: string, id: string, url: string, factory: () => any);
76
- resolve(): Promise<Record<string | symbol, any>>;
75
+ constructor(raw: string, id: string, url: string, factory: () => T);
76
+ resolve(): T;
77
77
  static fromJSON(data: ManualMockedModuleSerialized, factory: () => any): ManualMockedModule;
78
78
  toJSON(): ManualMockedModuleSerialized;
79
79
  }
@@ -102,6 +102,22 @@ interface ServerIdResolution {
102
102
  url: string;
103
103
  optimized: boolean;
104
104
  }
105
+ interface ModuleMockContext {
106
+ /**
107
+ * When mocking with a factory, this refers to the module that imported the mock.
108
+ */
109
+ callstack: null | string[];
110
+ }
111
+ interface TestModuleMocker {
112
+ queueMock(id: string, importer: string, factoryOrOptions?: ModuleMockFactory | ModuleMockOptions): void;
113
+ queueUnmock(id: string, importer: string): void;
114
+ importActual<T>(rawId: string, importer: string, callstack?: string[] | null): Promise<T>;
115
+ importMock(rawId: string, importer: string): Promise<any>;
116
+ mockObject(object: Record<string | symbol, any>, moduleType?: "automock" | "autospy"): Record<string | symbol, any>;
117
+ mockObject(object: Record<string | symbol, any>, mockExports: Record<string | symbol, any> | undefined, moduleType?: "automock" | "autospy"): Record<string | symbol, any>;
118
+ getMockContext(): ModuleMockContext;
119
+ reset(): void;
120
+ }
105
121
 
106
- export { AutomockedModule as A, MockerRegistry as M, RedirectedModule as R, AutospiedModule as f, ManualMockedModule as g };
107
- export type { ServerMockResolution as S, MockedModule as a, ModuleMockOptions as b, ModuleMockFactoryWithHelper as c, MockedModuleType as d, ServerIdResolution as e, AutomockedModuleSerialized as h, AutospiedModuleSerialized as i, ManualMockedModuleSerialized as j, MockedModuleSerialized as k, RedirectedModuleSerialized as l, ModuleMockFactory as m };
122
+ export { AutomockedModule as A, MockerRegistry as M, RedirectedModule as R, AutospiedModule as h, ManualMockedModule as j };
123
+ export type { ServerMockResolution as S, TestModuleMocker as T, MockedModule as a, ModuleMockOptions as b, ModuleMockFactoryWithHelper as c, MockedModuleType as d, ModuleMockContext as e, ServerIdResolution as f, AutomockedModuleSerialized as g, AutospiedModuleSerialized as i, ManualMockedModuleSerialized as k, MockedModuleSerialized as l, ModuleMockFactory as m, RedirectedModuleSerialized as n };
@@ -103,6 +103,15 @@ type Plugins = Array<Plugin>;
103
103
  * LICENSE file in the root directory of this source tree.
104
104
  */
105
105
 
106
+ declare function createDOMElementFilter(filterNode?: (node: any) => boolean): NewPlugin;
107
+
108
+ /**
109
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
110
+ *
111
+ * This source code is licensed under the MIT license found in the
112
+ * LICENSE file in the root directory of this source tree.
113
+ */
114
+
106
115
  declare const DEFAULT_OPTIONS: Options;
107
116
  /**
108
117
  * Returns a presentation string of your `val` object
@@ -110,6 +119,7 @@ declare const DEFAULT_OPTIONS: Options;
110
119
  * @param options Custom settings
111
120
  */
112
121
  declare function format(val: unknown, options?: OptionsReceived): string;
122
+
113
123
  declare const plugins: {
114
124
  AsymmetricMatcher: NewPlugin;
115
125
  DOMCollection: NewPlugin;
@@ -120,5 +130,5 @@ declare const plugins: {
120
130
  Error: NewPlugin;
121
131
  };
122
132
 
123
- export { DEFAULT_OPTIONS, format, plugins };
133
+ export { DEFAULT_OPTIONS, createDOMElementFilter, format, plugins };
124
134
  export type { Colors, CompareKeys, Config, NewPlugin, OldPlugin, Options, OptionsReceived, Plugin, Plugins, PrettyFormatOptions, Printer, Refs, Theme };
@@ -295,7 +295,25 @@ function nodeIsComment(node) {
295
295
  function nodeIsFragment(node) {
296
296
  return node.nodeType === FRAGMENT_NODE;
297
297
  }
298
- const serialize$3 = (node, config, indentation, depth, refs, printer) => {
298
+ function filterChildren(children, filterNode) {
299
+ // Filter out text nodes that only contain whitespace to prevent empty lines
300
+ // This is done regardless of whether a filterNode is provided
301
+ let filtered = children.filter((node) => {
302
+ // Filter out text nodes that are only whitespace
303
+ if (node.nodeType === TEXT_NODE) {
304
+ const text = node.data || "";
305
+ // Keep text nodes that have non-whitespace content
306
+ return text.trim().length > 0;
307
+ }
308
+ return true;
309
+ });
310
+ // Apply additional user-provided filter if specified
311
+ if (filterNode) {
312
+ filtered = filtered.filter(filterNode);
313
+ }
314
+ return filtered;
315
+ }
316
+ function serializeDOM(node, config, indentation, depth, refs, printer, filterNode) {
299
317
  if (nodeIsText(node)) {
300
318
  return printText(node.data, config);
301
319
  }
@@ -306,11 +324,22 @@ const serialize$3 = (node, config, indentation, depth, refs, printer) => {
306
324
  if (++depth > config.maxDepth) {
307
325
  return printElementAsLeaf(type, config);
308
326
  }
327
+ const children = Array.prototype.slice.call(node.childNodes || node.children);
328
+ const shadowChildren = nodeIsFragment(node) || !node.shadowRoot ? [] : Array.prototype.slice.call(node.shadowRoot.children);
329
+ const resolvedChildren = filterNode ? filterChildren(children, filterNode) : children;
330
+ const resolvedShadowChildren = filterNode ? filterChildren(shadowChildren, filterNode) : shadowChildren;
309
331
  return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
310
332
  props[attribute.name] = attribute.value;
311
333
  return props;
312
- }, {}), config, indentation + config.indent, depth, refs, printer), (nodeIsFragment(node) || !node.shadowRoot ? "" : printShadowRoot(Array.prototype.slice.call(node.shadowRoot.children), config, indentation + config.indent, depth, refs, printer)) + printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
313
- };
334
+ }, {}), config, indentation + config.indent, depth, refs, printer), (resolvedShadowChildren.length > 0 ? printShadowRoot(resolvedShadowChildren, config, indentation + config.indent, depth, refs, printer) : "") + printChildren(resolvedChildren, config, indentation + config.indent, depth, refs, printer), config, indentation);
335
+ }
336
+ const serialize$3 = (node, config, indentation, depth, refs, printer) => serializeDOM(node, config, indentation, depth, refs, printer);
337
+ function createDOMElementFilter(filterNode) {
338
+ return {
339
+ test: test$3,
340
+ serialize: (node, config, indentation, depth, refs, printer) => serializeDOM(node, config, indentation, depth, refs, printer, filterNode)
341
+ };
342
+ }
314
343
  const plugin$3 = {
315
344
  serialize: serialize$3,
316
345
  test: test$3
@@ -1019,4 +1048,4 @@ const plugins = {
1019
1048
  Error: ErrorPlugin
1020
1049
  };
1021
1050
 
1022
- export { DEFAULT_OPTIONS, format, plugins };
1051
+ export { DEFAULT_OPTIONS, createDOMElementFilter, format, plugins };
@@ -3,19 +3,29 @@ import { parseSingleStack } from '../utils/source-map.js';
3
3
  import { relative } from '../../vendor/pathe.mjs';
4
4
  import { toArray } from '../utils/helpers.js';
5
5
 
6
- function createChainable(keys, fn) {
6
+ const kChainableContext = Symbol("kChainableContext");
7
+ function getChainableContext(chainable) {
8
+ return chainable?.[kChainableContext];
9
+ }
10
+ function createChainable(keys, fn, context) {
7
11
  function create(context) {
8
12
  const chain = function(...args) {
9
13
  return fn.apply(context, args);
10
14
  };
11
15
  Object.assign(chain, fn);
12
- chain.withContext = () => chain.bind(context);
13
- chain.setContext = (key, value) => {
14
- context[key] = value;
15
- };
16
- chain.mergeContext = (ctx) => {
17
- Object.assign(context, ctx);
18
- };
16
+ Object.defineProperty(chain, kChainableContext, {
17
+ value: {
18
+ withContext: () => chain.bind(context),
19
+ getFixtures: () => context.fixtures,
20
+ setContext: (key, value) => {
21
+ context[key] = value;
22
+ },
23
+ mergeContext: (ctx) => {
24
+ Object.assign(context, ctx);
25
+ }
26
+ },
27
+ enumerable: false
28
+ });
19
29
  for (const key of keys) {
20
30
  Object.defineProperty(chain, key, { get() {
21
31
  return create({
@@ -26,15 +36,18 @@ function createChainable(keys, fn) {
26
36
  }
27
37
  return chain;
28
38
  }
29
- const chain = create({});
30
- chain.fn = fn;
39
+ const chain = create(context ?? {});
40
+ Object.defineProperty(chain, "fn", {
41
+ value: fn,
42
+ enumerable: false
43
+ });
31
44
  return chain;
32
45
  }
33
46
 
34
47
  /**
35
48
  * If any tasks been marked as `only`, mark all other tasks as `skip`.
36
49
  */
37
- function interpretTaskModes(file, namePattern, testLocations, onlyMode, parentIsOnly, allowOnly) {
50
+ function interpretTaskModes(file, namePattern, testLocations, testIds, testTagsFilter, onlyMode, parentIsOnly, allowOnly) {
38
51
  const matchedLocations = [];
39
52
  const traverseSuite = (suite, parentIsOnly, parentMatchedWithLocation) => {
40
53
  const suiteIsOnly = parentIsOnly || suite.mode === "only";
@@ -60,10 +73,10 @@ function interpretTaskModes(file, namePattern, testLocations, onlyMode, parentIs
60
73
  }
61
74
  let hasLocationMatch = parentMatchedWithLocation;
62
75
  // Match test location against provided locations, only run if present
63
- // in `testLocations`. Note: if `includeTaskLocations` is not enabled,
76
+ // in `testLocations`. Note: if `includeTaskLocation` is not enabled,
64
77
  // all test will be skipped.
65
78
  if (testLocations !== undefined && testLocations.length !== 0) {
66
- if (t.location && (testLocations === null || testLocations === void 0 ? void 0 : testLocations.includes(t.location.line))) {
79
+ if (t.location && testLocations?.includes(t.location.line)) {
67
80
  t.mode = "run";
68
81
  matchedLocations.push(t.location.line);
69
82
  hasLocationMatch = true;
@@ -77,6 +90,12 @@ function interpretTaskModes(file, namePattern, testLocations, onlyMode, parentIs
77
90
  if (namePattern && !getTaskFullName(t).match(namePattern)) {
78
91
  t.mode = "skip";
79
92
  }
93
+ if (testIds && !testIds.includes(t.id)) {
94
+ t.mode = "skip";
95
+ }
96
+ if (testTagsFilter && !testTagsFilter(t.tags || [])) {
97
+ t.mode = "skip";
98
+ }
80
99
  } else if (t.type === "suite") {
81
100
  if (t.mode === "skip") {
82
101
  skipAllTasks(t);
@@ -95,7 +114,7 @@ function interpretTaskModes(file, namePattern, testLocations, onlyMode, parentIs
95
114
  }
96
115
  };
97
116
  traverseSuite(file, parentIsOnly, false);
98
- const nonMatching = testLocations === null || testLocations === void 0 ? void 0 : testLocations.filter((loc) => !matchedLocations.includes(loc));
117
+ const nonMatching = testLocations?.filter((loc) => !matchedLocations.includes(loc));
99
118
  if (nonMatching && nonMatching.length !== 0) {
100
119
  const message = nonMatching.length === 1 ? `line ${nonMatching[0]}` : `lines ${nonMatching.join(", ")}`;
101
120
  if (file.result === undefined) {
@@ -230,28 +249,45 @@ function limitConcurrency(concurrency = Infinity) {
230
249
  tail = head && tail;
231
250
  }
232
251
  };
233
- return (func, ...args) => {
234
- // Create a promise chain that:
235
- // 1. Waits for its turn in the task queue (if necessary).
236
- // 2. Runs the task.
237
- // 3. Allows the next pending task (if any) to run.
252
+ const acquire = () => {
253
+ let released = false;
254
+ const release = () => {
255
+ if (!released) {
256
+ released = true;
257
+ finish();
258
+ }
259
+ };
260
+ if (count++ < concurrency) {
261
+ return release;
262
+ }
238
263
  return new Promise((resolve) => {
239
- if (count++ < concurrency) {
240
- // No need to queue if fewer than maxConcurrency tasks are running.
241
- resolve();
242
- } else if (tail) {
264
+ if (tail) {
243
265
  // There are pending tasks, so append to the queue.
244
- tail = tail[1] = [resolve];
266
+ tail = tail[1] = [() => resolve(release)];
245
267
  } else {
246
268
  // No other pending tasks, initialize the queue with a new tail and head.
247
- head = tail = [resolve];
269
+ head = tail = [() => resolve(release)];
270
+ }
271
+ });
272
+ };
273
+ const limiterFn = (func, ...args) => {
274
+ function run(release) {
275
+ try {
276
+ const result = func(...args);
277
+ if (result instanceof Promise) {
278
+ return result.finally(release);
279
+ }
280
+ release();
281
+ return Promise.resolve(result);
282
+ } catch (error) {
283
+ release();
284
+ return Promise.reject(error);
248
285
  }
249
- }).then(() => {
250
- // Running func here ensures that even a non-thenable result or an
251
- // immediately thrown error gets wrapped into a Promise.
252
- return func(...args);
253
- }).finally(finish);
286
+ }
287
+ const release = acquire();
288
+ return release instanceof Promise ? release.then(run) : run(release);
254
289
  };
290
+ return Object.assign(limiterFn, { acquire });
255
291
  }
256
292
 
257
293
  /**
@@ -274,6 +310,241 @@ function partitionSuiteChildren(suite) {
274
310
  return tasksGroups;
275
311
  }
276
312
 
313
+ function validateTags(config, tags) {
314
+ if (!config.strictTags) {
315
+ return;
316
+ }
317
+ const availableTags = new Set(config.tags.map((tag) => tag.name));
318
+ for (const tag of tags) {
319
+ if (!availableTags.has(tag)) {
320
+ throw createNoTagsError(config.tags, tag);
321
+ }
322
+ }
323
+ }
324
+ function createNoTagsError(availableTags, tag, prefix = "tag") {
325
+ if (!availableTags.length) {
326
+ throw new Error(`The Vitest config does't define any "tags", cannot apply "${tag}" ${prefix} for this test. See: https://vitest.dev/guide/test-tags`);
327
+ }
328
+ throw new Error(`The ${prefix} "${tag}" is not defined in the configuration. Available tags are:\n${availableTags.map((t) => `- ${t.name}${t.description ? `: ${t.description}` : ""}`).join("\n")}`);
329
+ }
330
+ function createTagsFilter(tagsExpr, availableTags) {
331
+ const matchers = tagsExpr.map((expr) => parseTagsExpression(expr, availableTags));
332
+ return (testTags) => {
333
+ return matchers.every((matcher) => matcher(testTags));
334
+ };
335
+ }
336
+ function parseTagsExpression(expr, availableTags) {
337
+ const tokens = tokenize(expr);
338
+ const stream = new TokenStream(tokens, expr);
339
+ const ast = parseOrExpression(stream, availableTags);
340
+ if (stream.peek().type !== "EOF") {
341
+ throw new Error(`Invalid tags expression: unexpected "${formatToken(stream.peek())}" in "${expr}"`);
342
+ }
343
+ return (tags) => evaluateNode(ast, tags);
344
+ }
345
+ function formatToken(token) {
346
+ switch (token.type) {
347
+ case "TAG": return token.value;
348
+ default: return formatTokenType(token.type);
349
+ }
350
+ }
351
+ function tokenize(expr) {
352
+ const tokens = [];
353
+ let i = 0;
354
+ while (i < expr.length) {
355
+ if (expr[i] === " " || expr[i] === " ") {
356
+ i++;
357
+ continue;
358
+ }
359
+ if (expr[i] === "(") {
360
+ tokens.push({ type: "LPAREN" });
361
+ i++;
362
+ continue;
363
+ }
364
+ if (expr[i] === ")") {
365
+ tokens.push({ type: "RPAREN" });
366
+ i++;
367
+ continue;
368
+ }
369
+ if (expr[i] === "!") {
370
+ tokens.push({ type: "NOT" });
371
+ i++;
372
+ continue;
373
+ }
374
+ if (expr.slice(i, i + 2) === "&&") {
375
+ tokens.push({ type: "AND" });
376
+ i += 2;
377
+ continue;
378
+ }
379
+ if (expr.slice(i, i + 2) === "||") {
380
+ tokens.push({ type: "OR" });
381
+ i += 2;
382
+ continue;
383
+ }
384
+ if (/^and(?:\s|\)|$)/i.test(expr.slice(i))) {
385
+ tokens.push({ type: "AND" });
386
+ i += 3;
387
+ continue;
388
+ }
389
+ if (/^or(?:\s|\)|$)/i.test(expr.slice(i))) {
390
+ tokens.push({ type: "OR" });
391
+ i += 2;
392
+ continue;
393
+ }
394
+ if (/^not\s/i.test(expr.slice(i))) {
395
+ tokens.push({ type: "NOT" });
396
+ i += 3;
397
+ continue;
398
+ }
399
+ let tag = "";
400
+ while (i < expr.length && expr[i] !== " " && expr[i] !== " " && expr[i] !== "(" && expr[i] !== ")" && expr[i] !== "!" && expr[i] !== "&" && expr[i] !== "|") {
401
+ const remaining = expr.slice(i);
402
+ // Only treat and/or/not as operators if we're at the start of a tag (after whitespace)
403
+ // This allows tags like "demand", "editor", "cannot" to work correctly
404
+ if (tag === "" && (/^and(?:\s|\)|$)/i.test(remaining) || /^or(?:\s|\)|$)/i.test(remaining) || /^not\s/i.test(remaining))) {
405
+ break;
406
+ }
407
+ tag += expr[i];
408
+ i++;
409
+ }
410
+ if (tag) {
411
+ tokens.push({
412
+ type: "TAG",
413
+ value: tag
414
+ });
415
+ }
416
+ }
417
+ tokens.push({ type: "EOF" });
418
+ return tokens;
419
+ }
420
+ class TokenStream {
421
+ pos = 0;
422
+ constructor(tokens, expr) {
423
+ this.tokens = tokens;
424
+ this.expr = expr;
425
+ }
426
+ peek() {
427
+ return this.tokens[this.pos];
428
+ }
429
+ next() {
430
+ return this.tokens[this.pos++];
431
+ }
432
+ expect(type) {
433
+ const token = this.next();
434
+ if (token.type !== type) {
435
+ if (type === "RPAREN" && token.type === "EOF") {
436
+ throw new Error(`Invalid tags expression: missing closing ")" in "${this.expr}"`);
437
+ }
438
+ throw new Error(`Invalid tags expression: expected "${formatTokenType(type)}" but got "${formatToken(token)}" in "${this.expr}"`);
439
+ }
440
+ return token;
441
+ }
442
+ unexpectedToken() {
443
+ const token = this.peek();
444
+ if (token.type === "EOF") {
445
+ throw new Error(`Invalid tags expression: unexpected end of expression in "${this.expr}"`);
446
+ }
447
+ throw new Error(`Invalid tags expression: unexpected "${formatToken(token)}" in "${this.expr}"`);
448
+ }
449
+ }
450
+ function formatTokenType(type) {
451
+ switch (type) {
452
+ case "TAG": return "tag";
453
+ case "AND": return "and";
454
+ case "OR": return "or";
455
+ case "NOT": return "not";
456
+ case "LPAREN": return "(";
457
+ case "RPAREN": return ")";
458
+ case "EOF": return "end of expression";
459
+ }
460
+ }
461
+ function parseOrExpression(stream, availableTags) {
462
+ let left = parseAndExpression(stream, availableTags);
463
+ while (stream.peek().type === "OR") {
464
+ stream.next();
465
+ const right = parseAndExpression(stream, availableTags);
466
+ left = {
467
+ type: "or",
468
+ left,
469
+ right
470
+ };
471
+ }
472
+ return left;
473
+ }
474
+ function parseAndExpression(stream, availableTags) {
475
+ let left = parseUnaryExpression(stream, availableTags);
476
+ while (stream.peek().type === "AND") {
477
+ stream.next();
478
+ const right = parseUnaryExpression(stream, availableTags);
479
+ left = {
480
+ type: "and",
481
+ left,
482
+ right
483
+ };
484
+ }
485
+ return left;
486
+ }
487
+ function parseUnaryExpression(stream, availableTags) {
488
+ if (stream.peek().type === "NOT") {
489
+ stream.next();
490
+ const operand = parseUnaryExpression(stream, availableTags);
491
+ return {
492
+ type: "not",
493
+ operand
494
+ };
495
+ }
496
+ return parsePrimaryExpression(stream, availableTags);
497
+ }
498
+ function parsePrimaryExpression(stream, availableTags) {
499
+ const token = stream.peek();
500
+ if (token.type === "LPAREN") {
501
+ stream.next();
502
+ const expr = parseOrExpression(stream, availableTags);
503
+ stream.expect("RPAREN");
504
+ return expr;
505
+ }
506
+ if (token.type === "TAG") {
507
+ stream.next();
508
+ const tagValue = token.value;
509
+ const pattern = resolveTagPattern(tagValue, availableTags);
510
+ return {
511
+ type: "tag",
512
+ value: tagValue,
513
+ pattern
514
+ };
515
+ }
516
+ stream.unexpectedToken();
517
+ }
518
+ function createWildcardRegex(pattern) {
519
+ return new RegExp(`^${pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`);
520
+ }
521
+ function resolveTagPattern(tagPattern, availableTags) {
522
+ if (tagPattern.includes("*")) {
523
+ const regex = createWildcardRegex(tagPattern);
524
+ const hasMatch = availableTags.some((tag) => regex.test(tag.name));
525
+ if (!hasMatch) {
526
+ throw createNoTagsError(availableTags, tagPattern, "tag pattern");
527
+ }
528
+ return regex;
529
+ }
530
+ if (!availableTags.length || !availableTags.some((tag) => tag.name === tagPattern)) {
531
+ throw createNoTagsError(availableTags, tagPattern, "tag pattern");
532
+ }
533
+ return null;
534
+ }
535
+ function evaluateNode(node, tags) {
536
+ switch (node.type) {
537
+ case "tag":
538
+ if (node.pattern) {
539
+ return tags.some((tag) => node.pattern.test(tag));
540
+ }
541
+ return tags.includes(node.value);
542
+ case "not": return !evaluateNode(node.operand, tags);
543
+ case "and": return evaluateNode(node.left, tags) && evaluateNode(node.right, tags);
544
+ case "or": return evaluateNode(node.left, tags) || evaluateNode(node.right, tags);
545
+ }
546
+ }
547
+
277
548
  function isTestCase(s) {
278
549
  return s.type === "test";
279
550
  }
@@ -308,17 +579,14 @@ function hasTests(suite) {
308
579
  return toArray(suite).some((s) => s.tasks.some((c) => isTestCase(c) || hasTests(c)));
309
580
  }
310
581
  function hasFailed(suite) {
311
- return toArray(suite).some((s) => {
312
- var _s$result;
313
- return ((_s$result = s.result) === null || _s$result === void 0 ? void 0 : _s$result.state) === "fail" || s.type === "suite" && hasFailed(s.tasks);
314
- });
582
+ return toArray(suite).some((s) => s.result?.state === "fail" || s.type === "suite" && hasFailed(s.tasks));
315
583
  }
316
584
  function getNames(task) {
317
585
  const names = [task.name];
318
586
  let current = task;
319
- while (current === null || current === void 0 ? void 0 : current.suite) {
587
+ while (current?.suite) {
320
588
  current = current.suite;
321
- if (current === null || current === void 0 ? void 0 : current.name) {
589
+ if (current?.name) {
322
590
  names.unshift(current.name);
323
591
  }
324
592
  }
@@ -337,4 +605,4 @@ function createTaskName(names, separator = " > ") {
337
605
  return names.filter((name) => name !== undefined).join(separator);
338
606
  }
339
607
 
340
- export { calculateSuiteHash as a, createFileTask as b, createChainable as c, generateHash as d, createTaskName as e, findTestFileStackTrace as f, generateFileHash as g, getFullName as h, interpretTaskModes as i, getNames as j, getSuites as k, limitConcurrency as l, getTasks as m, getTestName as n, getTests as o, partitionSuiteChildren as p, hasFailed as q, hasTests as r, someTasksAreOnly as s, isTestCase as t };
608
+ export { createChainable as a, createFileTask as b, calculateSuiteHash as c, createTagsFilter as d, createTaskName as e, findTestFileStackTrace as f, generateFileHash as g, generateHash as h, getFullName as i, getNames as j, getSuites as k, getTasks as l, getTestName as m, getTests as n, hasFailed as o, hasTests as p, interpretTaskModes as q, isTestCase as r, limitConcurrency as s, partitionSuiteChildren as t, someTasksAreOnly as u, validateTags as v, getChainableContext as w, createNoTagsError as x };
@@ -1,8 +1,6 @@
1
- import { b as TestArtifact, a as Test, S as Suite, d as SuiteHooks, F as File, e as TaskUpdateEvent, T as Task, f as TestAPI, g as SuiteAPI, h as SuiteCollector } from './tasks.d-C7UxawJ9.js';
2
- export { A as AfterAllListener, n as AfterEachListener, B as BeforeAllListener, p as BeforeEachListener, q as Fixture, r as FixtureFn, s as FixtureOptions, t as Fixtures, I as ImportDuration, u as InferFixturesTypes, O as OnTestFailedHandler, v as OnTestFinishedHandler, R as RunMode, w as RuntimeContext, x as SequenceHooks, y as SequenceSetupFiles, z as SuiteFactory, D as TaskBase, E as TaskCustomOptions, G as TaskEventPack, H as TaskHook, J as TaskMeta, K as TaskPopulated, L as TaskResult, M as TaskResultPack, N as TaskState, P as TestAnnotation, Q as TestAnnotationArtifact, U as TestAnnotationLocation, V as TestArtifactBase, W as TestArtifactLocation, X as TestArtifactRegistry, Y as TestAttachment, Z as TestContext, _ as TestFunction, $ as TestOptions, a0 as Use, a1 as VisualRegressionArtifact, i as afterAll, j as afterEach, k as beforeAll, l as beforeEach, o as onTestFailed, m as onTestFinished } from './tasks.d-C7UxawJ9.js';
1
+ import { T as TestArtifact, a as Test, S as Suite, b as SuiteHooks, F as FileSpecification, V as VitestRunner, c as File, d as TaskUpdateEvent, e as Task, f as TestAPI, g as SuiteAPI, h as SuiteCollector } from './tasks.d-D2GKpdwQ.js';
2
+ export { A as AfterAllListener, i as AfterEachListener, j as AroundAllListener, k as AroundEachListener, B as BeforeAllListener, l as BeforeEachListener, C as CancelReason, m as FailureScreenshotArtifact, n as Fixture, o as FixtureFn, p as FixtureOptions, q as Fixtures, I as ImportDuration, r as InferFixturesTypes, O as OnTestFailedHandler, s as OnTestFinishedHandler, R as Retry, t as RunMode, u as RuntimeContext, v as SequenceHooks, w as SequenceSetupFiles, x as SerializableRetry, y as SuiteFactory, z as SuiteOptions, D as TaskBase, E as TaskCustomOptions, G as TaskEventPack, H as TaskHook, J as TaskMeta, K as TaskPopulated, L as TaskResult, M as TaskResultPack, N as TaskState, P as TestAnnotation, Q as TestAnnotationArtifact, U as TestAnnotationLocation, W as TestArtifactBase, X as TestArtifactLocation, Y as TestArtifactRegistry, Z as TestAttachment, _ as TestContext, $ as TestFunction, a0 as TestOptions, a1 as TestTagDefinition, a2 as TestTags, a3 as Use, a4 as VisualRegressionArtifact, a5 as VitestRunnerConfig, a6 as VitestRunnerConstructor, a7 as VitestRunnerImportSource, a8 as afterAll, a9 as afterEach, aa as aroundAll, ab as aroundEach, ac as beforeAll, ad as beforeEach, ae as onTestFailed, af as onTestFinished } from './tasks.d-D2GKpdwQ.js';
3
3
  import { Awaitable } from '../utils/index.js';
4
- import { FileSpecification, VitestRunner } from './types.js';
5
- export { CancelReason, VitestRunnerConfig, VitestRunnerConstructor, VitestRunnerImportSource } from './types.js';
6
4
  import '../utils/diff.js';
7
5
 
8
6
  /**
@@ -15,12 +13,13 @@ import '../utils/diff.js';
15
13
  *
16
14
  * Vitest automatically injects the source location where the artifact was created and manages any attachments you include.
17
15
  *
16
+ * **Note:** artifacts must be recorded before the task is reported. Any artifacts recorded after that will not be included in the task.
17
+ *
18
18
  * @param task - The test task context, typically accessed via `this.task` in custom matchers or `context.task` in tests
19
19
  * @param artifact - The artifact to record. Must extend {@linkcode TestArtifactBase}
20
20
  *
21
21
  * @returns A promise that resolves to the recorded artifact with location injected
22
22
  *
23
- * @throws {Error} If called after the test has finished running
24
23
  * @throws {Error} If the test runner doesn't support artifacts
25
24
  *
26
25
  * @example
@@ -173,7 +172,7 @@ declare const describe: SuiteAPI;
173
172
  */
174
173
  declare const it: TestAPI;
175
174
  declare function getCurrentSuite<ExtraContext = object>(): SuiteCollector<ExtraContext>;
176
- declare function createTaskCollector(fn: (...args: any[]) => any, context?: Record<string, unknown>): TestAPI;
175
+ declare function createTaskCollector(fn: (...args: any[]) => any): TestAPI;
177
176
 
178
177
  declare function getCurrentTest<T extends Test | undefined>(): T;
179
178