@voidzero-dev/vite-plus-test 0.0.0-0bfcc90f.20260209-0731

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 (318) hide show
  1. package/LICENSE.md +691 -0
  2. package/browser/context.d.ts +4 -0
  3. package/browser/context.js +20 -0
  4. package/config.d.ts +3 -0
  5. package/coverage.d.ts +1 -0
  6. package/dist/@vitest/browser/client/.vite/manifest.json +24 -0
  7. package/dist/@vitest/browser/client/__vitest__/assets/index-BUCFJtth.js +57 -0
  8. package/dist/@vitest/browser/client/__vitest__/assets/index-DlhE0rqZ.css +1 -0
  9. package/dist/@vitest/browser/client/__vitest__/bg.png +0 -0
  10. package/dist/@vitest/browser/client/__vitest__/favicon.ico +0 -0
  11. package/dist/@vitest/browser/client/__vitest__/favicon.svg +5 -0
  12. package/dist/@vitest/browser/client/__vitest__/index.html +32 -0
  13. package/dist/@vitest/browser/client/__vitest_browser__/orchestrator-S_3e_uzt.js +345 -0
  14. package/dist/@vitest/browser/client/__vitest_browser__/tester-k74mgIRa.js +2171 -0
  15. package/dist/@vitest/browser/client/__vitest_browser__/utils-uxqdqUz8.js +223 -0
  16. package/dist/@vitest/browser/client/error-catcher.js +82 -0
  17. package/dist/@vitest/browser/client/esm-client-injector.js +67 -0
  18. package/dist/@vitest/browser/client/favicon.svg +5 -0
  19. package/dist/@vitest/browser/client/orchestrator.html +35 -0
  20. package/dist/@vitest/browser/client/tester/tester.html +13 -0
  21. package/dist/@vitest/browser/client.js +456 -0
  22. package/dist/@vitest/browser/context.d.ts +792 -0
  23. package/dist/@vitest/browser/context.js +541 -0
  24. package/dist/@vitest/browser/expect-element.js +32 -0
  25. package/dist/@vitest/browser/index-D6m36C6U.js +11 -0
  26. package/dist/@vitest/browser/index.d.ts +73 -0
  27. package/dist/@vitest/browser/index.js +3513 -0
  28. package/dist/@vitest/browser/jest-dom.d.ts +724 -0
  29. package/dist/@vitest/browser/locators.d.ts +354 -0
  30. package/dist/@vitest/browser/locators.js +1 -0
  31. package/dist/@vitest/browser/matchers.d.ts +29 -0
  32. package/dist/@vitest/browser/shared/screenshotMatcher/types.d.ts +22 -0
  33. package/dist/@vitest/browser/state.js +280 -0
  34. package/dist/@vitest/browser/types.d.ts +69 -0
  35. package/dist/@vitest/browser-playwright/context.d.ts +1 -0
  36. package/dist/@vitest/browser-playwright/index.d.ts +106 -0
  37. package/dist/@vitest/browser-playwright/index.js +1111 -0
  38. package/dist/@vitest/browser-playwright/locators.js +114 -0
  39. package/dist/@vitest/browser-preview/context.d.ts +1 -0
  40. package/dist/@vitest/browser-preview/index.d.ts +19 -0
  41. package/dist/@vitest/browser-preview/index.js +148 -0
  42. package/dist/@vitest/browser-preview/locators.js +79 -0
  43. package/dist/@vitest/browser-webdriverio/context.d.ts +1 -0
  44. package/dist/@vitest/browser-webdriverio/index.d.ts +63 -0
  45. package/dist/@vitest/browser-webdriverio/index.js +600 -0
  46. package/dist/@vitest/browser-webdriverio/locators.js +163 -0
  47. package/dist/@vitest/expect/index.d.ts +807 -0
  48. package/dist/@vitest/expect/index.js +1875 -0
  49. package/dist/@vitest/mocker/auto-register.d.ts +2 -0
  50. package/dist/@vitest/mocker/auto-register.js +9 -0
  51. package/dist/@vitest/mocker/automock.d.ts +12 -0
  52. package/dist/@vitest/mocker/automock.js +1 -0
  53. package/dist/@vitest/mocker/browser.d.ts +53 -0
  54. package/dist/@vitest/mocker/browser.js +91 -0
  55. package/dist/@vitest/mocker/chunk-automock.js +354 -0
  56. package/dist/@vitest/mocker/chunk-interceptor-native.js +15 -0
  57. package/dist/@vitest/mocker/chunk-mocker.js +521 -0
  58. package/dist/@vitest/mocker/chunk-pathe.M-eThtNZ.js +174 -0
  59. package/dist/@vitest/mocker/chunk-registry.js +185 -0
  60. package/dist/@vitest/mocker/chunk-utils.js +16 -0
  61. package/dist/@vitest/mocker/index.d-C-sLYZi-.d.ts +25 -0
  62. package/dist/@vitest/mocker/index.d.ts +2 -0
  63. package/dist/@vitest/mocker/index.js +185 -0
  64. package/dist/@vitest/mocker/mocker.d-TnKRhz7N.d.ts +81 -0
  65. package/dist/@vitest/mocker/node.d.ts +800 -0
  66. package/dist/@vitest/mocker/node.js +966 -0
  67. package/dist/@vitest/mocker/redirect.d.ts +3 -0
  68. package/dist/@vitest/mocker/redirect.js +79 -0
  69. package/dist/@vitest/mocker/register.d.ts +9 -0
  70. package/dist/@vitest/mocker/register.js +41 -0
  71. package/dist/@vitest/mocker/types.d-B8CCKmHt.d.ts +107 -0
  72. package/dist/@vitest/pretty-format/index.d.ts +124 -0
  73. package/dist/@vitest/pretty-format/index.js +1022 -0
  74. package/dist/@vitest/runner/chunk-tasks.js +340 -0
  75. package/dist/@vitest/runner/index.d.ts +180 -0
  76. package/dist/@vitest/runner/index.js +2114 -0
  77. package/dist/@vitest/runner/tasks.d-C7UxawJ9.d.ts +834 -0
  78. package/dist/@vitest/runner/types.d.ts +183 -0
  79. package/dist/@vitest/runner/types.js +1 -0
  80. package/dist/@vitest/runner/utils.d.ts +45 -0
  81. package/dist/@vitest/runner/utils.js +5 -0
  82. package/dist/@vitest/snapshot/environment.d-DHdQ1Csl.d.ts +22 -0
  83. package/dist/@vitest/snapshot/environment.d.ts +16 -0
  84. package/dist/@vitest/snapshot/environment.js +40 -0
  85. package/dist/@vitest/snapshot/index.d.ts +130 -0
  86. package/dist/@vitest/snapshot/index.js +1437 -0
  87. package/dist/@vitest/snapshot/manager.d.ts +18 -0
  88. package/dist/@vitest/snapshot/manager.js +73 -0
  89. package/dist/@vitest/snapshot/rawSnapshot.d-lFsMJFUd.d.ts +61 -0
  90. package/dist/@vitest/spy/index.d.ts +384 -0
  91. package/dist/@vitest/spy/index.js +433 -0
  92. package/dist/@vitest/utils/chunk-_commonjsHelpers.js +5 -0
  93. package/dist/@vitest/utils/chunk-pathe.M-eThtNZ.js +156 -0
  94. package/dist/@vitest/utils/constants.d.ts +21 -0
  95. package/dist/@vitest/utils/constants.js +49 -0
  96. package/dist/@vitest/utils/diff.d.ts +93 -0
  97. package/dist/@vitest/utils/diff.js +2199 -0
  98. package/dist/@vitest/utils/display.d.ts +29 -0
  99. package/dist/@vitest/utils/display.js +742 -0
  100. package/dist/@vitest/utils/error.d.ts +7 -0
  101. package/dist/@vitest/utils/error.js +42 -0
  102. package/dist/@vitest/utils/helpers.d.ts +73 -0
  103. package/dist/@vitest/utils/helpers.js +295 -0
  104. package/dist/@vitest/utils/highlight.d.ts +9 -0
  105. package/dist/@vitest/utils/highlight.js +538 -0
  106. package/dist/@vitest/utils/index.d.ts +5 -0
  107. package/dist/@vitest/utils/index.js +1 -0
  108. package/dist/@vitest/utils/offset.d.ts +5 -0
  109. package/dist/@vitest/utils/offset.js +32 -0
  110. package/dist/@vitest/utils/resolver.d.ts +7 -0
  111. package/dist/@vitest/utils/resolver.js +71 -0
  112. package/dist/@vitest/utils/serialize.d.ts +3 -0
  113. package/dist/@vitest/utils/serialize.js +118 -0
  114. package/dist/@vitest/utils/source-map.d.ts +55 -0
  115. package/dist/@vitest/utils/source-map.js +478 -0
  116. package/dist/@vitest/utils/timers.d.ts +33 -0
  117. package/dist/@vitest/utils/timers.js +49 -0
  118. package/dist/@vitest/utils/types.d-BCElaP-c.d.ts +53 -0
  119. package/dist/@vitest/utils/types.d.ts +34 -0
  120. package/dist/@vitest/utils/types.js +1 -0
  121. package/dist/browser-compat.js +3 -0
  122. package/dist/browser.d.ts +46 -0
  123. package/dist/browser.js +20 -0
  124. package/dist/chunks/_commonjsHelpers.D26ty3Ew.js +6 -0
  125. package/dist/chunks/base.CJ0Y4ePK.js +165 -0
  126. package/dist/chunks/benchmark.B3N2zMcH.js +40 -0
  127. package/dist/chunks/benchmark.d.DAaHLpsq.d.ts +24 -0
  128. package/dist/chunks/browser.d.ChKACdzH.d.ts +59 -0
  129. package/dist/chunks/cac.DVeoLl0M.js +1409 -0
  130. package/dist/chunks/cli-api.B7PN_QUv.js +13672 -0
  131. package/dist/chunks/config.d.Cy95HiCx.d.ts +210 -0
  132. package/dist/chunks/console.Cf-YriPC.js +146 -0
  133. package/dist/chunks/constants.D_Q9UYh-.js +36 -0
  134. package/dist/chunks/coverage.AVPTjMgw.js +3292 -0
  135. package/dist/chunks/coverage.D_JHT54q.js +25 -0
  136. package/dist/chunks/coverage.d.BZtK59WP.d.ts +37 -0
  137. package/dist/chunks/creator.DAmOKTvJ.js +673 -0
  138. package/dist/chunks/date.Bq6ZW5rf.js +73 -0
  139. package/dist/chunks/defaults.BOqNVLsY.js +74 -0
  140. package/dist/chunks/env.D4Lgay0q.js +8 -0
  141. package/dist/chunks/environment.d.CrsxCzP1.d.ts +29 -0
  142. package/dist/chunks/evaluatedModules.Dg1zASAC.js +17 -0
  143. package/dist/chunks/evaluatedModules.d.BxJ5omdx.d.ts +7 -0
  144. package/dist/chunks/git.Bm2pzPAa.js +71 -0
  145. package/dist/chunks/global.d.B15mdLcR.d.ts +99 -0
  146. package/dist/chunks/globals.DOayXfHP.js +30 -0
  147. package/dist/chunks/index.6Qv1eEA6.js +109 -0
  148. package/dist/chunks/index.C5r1PdPD.js +231 -0
  149. package/dist/chunks/index.Chj8NDwU.js +206 -0
  150. package/dist/chunks/index.CyBMJtT7.js +727 -0
  151. package/dist/chunks/index.D3XRDfWc.js +213 -0
  152. package/dist/chunks/index.D4KonVSU.js +6343 -0
  153. package/dist/chunks/index.M8mOzt4Y.js +3839 -0
  154. package/dist/chunks/index.Z5E_ObnR.js +37 -0
  155. package/dist/chunks/init-forks._y3TW739.js +41 -0
  156. package/dist/chunks/init-threads.DBO2kn-p.js +18 -0
  157. package/dist/chunks/init.B6MLFIaN.js +334 -0
  158. package/dist/chunks/inspector.CvyFGlXm.js +53 -0
  159. package/dist/chunks/modules.BJuCwlRJ.js +36 -0
  160. package/dist/chunks/node.Ce0vMQM7.js +14 -0
  161. package/dist/chunks/plugin.d.CtqpEehP.d.ts +38 -0
  162. package/dist/chunks/reporters.d.CWXNI2jG.d.ts +3271 -0
  163. package/dist/chunks/rpc.BoxB0q7B.js +76 -0
  164. package/dist/chunks/rpc.d.RH3apGEf.d.ts +64 -0
  165. package/dist/chunks/setup-common.Cm-kSBVi.js +60 -0
  166. package/dist/chunks/startModuleRunner.DEj0jb3e.js +861 -0
  167. package/dist/chunks/suite.d.BJWk38HB.d.ts +10 -0
  168. package/dist/chunks/test.B8ej_ZHS.js +254 -0
  169. package/dist/chunks/traces.CCmnQaNT.js +217 -0
  170. package/dist/chunks/traces.d.402V_yFI.d.ts +18 -0
  171. package/dist/chunks/utils.DvEY5TfP.js +52 -0
  172. package/dist/chunks/vi.2VT5v0um.js +3919 -0
  173. package/dist/chunks/vm.D3epNOPZ.js +744 -0
  174. package/dist/chunks/worker.d.Dyxm8DEL.d.ts +255 -0
  175. package/dist/cli.js +28 -0
  176. package/dist/client/.vite/manifest.json +24 -0
  177. package/dist/client/__vitest__/assets/index-BUCFJtth.js +57 -0
  178. package/dist/client/__vitest__/assets/index-DlhE0rqZ.css +1 -0
  179. package/dist/client/__vitest__/bg.png +0 -0
  180. package/dist/client/__vitest__/favicon.ico +0 -0
  181. package/dist/client/__vitest__/favicon.svg +5 -0
  182. package/dist/client/__vitest__/index.html +32 -0
  183. package/dist/client/__vitest_browser__/orchestrator-S_3e_uzt.js +345 -0
  184. package/dist/client/__vitest_browser__/tester-k74mgIRa.js +2171 -0
  185. package/dist/client/__vitest_browser__/utils-uxqdqUz8.js +223 -0
  186. package/dist/client/error-catcher.js +82 -0
  187. package/dist/client/esm-client-injector.js +67 -0
  188. package/dist/client/favicon.svg +5 -0
  189. package/dist/client/orchestrator.html +35 -0
  190. package/dist/client/tester/tester.html +13 -0
  191. package/dist/client.js +456 -0
  192. package/dist/config.cjs +94 -0
  193. package/dist/config.d.ts +104 -0
  194. package/dist/config.js +15 -0
  195. package/dist/context.js +541 -0
  196. package/dist/coverage.d.ts +118 -0
  197. package/dist/coverage.js +23 -0
  198. package/dist/dummy.js +2 -0
  199. package/dist/environments.d.ts +22 -0
  200. package/dist/environments.js +3 -0
  201. package/dist/expect-element.js +27 -0
  202. package/dist/index-D6m36C6U.js +6 -0
  203. package/dist/index-node.js +7 -0
  204. package/dist/index.d.ts +510 -0
  205. package/dist/index.js +19 -0
  206. package/dist/locators.d.ts +354 -0
  207. package/dist/locators.js +1 -0
  208. package/dist/mocker.d.ts +1 -0
  209. package/dist/mocker.js +1 -0
  210. package/dist/module-evaluator.d.ts +124 -0
  211. package/dist/module-evaluator.js +343 -0
  212. package/dist/module-runner-stub.js +44 -0
  213. package/dist/module-runner.js +17 -0
  214. package/dist/node.d.ts +251 -0
  215. package/dist/node.js +98 -0
  216. package/dist/path.js +7 -0
  217. package/dist/plugins/browser-client.mjs +2 -0
  218. package/dist/plugins/browser-context.mjs +2 -0
  219. package/dist/plugins/browser-locators.mjs +2 -0
  220. package/dist/plugins/browser-playwright.mjs +2 -0
  221. package/dist/plugins/browser-preview.mjs +2 -0
  222. package/dist/plugins/browser-webdriverio.mjs +2 -0
  223. package/dist/plugins/browser.mjs +2 -0
  224. package/dist/plugins/expect.mjs +2 -0
  225. package/dist/plugins/mocker-automock.mjs +2 -0
  226. package/dist/plugins/mocker-browser.mjs +2 -0
  227. package/dist/plugins/mocker-node.mjs +2 -0
  228. package/dist/plugins/mocker-redirect.mjs +2 -0
  229. package/dist/plugins/mocker-register.mjs +2 -0
  230. package/dist/plugins/mocker.mjs +2 -0
  231. package/dist/plugins/pretty-format.mjs +2 -0
  232. package/dist/plugins/runner-types.mjs +2 -0
  233. package/dist/plugins/runner-utils.mjs +2 -0
  234. package/dist/plugins/runner.mjs +2 -0
  235. package/dist/plugins/snapshot-environment.mjs +2 -0
  236. package/dist/plugins/snapshot-manager.mjs +2 -0
  237. package/dist/plugins/snapshot.mjs +2 -0
  238. package/dist/plugins/spy.mjs +2 -0
  239. package/dist/plugins/utils-constants.mjs +2 -0
  240. package/dist/plugins/utils-diff.mjs +2 -0
  241. package/dist/plugins/utils-display.mjs +2 -0
  242. package/dist/plugins/utils-error.mjs +2 -0
  243. package/dist/plugins/utils-helpers.mjs +2 -0
  244. package/dist/plugins/utils-highlight.mjs +2 -0
  245. package/dist/plugins/utils-offset.mjs +2 -0
  246. package/dist/plugins/utils-resolver.mjs +2 -0
  247. package/dist/plugins/utils-serialize.mjs +2 -0
  248. package/dist/plugins/utils-source-map.mjs +2 -0
  249. package/dist/plugins/utils-timers.mjs +2 -0
  250. package/dist/plugins/utils.mjs +2 -0
  251. package/dist/reporters.d.ts +27 -0
  252. package/dist/reporters.js +24 -0
  253. package/dist/runners.d.ts +50 -0
  254. package/dist/runners.js +19 -0
  255. package/dist/shared/screenshotMatcher/types.d.ts +22 -0
  256. package/dist/snapshot.d.ts +9 -0
  257. package/dist/snapshot.js +4 -0
  258. package/dist/spy.js +1 -0
  259. package/dist/state.js +280 -0
  260. package/dist/suite.d.ts +5 -0
  261. package/dist/suite.js +6 -0
  262. package/dist/types.d.ts +69 -0
  263. package/dist/vendor/chai.d.mts +1 -0
  264. package/dist/vendor/chai.mjs +3577 -0
  265. package/dist/vendor/es-module-lexer.d.mts +193 -0
  266. package/dist/vendor/es-module-lexer.mjs +79 -0
  267. package/dist/vendor/estree-walker.d.mts +583 -0
  268. package/dist/vendor/estree-walker.mjs +339 -0
  269. package/dist/vendor/expect-type.d.mts +1574 -0
  270. package/dist/vendor/expect-type.mjs +214 -0
  271. package/dist/vendor/magic-string.d.mts +261 -0
  272. package/dist/vendor/magic-string.mjs +1700 -0
  273. package/dist/vendor/obug.d.mts +56 -0
  274. package/dist/vendor/obug.mjs +276 -0
  275. package/dist/vendor/pathe.d.mts +46 -0
  276. package/dist/vendor/pathe.mjs +496 -0
  277. package/dist/vendor/picomatch.d.mts +1 -0
  278. package/dist/vendor/picomatch.mjs +1855 -0
  279. package/dist/vendor/shared-3g9mwCWP.mjs +31 -0
  280. package/dist/vendor/std-env.d.mts +88 -0
  281. package/dist/vendor/std-env.mjs +159 -0
  282. package/dist/vendor/tinybench.d.mts +317 -0
  283. package/dist/vendor/tinybench.mjs +504 -0
  284. package/dist/vendor/tinyexec.d.mts +72 -0
  285. package/dist/vendor/tinyexec.mjs +637 -0
  286. package/dist/vendor/tinyglobby.d.mts +157 -0
  287. package/dist/vendor/tinyglobby.mjs +832 -0
  288. package/dist/vendor/tinyrainbow.d.mts +60 -0
  289. package/dist/vendor/tinyrainbow.mjs +93 -0
  290. package/dist/vendor/vitest_browser.mjs +2 -0
  291. package/dist/vendor/vitest_internal_browser.mjs +2 -0
  292. package/dist/vendor/vitest_runner.mjs +2 -0
  293. package/dist/vendor/vitest_runners.mjs +2 -0
  294. package/dist/worker.d.ts +32 -0
  295. package/dist/worker.js +48 -0
  296. package/dist/workers/forks.js +54 -0
  297. package/dist/workers/runVmTests.js +95 -0
  298. package/dist/workers/threads.js +55 -0
  299. package/dist/workers/vmForks.js +36 -0
  300. package/dist/workers/vmThreads.js +37 -0
  301. package/environments.d.ts +1 -0
  302. package/globals.d.ts +20 -0
  303. package/import-meta.d.ts +5 -0
  304. package/importMeta.d.ts +4 -0
  305. package/index.cjs +5 -0
  306. package/index.d.cts +1 -0
  307. package/jsdom.d.ts +6 -0
  308. package/mocker.d.ts +1 -0
  309. package/node.d.ts +1 -0
  310. package/optional-types.d.ts +7 -0
  311. package/package.json +335 -0
  312. package/reporters.d.ts +1 -0
  313. package/runners.d.ts +1 -0
  314. package/snapshot.d.ts +1 -0
  315. package/suite.d.ts +1 -0
  316. package/suppress-warnings.cjs +21 -0
  317. package/vitest.mjs +2 -0
  318. package/worker.d.ts +1 -0
@@ -0,0 +1,37 @@
1
+ import { b as assert, c as createExpect, g as globalExpect, i as inject, s as should, v as vi, d as vitest } from './vi.2VT5v0um.js';
2
+ import { b as bench } from './benchmark.B3N2zMcH.js';
3
+ import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
4
+ import { expectTypeOf } from '../vendor/expect-type.mjs';
5
+ import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, recordArtifact, suite, test } from '../@vitest/runner/index.js';
6
+ import { chai } from '../@vitest/expect/index.js';
7
+
8
+ const assertType = function assertType() {};
9
+
10
+ var index = /*#__PURE__*/Object.freeze({
11
+ __proto__: null,
12
+ EvaluatedModules: VitestEvaluatedModules,
13
+ afterAll: afterAll,
14
+ afterEach: afterEach,
15
+ assert: assert,
16
+ assertType: assertType,
17
+ beforeAll: beforeAll,
18
+ beforeEach: beforeEach,
19
+ bench: bench,
20
+ chai: chai,
21
+ createExpect: createExpect,
22
+ describe: describe,
23
+ expect: globalExpect,
24
+ expectTypeOf: expectTypeOf,
25
+ inject: inject,
26
+ it: it,
27
+ onTestFailed: onTestFailed,
28
+ onTestFinished: onTestFinished,
29
+ recordArtifact: recordArtifact,
30
+ should: should,
31
+ suite: suite,
32
+ test: test,
33
+ vi: vi,
34
+ vitest: vitest
35
+ });
36
+
37
+ export { assertType as a, index as i };
@@ -0,0 +1,41 @@
1
+ import { i as init } from './init.B6MLFIaN.js';
2
+
3
+ if (!process.send) throw new Error("Expected worker to be run in node:child_process");
4
+ // Store globals in case tests overwrite them
5
+ const processExit = process.exit.bind(process);
6
+ const processSend = process.send.bind(process);
7
+ const processOn = process.on.bind(process);
8
+ const processOff = process.off.bind(process);
9
+ const processRemoveAllListeners = process.removeAllListeners.bind(process);
10
+ // Work-around for nodejs/node#55094
11
+ if (process.execArgv.some((execArg) => execArg.startsWith("--prof") || execArg.startsWith("--cpu-prof") || execArg.startsWith("--heap-prof") || execArg.startsWith("--diagnostic-dir"))) processOn("SIGTERM", () => processExit());
12
+ processOn("error", onError);
13
+ function workerInit(options) {
14
+ const { runTests } = options;
15
+ init({
16
+ post: (v) => processSend(v),
17
+ on: (cb) => processOn("message", cb),
18
+ off: (cb) => processOff("message", cb),
19
+ teardown: () => {
20
+ processRemoveAllListeners("message");
21
+ processOff("error", onError);
22
+ },
23
+ runTests: (state, traces) => executeTests("run", state, traces),
24
+ collectTests: (state, traces) => executeTests("collect", state, traces),
25
+ setup: options.setup
26
+ });
27
+ async function executeTests(method, state, traces) {
28
+ try {
29
+ await runTests(method, state, traces);
30
+ } finally {
31
+ process.exit = processExit;
32
+ }
33
+ }
34
+ }
35
+ // Prevent leaving worker in loops where it tries to send message to closed main
36
+ // thread, errors, and tries to send the error.
37
+ function onError(error) {
38
+ if (error?.code === "ERR_IPC_CHANNEL_CLOSED" || error?.code === "EPIPE") processExit(1);
39
+ }
40
+
41
+ export { workerInit as w };
@@ -0,0 +1,18 @@
1
+ import { isMainThread, parentPort } from 'node:worker_threads';
2
+ import { i as init } from './init.B6MLFIaN.js';
3
+
4
+ if (isMainThread || !parentPort) throw new Error("Expected worker to be run in node:worker_threads");
5
+ function workerInit(options) {
6
+ const { runTests } = options;
7
+ init({
8
+ post: (response) => parentPort.postMessage(response),
9
+ on: (callback) => parentPort.on("message", callback),
10
+ off: (callback) => parentPort.off("message", callback),
11
+ teardown: () => parentPort.removeAllListeners("message"),
12
+ runTests: async (state, traces) => runTests("run", state, traces),
13
+ collectTests: async (state, traces) => runTests("collect", state, traces),
14
+ setup: options.setup
15
+ });
16
+ }
17
+
18
+ export { workerInit as w };
@@ -0,0 +1,334 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { isBuiltin } from 'node:module';
3
+ import { pathToFileURL } from 'node:url';
4
+ import { resolve } from '../vendor/pathe.mjs';
5
+ import { ModuleRunner } from '@voidzero-dev/vite-plus-core/module-runner';
6
+ import { b as VitestTransport } from './startModuleRunner.DEj0jb3e.js';
7
+ import { e as environments } from './index.CyBMJtT7.js';
8
+ import { serializeError } from '../@vitest/utils/error.js';
9
+ import { T as Traces } from './traces.CCmnQaNT.js';
10
+ import { o as onCancel, a as rpcDone, c as createRuntimeRpc } from './rpc.BoxB0q7B.js';
11
+ import { createStackString, parseStacktrace } from '../@vitest/utils/source-map.js';
12
+ import { s as setupInspect } from './inspector.CvyFGlXm.js';
13
+ import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
14
+
15
+ function isBuiltinEnvironment(env) {
16
+ return env in environments;
17
+ }
18
+ const isWindows = process.platform === "win32";
19
+ const _loaders = /* @__PURE__ */ new Map();
20
+ function createEnvironmentLoader(root, rpc) {
21
+ const cachedLoader = _loaders.get(root);
22
+ if (!cachedLoader || cachedLoader.isClosed()) {
23
+ _loaders.delete(root);
24
+ const moduleRunner = new ModuleRunner({
25
+ hmr: false,
26
+ sourcemapInterceptor: "prepareStackTrace",
27
+ transport: new VitestTransport({
28
+ async fetchModule(id, importer, options) {
29
+ const result = await rpc.fetch(id, importer, "__vitest__", options);
30
+ if ("cached" in result) return {
31
+ code: readFileSync(result.tmp, "utf-8"),
32
+ ...result
33
+ };
34
+ if (isWindows && "externalize" in result)
35
+ // TODO: vitest returns paths for external modules, but Vite returns file://
36
+ // https://github.com/vitejs/vite/pull/20449
37
+ result.externalize = isBuiltin(id) || /^(?:node:|data:|http:|https:|file:)/.test(id) ? result.externalize : pathToFileURL(result.externalize).toString();
38
+ return result;
39
+ },
40
+ async resolveId(id, importer) {
41
+ return rpc.resolve(id, importer, "__vitest__");
42
+ }
43
+ })
44
+ });
45
+ _loaders.set(root, moduleRunner);
46
+ }
47
+ return _loaders.get(root);
48
+ }
49
+ async function loadEnvironment(name, root, rpc, traces) {
50
+ if (isBuiltinEnvironment(name)) return { environment: environments[name] };
51
+ const loader = createEnvironmentLoader(root, rpc);
52
+ const packageId = name[0] === "." || name[0] === "/" ? resolve(root, name) : (await traces.$("vitest.runtime.environment.resolve", () => rpc.resolve(`vitest-environment-${name}`, void 0, "__vitest__")))?.id ?? resolve(root, name);
53
+ const pkg = await traces.$("vitest.runtime.environment.import", () => loader.import(packageId));
54
+ if (!pkg || !pkg.default || typeof pkg.default !== "object") throw new TypeError(`Environment "${name}" is not a valid environment. Path "${packageId}" should export default object with a "setup" or/and "setupVM" method.`);
55
+ const environment = pkg.default;
56
+ if (environment.transformMode != null && environment.transformMode !== "web" && environment.transformMode !== "ssr") throw new TypeError(`Environment "${name}" is not a valid environment. Path "${packageId}" should export default object with a "transformMode" method equal to "ssr" or "web", received "${environment.transformMode}".`);
57
+ if (environment.transformMode) {
58
+ console.warn(`The Vitest environment ${environment.name} defines the "transformMode". This options was deprecated in Vitest 4 and will be removed in the next major version. Please, use "viteEnvironment" instead.`);
59
+ // keep for backwards compat
60
+ environment.viteEnvironment ??= environment.transformMode === "ssr" ? "ssr" : "client";
61
+ }
62
+ return {
63
+ environment,
64
+ loader
65
+ };
66
+ }
67
+
68
+ const cleanupListeners = /* @__PURE__ */ new Set();
69
+ const moduleRunnerListeners = /* @__PURE__ */ new Set();
70
+ function onCleanup(cb) {
71
+ cleanupListeners.add(cb);
72
+ }
73
+ async function cleanup() {
74
+ await Promise.all([...cleanupListeners].map((l) => l()));
75
+ }
76
+ function onModuleRunner(cb) {
77
+ moduleRunnerListeners.add(cb);
78
+ }
79
+ function emitModuleRunner(moduleRunner) {
80
+ moduleRunnerListeners.forEach((l) => l(moduleRunner));
81
+ }
82
+
83
+ const resolvingModules = /* @__PURE__ */ new Set();
84
+ async function execute(method, ctx, worker, traces) {
85
+ const prepareStart = performance.now();
86
+ const cleanups = [setupInspect(ctx)];
87
+ // RPC is used to communicate between worker (be it a thread worker or child process or a custom implementation) and the main thread
88
+ const rpc = ctx.rpc;
89
+ try {
90
+ // do not close the RPC channel so that we can get the error messages sent to the main thread
91
+ cleanups.push(async () => {
92
+ await Promise.all(rpc.$rejectPendingCalls(({ method, reject }) => {
93
+ reject(/* @__PURE__ */ new Error(`[vitest-worker]: Closing rpc while "${method}" was pending`));
94
+ }));
95
+ });
96
+ const state = {
97
+ ctx,
98
+ evaluatedModules: new VitestEvaluatedModules(),
99
+ resolvingModules,
100
+ moduleExecutionInfo: /* @__PURE__ */ new Map(),
101
+ config: ctx.config,
102
+ environment: null,
103
+ durations: {
104
+ environment: 0,
105
+ prepare: prepareStart
106
+ },
107
+ rpc,
108
+ onCancel,
109
+ onCleanup: onCleanup,
110
+ providedContext: ctx.providedContext,
111
+ onFilterStackTrace(stack) {
112
+ return createStackString(parseStacktrace(stack));
113
+ },
114
+ metaEnv: createImportMetaEnvProxy()
115
+ };
116
+ const methodName = method === "collect" ? "collectTests" : "runTests";
117
+ if (!worker[methodName] || typeof worker[methodName] !== "function") throw new TypeError(`Test worker should expose "runTests" method. Received "${typeof worker.runTests}".`);
118
+ await worker[methodName](state, traces);
119
+ } finally {
120
+ await rpcDone().catch(() => {});
121
+ await Promise.all(cleanups.map((fn) => fn())).catch(() => {});
122
+ }
123
+ }
124
+ function run(ctx, worker, traces) {
125
+ return execute("run", ctx, worker, traces);
126
+ }
127
+ function collect(ctx, worker, traces) {
128
+ return execute("collect", ctx, worker, traces);
129
+ }
130
+ async function teardown() {
131
+ await cleanup();
132
+ }
133
+ const env = process.env;
134
+ function createImportMetaEnvProxy() {
135
+ // packages/vitest/src/node/plugins/index.ts:146
136
+ const booleanKeys = [
137
+ "DEV",
138
+ "PROD",
139
+ "SSR"
140
+ ];
141
+ return new Proxy(env, {
142
+ get(_, key) {
143
+ if (typeof key !== "string") return;
144
+ if (booleanKeys.includes(key)) return !!process.env[key];
145
+ return process.env[key];
146
+ },
147
+ set(_, key, value) {
148
+ if (typeof key !== "string") return true;
149
+ if (booleanKeys.includes(key)) process.env[key] = value ? "1" : "";
150
+ else process.env[key] = value;
151
+ return true;
152
+ }
153
+ });
154
+ }
155
+
156
+ const __vitest_worker_response__ = true;
157
+ const memoryUsage = process.memoryUsage.bind(process);
158
+ let reportMemory = false;
159
+ let traces;
160
+ /** @experimental */
161
+ function init(worker) {
162
+ worker.on(onMessage);
163
+ if (worker.onModuleRunner) onModuleRunner(worker.onModuleRunner);
164
+ let runPromise;
165
+ let isRunning = false;
166
+ let workerTeardown;
167
+ let setupContext;
168
+ function send(response) {
169
+ worker.post(worker.serialize ? worker.serialize(response) : response);
170
+ }
171
+ async function onMessage(rawMessage) {
172
+ const message = worker.deserialize ? worker.deserialize(rawMessage) : rawMessage;
173
+ if (message?.__vitest_worker_request__ !== true) return;
174
+ switch (message.type) {
175
+ case "start": {
176
+ process.env.VITEST_POOL_ID = String(message.poolId);
177
+ process.env.VITEST_WORKER_ID = String(message.workerId);
178
+ reportMemory = message.options.reportMemory;
179
+ traces ??= await new Traces({
180
+ enabled: message.traces.enabled,
181
+ sdkPath: message.traces.sdkPath
182
+ }).waitInit();
183
+ const { environment, config, pool } = message.context;
184
+ const context = traces.getContextFromCarrier(message.traces.otelCarrier);
185
+ // record telemetry as part of "start"
186
+ traces.recordInitSpan(context);
187
+ try {
188
+ setupContext = {
189
+ environment,
190
+ config,
191
+ pool,
192
+ rpc: createRuntimeRpc(worker),
193
+ projectName: config.name || "",
194
+ traces
195
+ };
196
+ workerTeardown = await traces.$("vitest.runtime.setup", { context }, () => worker.setup?.(setupContext));
197
+ send({
198
+ type: "started",
199
+ __vitest_worker_response__
200
+ });
201
+ } catch (error) {
202
+ send({
203
+ type: "started",
204
+ __vitest_worker_response__,
205
+ error: serializeError(error)
206
+ });
207
+ }
208
+ break;
209
+ }
210
+ case "run":
211
+ // Prevent concurrent execution if worker is already running
212
+ if (isRunning) {
213
+ send({
214
+ type: "testfileFinished",
215
+ __vitest_worker_response__,
216
+ error: serializeError(/* @__PURE__ */ new Error("[vitest-worker]: Worker is already running tests"))
217
+ });
218
+ return;
219
+ }
220
+ try {
221
+ process.env.VITEST_WORKER_ID = String(message.context.workerId);
222
+ } catch (error) {
223
+ return send({
224
+ type: "testfileFinished",
225
+ __vitest_worker_response__,
226
+ error: serializeError(error),
227
+ usedMemory: reportMemory ? memoryUsage().heapUsed : void 0
228
+ });
229
+ }
230
+ isRunning = true;
231
+ try {
232
+ const tracesContext = traces.getContextFromCarrier(message.otelCarrier);
233
+ runPromise = traces.$("vitest.runtime.run", {
234
+ context: tracesContext,
235
+ attributes: {
236
+ "vitest.worker.specifications": traces.isEnabled() ? getFilesWithLocations(message.context.files) : [],
237
+ "vitest.worker.id": message.context.workerId
238
+ }
239
+ }, () => run({
240
+ ...setupContext,
241
+ ...message.context
242
+ }, worker, traces).catch((error) => serializeError(error)));
243
+ send({
244
+ type: "testfileFinished",
245
+ __vitest_worker_response__,
246
+ error: await runPromise,
247
+ usedMemory: reportMemory ? memoryUsage().heapUsed : void 0
248
+ });
249
+ } finally {
250
+ runPromise = void 0;
251
+ isRunning = false;
252
+ }
253
+ break;
254
+ case "collect":
255
+ // Prevent concurrent execution if worker is already running
256
+ if (isRunning) {
257
+ send({
258
+ type: "testfileFinished",
259
+ __vitest_worker_response__,
260
+ error: serializeError(/* @__PURE__ */ new Error("[vitest-worker]: Worker is already running tests"))
261
+ });
262
+ return;
263
+ }
264
+ try {
265
+ process.env.VITEST_WORKER_ID = String(message.context.workerId);
266
+ } catch (error) {
267
+ return send({
268
+ type: "testfileFinished",
269
+ __vitest_worker_response__,
270
+ error: serializeError(error),
271
+ usedMemory: reportMemory ? memoryUsage().heapUsed : void 0
272
+ });
273
+ }
274
+ isRunning = true;
275
+ try {
276
+ const tracesContext = traces.getContextFromCarrier(message.otelCarrier);
277
+ runPromise = traces.$("vitest.runtime.collect", {
278
+ context: tracesContext,
279
+ attributes: {
280
+ "vitest.worker.specifications": traces.isEnabled() ? getFilesWithLocations(message.context.files) : [],
281
+ "vitest.worker.id": message.context.workerId
282
+ }
283
+ }, () => collect({
284
+ ...setupContext,
285
+ ...message.context
286
+ }, worker, traces).catch((error) => serializeError(error)));
287
+ send({
288
+ type: "testfileFinished",
289
+ __vitest_worker_response__,
290
+ error: await runPromise,
291
+ usedMemory: reportMemory ? memoryUsage().heapUsed : void 0
292
+ });
293
+ } finally {
294
+ runPromise = void 0;
295
+ isRunning = false;
296
+ }
297
+ break;
298
+ case "stop":
299
+ await runPromise;
300
+ try {
301
+ const context = traces.getContextFromCarrier(message.otelCarrier);
302
+ const error = await traces.$("vitest.runtime.teardown", { context }, async () => {
303
+ const error = await teardown().catch((error) => serializeError(error));
304
+ await workerTeardown?.();
305
+ return error;
306
+ });
307
+ await traces.finish();
308
+ send({
309
+ type: "stopped",
310
+ error,
311
+ __vitest_worker_response__
312
+ });
313
+ } catch (error) {
314
+ send({
315
+ type: "stopped",
316
+ error: serializeError(error),
317
+ __vitest_worker_response__
318
+ });
319
+ }
320
+ worker.teardown?.();
321
+ break;
322
+ }
323
+ }
324
+ }
325
+ function getFilesWithLocations(files) {
326
+ return files.flatMap((file) => {
327
+ if (!file.testLocations) return file.filepath;
328
+ return file.testLocations.map((location) => {
329
+ return `${file}:${location}`;
330
+ });
331
+ });
332
+ }
333
+
334
+ export { emitModuleRunner as e, init as i, loadEnvironment as l };
@@ -0,0 +1,53 @@
1
+ import { createRequire } from 'node:module';
2
+ import { pathToFileURL } from 'node:url';
3
+
4
+ const __require = createRequire(import.meta.url);
5
+ let inspector;
6
+ let session;
7
+ /**
8
+ * Enables debugging inside `worker_threads` and `child_process`.
9
+ * Should be called as early as possible when worker/process has been set up.
10
+ */
11
+ function setupInspect(ctx) {
12
+ const config = ctx.config;
13
+ const isEnabled = config.inspector.enabled;
14
+ if (isEnabled) {
15
+ inspector = __require("node:inspector");
16
+ if (!(inspector.url() !== void 0)) {
17
+ inspector.open(config.inspector.port, config.inspector.host, config.inspector.waitForDebugger);
18
+ if (config.inspectBrk) {
19
+ const firstTestFile = typeof ctx.files[0] === "string" ? ctx.files[0] : ctx.files[0].filepath;
20
+ // Stop at first test file
21
+ if (firstTestFile) {
22
+ session = new inspector.Session();
23
+ session.connect();
24
+ session.post("Debugger.enable");
25
+ session.post("Debugger.setBreakpointByUrl", {
26
+ lineNumber: 0,
27
+ url: pathToFileURL(firstTestFile)
28
+ });
29
+ }
30
+ }
31
+ }
32
+ }
33
+ const keepOpen = shouldKeepOpen(config);
34
+ return function cleanup() {
35
+ if (isEnabled && !keepOpen && inspector) {
36
+ inspector.close();
37
+ session?.disconnect();
38
+ }
39
+ };
40
+ }
41
+ function closeInspector(config) {
42
+ const keepOpen = shouldKeepOpen(config);
43
+ if (inspector && !keepOpen) {
44
+ inspector.close();
45
+ session?.disconnect();
46
+ }
47
+ }
48
+ function shouldKeepOpen(config) {
49
+ // In watch mode the inspector can persist re-runs if isolation is disabled and a single worker is used
50
+ return config.watch && config.isolate === false && config.maxWorkers === 1;
51
+ }
52
+
53
+ export { closeInspector as c, setupInspect as s };
@@ -0,0 +1,36 @@
1
+ import { builtinModules } from 'node:module';
2
+
3
+ // copied from vite
4
+ // https://github.com/vitejs/vite/blob/814120f2ad387ca3d1e16c7dd403b04ca4b97f75/packages/vite/src/node/utils.ts#L106
5
+ // Supported by Node, Deno, Bun
6
+ const NODE_BUILTIN_NAMESPACE = "node:";
7
+ // Supported by Deno
8
+ const NPM_BUILTIN_NAMESPACE = "npm:";
9
+ // Supported by Bun
10
+ const BUN_BUILTIN_NAMESPACE = "bun:";
11
+ // Some runtimes like Bun injects namespaced modules here, which is not a node builtin
12
+ const nodeBuiltins = builtinModules.filter((id) => !id.includes(":"));
13
+ const { bun: isBun, deno: isDeno } = process.versions;
14
+ // TODO: Use `isBuiltin` from `node:module`, but Deno doesn't support it
15
+ function isBuiltin(id) {
16
+ if (isDeno && id.startsWith(NPM_BUILTIN_NAMESPACE)) return true;
17
+ if (isBun && id.startsWith(BUN_BUILTIN_NAMESPACE)) return true;
18
+ return isNodeBuiltin(id);
19
+ }
20
+ function isNodeBuiltin(id) {
21
+ if (id.startsWith(NODE_BUILTIN_NAMESPACE)) return true;
22
+ return nodeBuiltins.includes(id);
23
+ }
24
+ const browserExternalId = "__vite-browser-external";
25
+ const browserExternalLength = 24;
26
+ function isBrowserExternal(id) {
27
+ return id.startsWith(browserExternalId);
28
+ }
29
+ function toBuiltin(id) {
30
+ if (id.startsWith(browserExternalId)) id = id.slice(browserExternalLength);
31
+ if (id.startsWith(NPM_BUILTIN_NAMESPACE) || id.startsWith(BUN_BUILTIN_NAMESPACE) || id.startsWith(NODE_BUILTIN_NAMESPACE)) return id;
32
+ if (isDeno || isBun) return id;
33
+ return `node:${id}`;
34
+ }
35
+
36
+ export { isBrowserExternal as a, isBuiltin as i, toBuiltin as t };
@@ -0,0 +1,14 @@
1
+ import { NodeSnapshotEnvironment } from '../@vitest/snapshot/environment.js';
2
+ import { g as getWorkerState } from './utils.DvEY5TfP.js';
3
+ import '../@vitest/utils/timers.js';
4
+
5
+ class VitestNodeSnapshotEnvironment extends NodeSnapshotEnvironment {
6
+ getHeader() {
7
+ return `// Vitest Snapshot v${this.getVersion()}, https://vitest.dev/guide/snapshot.html`;
8
+ }
9
+ resolvePath(filepath) {
10
+ return getWorkerState().rpc.resolveSnapshotPath(filepath);
11
+ }
12
+ }
13
+
14
+ export { VitestNodeSnapshotEnvironment };
@@ -0,0 +1,38 @@
1
+ import { DevEnvironment } from '@voidzero-dev/vite-plus-core';
2
+ import { V as Vitest, T as TestProject, b as TestProjectConfiguration } from './reporters.d.CWXNI2jG.js';
3
+
4
+ /**
5
+ * Generate a unique cache identifier.
6
+ *
7
+ * Return `false` to disable caching of the file.
8
+ * @experimental
9
+ */
10
+ interface CacheKeyIdGenerator {
11
+ (context: CacheKeyIdGeneratorContext): string | undefined | null | false;
12
+ }
13
+ /**
14
+ * @experimental
15
+ */
16
+ interface CacheKeyIdGeneratorContext {
17
+ environment: DevEnvironment;
18
+ id: string;
19
+ sourceCode: string;
20
+ }
21
+
22
+ interface VitestPluginContext {
23
+ vitest: Vitest;
24
+ project: TestProject;
25
+ injectTestProjects: (config: TestProjectConfiguration | TestProjectConfiguration[]) => Promise<TestProject[]>;
26
+ /**
27
+ * Define a generator that will be applied before hashing the cache key.
28
+ *
29
+ * Use this to make sure Vitest generates correct hash. It is a good idea
30
+ * to define this function if your plugin can be registered with different options.
31
+ *
32
+ * This is called only if `experimental.fsModuleCache` is defined.
33
+ * @experimental
34
+ */
35
+ experimental_defineCacheKeyGenerator: (callback: CacheKeyIdGenerator) => void;
36
+ }
37
+
38
+ export type { CacheKeyIdGenerator as C, VitestPluginContext as V, CacheKeyIdGeneratorContext as a };