@gfdelarue/testkit 0.4.4 → 0.5.0

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 (817) hide show
  1. package/README.md +752 -462
  2. package/bin/testkit-windows-owner-arm64.exe +0 -0
  3. package/bin/testkit-windows-owner-x64.exe +0 -0
  4. package/dist/app/bugs/categories.js +1 -1
  5. package/dist/app/bugs/ci-report.js +2 -2
  6. package/dist/app/bugs/ci-summary.js +3 -3
  7. package/dist/app/bugs/draft.js +4 -4
  8. package/dist/app/bugs/facts.js +2 -2
  9. package/dist/app/bugs/file.js +1 -1
  10. package/dist/app/bugs/gate.js +1 -1
  11. package/dist/app/bugs/guide.js +3 -3
  12. package/dist/app/bugs/issue.js +4 -4
  13. package/dist/app/bugs/known-failures.js +1 -1
  14. package/dist/app/bugs/record.js +2 -2
  15. package/dist/app/bugs/run-reading.js +1 -1
  16. package/dist/app/bugs/supplied-reproduce.js +1 -0
  17. package/dist/app/campaigns/campaign.js +1 -1
  18. package/dist/app/cleanup/index.js +1 -1
  19. package/dist/app/db-schema/prepare.js +1 -1
  20. package/dist/app/destroy/index.js +1 -1
  21. package/dist/app/discover/index.js +2 -2
  22. package/dist/app/doctor/index.js +1 -1
  23. package/dist/app/environments/config-driven.js +1 -0
  24. package/dist/app/environments/environment-file.js +1 -0
  25. package/dist/app/environments/file-setup.js +1 -0
  26. package/dist/app/environments/routing.js +1 -0
  27. package/dist/app/environments/static-values.js +1 -0
  28. package/dist/app/environments/supplied-input.js +1 -0
  29. package/dist/app/environments/supplied.js +1 -0
  30. package/dist/app/environments/task-databases.js +2 -0
  31. package/dist/app/file-selection.js +1 -1
  32. package/dist/app/inspect/artifacts.js +1 -1
  33. package/dist/app/inspect/index.js +1 -1
  34. package/dist/app/lint/index.js +1 -1
  35. package/dist/app/lint/native.js +1 -1
  36. package/dist/app/lint/options.js +1 -1
  37. package/dist/app/lint/rules/data.js +1 -1
  38. package/dist/app/lint/rules/engine-imports.js +1 -1
  39. package/dist/app/lint/rules/syntax.js +1 -1
  40. package/dist/app/lint/rules/unit.js +1 -1
  41. package/dist/app/lint/shared.js +1 -1
  42. package/dist/app/package-inspection.js +1 -1
  43. package/dist/app/reports/files.js +1 -0
  44. package/dist/app/reports/prepare.js +2 -0
  45. package/dist/app/reports/publish.js +1 -0
  46. package/dist/app/run/caller-redaction.js +1 -0
  47. package/dist/app/run/engine-evidence-persistence.js +1 -1
  48. package/dist/app/run/engine-execution-failures.js +1 -1
  49. package/dist/app/run/engine-execution-reporting.js +1 -1
  50. package/dist/app/run/engine-execution.js +1 -1
  51. package/dist/app/run/engine-orchestration.js +1 -1
  52. package/dist/app/run/environment.js +1 -0
  53. package/dist/app/run/failure-details.js +1 -1
  54. package/dist/app/run/live-run.js +1 -1
  55. package/dist/app/run/orchestrator.js +1 -1
  56. package/dist/app/run/planning.js +1 -1
  57. package/dist/app/run/request.js +1 -1
  58. package/dist/app/run/results.js +1 -1
  59. package/dist/app/run/run-events.js +1 -1
  60. package/dist/app/run/run-finalization.js +1 -1
  61. package/dist/app/run/runtime-fixtures.js +1 -1
  62. package/dist/app/run/scheduler/estimates.js +1 -1
  63. package/dist/app/run/scheduler/identity.js +1 -1
  64. package/dist/app/run/scheduler/index.js +1 -1
  65. package/dist/app/run/scheduler/locks.js +1 -0
  66. package/dist/app/run/selection.js +1 -1
  67. package/dist/app/run/setup/runtime-node-setup-protocol.js +1 -1
  68. package/dist/app/run/setup/runtime-node-setup-worker.js +1 -1
  69. package/dist/app/run/setup/runtime-node-setup.js +2 -2
  70. package/dist/app/run/task-batches.js +1 -1
  71. package/dist/app/run/task-leases.js +1 -0
  72. package/dist/app/run/worker-loop.js +1 -1
  73. package/dist/app/status/runs.js +1 -1
  74. package/dist/app/tracker/index.js +1 -1
  75. package/dist/app/typecheck/index.js +4 -4
  76. package/dist/cli/command-catalog.js +1 -1
  77. package/dist/cli/command-flags.js +1 -1
  78. package/dist/cli/command-registry.js +1 -1
  79. package/dist/cli/commands/artifacts.js +2 -2
  80. package/dist/cli/commands/bug/file.js +2 -2
  81. package/dist/cli/commands/bug/record.js +2 -2
  82. package/dist/cli/commands/discover.js +1 -1
  83. package/dist/cli/commands/report/prepare.js +5 -0
  84. package/dist/cli/commands/report/publish.js +2 -0
  85. package/dist/cli/commands/run.js +2 -2
  86. package/dist/cli/commands/typecheck.js +1 -1
  87. package/dist/cli/commands/workspace.js +1 -1
  88. package/dist/cli/framework/errors.js +1 -1
  89. package/dist/cli/framework/execute.js +7 -6
  90. package/dist/cli/framework/parser.js +1 -1
  91. package/dist/cli/json-errors.js +1 -1
  92. package/dist/cli/operations/run/operation.js +2 -2
  93. package/dist/cli/renderers/bug/text.js +1 -1
  94. package/dist/cli/renderers/discover/report.js +1 -1
  95. package/dist/cli/renderers/doctor/text.js +1 -1
  96. package/dist/cli/renderers/run/events.js +2 -2
  97. package/dist/cli/renderers/run/formatting.js +1 -1
  98. package/dist/cli/renderers/run/status.js +1 -1
  99. package/dist/cli/renderers/run/text-reporter.js +24 -22
  100. package/dist/cli/terminal/colors.js +1 -1
  101. package/dist/cli/terminal/layout.js +2 -2
  102. package/dist/config/authoring/http-methods.js +1 -1
  103. package/dist/config/authoring/index.js +1 -1
  104. package/dist/config/authoring/preset-env.js +1 -1
  105. package/dist/config/loader/config-loader.js +1 -1
  106. package/dist/config/loader/database.js +1 -1
  107. package/dist/config/loader/decode-execution.js +1 -1
  108. package/dist/config/loader/dependencies.js +1 -1
  109. package/dist/config/loader/discover-tests.js +1 -1
  110. package/dist/config/loader/discovery-summary.js +1 -1
  111. package/dist/config/loader/discovery.js +2 -2
  112. package/dist/config/loader/env.js +1 -1
  113. package/dist/config/loader/execution-model.js +1 -1
  114. package/dist/config/loader/file-metadata.js +1 -1
  115. package/dist/config/loader/groups.js +1 -0
  116. package/dist/config/loader/index.js +1 -1
  117. package/dist/config/loader/load.js +1 -1
  118. package/dist/config/loader/managed-configs.js +1 -1
  119. package/dist/config/loader/owned-discovery.js +1 -0
  120. package/dist/config/loader/path-policy.js +1 -1
  121. package/dist/config/loader/runtime-isolation.js +1 -1
  122. package/dist/config/loader/runtime.js +1 -1
  123. package/dist/config/loader/skip-config.js +1 -1
  124. package/dist/config/loader/task-policy.js +1 -0
  125. package/dist/config/loader/test-selection.js +1 -1
  126. package/dist/config/loader/validation.js +1 -1
  127. package/dist/database/activity-gate.js +1 -1
  128. package/dist/database/admin.js +2 -2
  129. package/dist/database/bindings.js +1 -0
  130. package/dist/database/cleanup.js +1 -1
  131. package/dist/database/docker-metadata.js +3 -3
  132. package/dist/database/docker.js +3 -3
  133. package/dist/database/index.js +1 -1
  134. package/dist/database/lifecycle-cleanup.js +1 -1
  135. package/dist/database/local-postgres.js +1 -1
  136. package/dist/database/naming.js +1 -1
  137. package/dist/database/postgres/connection-check.js +1 -0
  138. package/dist/database/postgres/protocol.js +2 -0
  139. package/dist/database/schema-operations.js +1 -1
  140. package/dist/database/schema-source.js +3 -3
  141. package/dist/database/source-schema-env.js +1 -0
  142. package/dist/database/source-url.js +2 -2
  143. package/dist/database/state-files.js +1 -1
  144. package/dist/database/state.js +1 -1
  145. package/dist/database/steps.js +3 -3
  146. package/dist/domain/file-timeout.js +1 -1
  147. package/dist/domain/identifiers.js +1 -1
  148. package/dist/domain/operation-display.js +1 -1
  149. package/dist/domain/retired-test-types.js +1 -0
  150. package/dist/domain/runtime-isolation-contract.js +1 -1
  151. package/dist/domain/suite-selection.js +1 -1
  152. package/dist/domain/test-outcomes.js +1 -1
  153. package/dist/domain/test-types.js +1 -1
  154. package/dist/engines/adapters/evidence-files.js +1 -1
  155. package/dist/engines/adapters/evidence-identity.js +1 -1
  156. package/dist/engines/adapters/execution.js +1 -1
  157. package/dist/engines/adapters/json-bounds.js +2 -0
  158. package/dist/engines/adapters/native-report.js +1 -1
  159. package/dist/engines/api/execution-scope.js +1 -1
  160. package/dist/engines/api/execution.js +1 -1
  161. package/dist/engines/api/index.js +1 -1
  162. package/dist/engines/api/runtime-artifact.js +1 -1
  163. package/dist/engines/bundle-cache.js +1 -1
  164. package/dist/engines/catalog.js +1 -1
  165. package/dist/engines/contracts/environment-values.js +1 -0
  166. package/dist/engines/contracts/fixture-manifest.js +1 -1
  167. package/dist/engines/definitions.js +1 -1
  168. package/dist/engines/environment/handles.js +1 -0
  169. package/dist/engines/environment/index.js +1 -0
  170. package/dist/engines/factory.js +1 -1
  171. package/dist/engines/installations/node-vitest.js +1 -1
  172. package/dist/engines/installations/package-resolution.js +1 -1
  173. package/dist/engines/installations/playwright-resolution-child.js +1 -1
  174. package/dist/engines/installations/playwright.js +1 -1
  175. package/dist/engines/managed-module-resolution-policy-input.js +1 -1
  176. package/dist/engines/managed-module-resolution-policy.js +1 -1
  177. package/dist/engines/managed-module-resolution.js +2 -2
  178. package/dist/engines/manager.js +1 -1
  179. package/dist/engines/node-vitest/adapter/adapter.js +1 -1
  180. package/dist/engines/node-vitest/adapter/driver.js +2 -0
  181. package/dist/engines/node-vitest/adapter/evidence.js +2 -2
  182. package/dist/engines/node-vitest/adapter/failure-details.js +4 -2
  183. package/dist/engines/node-vitest/adapter/reporter.js +1 -1
  184. package/dist/engines/node-vitest/adapter/workspace.js +31 -192
  185. package/dist/engines/node-vitest/inventory/index.js +2 -0
  186. package/dist/engines/node-vitest/inventory/list-files.js +3 -0
  187. package/dist/engines/node-vitest/runtime/contract/index.js +1 -1
  188. package/dist/engines/node-vitest/runtime/data/http.js +1 -1
  189. package/dist/engines/node-vitest/runtime/data/index.js +1 -1
  190. package/dist/engines/node-vitest/runtime/data/report.js +5 -6
  191. package/dist/engines/node-vitest/runtime/data/scenario.js +2 -2
  192. package/dist/engines/node-vitest/runtime/runtime-input.js +1 -1
  193. package/dist/engines/node-vitest/selection.js +1 -0
  194. package/dist/engines/playwright/adapter/adapter.js +1 -1
  195. package/dist/engines/playwright/adapter/config.js +4 -4
  196. package/dist/engines/playwright/adapter/evidence-validation.js +1 -1
  197. package/dist/engines/playwright/adapter/evidence.js +1 -1
  198. package/dist/engines/playwright/adapter/reporter.js +1 -1
  199. package/dist/engines/playwright/runtime/config-file.js +1 -1
  200. package/dist/engines/playwright/runtime/config.js +1 -1
  201. package/dist/engines/playwright/runtime/runtime-input.js +43 -20
  202. package/dist/engines/runtime-input-file.js +1 -1
  203. package/dist/environment/lifecycle-artifacts.js +1 -1
  204. package/dist/environment/lifecycle-controller.js +1 -1
  205. package/dist/environment/lifecycle.js +1 -1
  206. package/dist/environment/ports.js +1 -0
  207. package/dist/environment/ready-environment.js +1 -1
  208. package/dist/environment/run-environment.js +1 -1
  209. package/dist/environment/run-stopping.js +1 -1
  210. package/dist/environment/runtime-contexts.js +1 -1
  211. package/dist/environment/runtime-manager.js +1 -1
  212. package/dist/environment/runtime-planning.js +1 -1
  213. package/dist/environment/runtime-preparation.js +1 -1
  214. package/dist/environment/services.js +3 -1
  215. package/dist/environment/state.js +1 -1
  216. package/dist/environment/template.js +1 -1
  217. package/dist/evidence/artifact-config.js +1 -1
  218. package/dist/evidence/artifact-validation.js +1 -1
  219. package/dist/evidence/artifacts.js +2 -2
  220. package/dist/evidence/bundles.js +1 -1
  221. package/dist/evidence/environment-record.js +1 -0
  222. package/dist/evidence/index.js +1 -1
  223. package/dist/evidence/logs.js +2 -2
  224. package/dist/evidence/operation-timings.js +1 -1
  225. package/dist/evidence/read-fields.js +1 -1
  226. package/dist/evidence/read-run.js +1 -1
  227. package/dist/evidence/reading.js +1 -1
  228. package/dist/evidence/redaction.js +4 -0
  229. package/dist/evidence/reporting.js +1 -1
  230. package/dist/evidence/run-model.js +1 -0
  231. package/dist/evidence/storage.js +2 -2
  232. package/dist/evidence/timing.js +1 -1
  233. package/dist/kernel/error-serialization.js +1 -1
  234. package/dist/kernel/redaction-targets.js +1 -0
  235. package/dist/kernel/redaction.js +4 -1
  236. package/dist/kernel/unknown-values.js +1 -1
  237. package/dist/process/environment.js +1 -1
  238. package/dist/process/execa-bundle.json +3 -3
  239. package/dist/process/files/json-file.js +1 -1
  240. package/dist/process/files/paths.js +1 -1
  241. package/dist/process/host/metadata.js +1 -1
  242. package/dist/process/host/platform.js +1 -1
  243. package/dist/process/host-process.js +1 -1
  244. package/dist/process/index.js +1 -1
  245. package/dist/process/lifecycle-fence.js +1 -1
  246. package/dist/process/locks.js +4 -4
  247. package/dist/process/port-listener.js +2 -0
  248. package/dist/process/process-group.js +1 -1
  249. package/dist/process/process-identity.js +1 -1
  250. package/dist/process/process.js +33 -33
  251. package/dist/process/readiness.js +1 -1
  252. package/dist/process/ready-deadline.js +1 -0
  253. package/dist/process/recovery.js +1 -1
  254. package/dist/process/runs/manifest.js +1 -1
  255. package/dist/process/runs/ownership.js +1 -1
  256. package/dist/process/runs/product-state.js +1 -1
  257. package/dist/process/runs/stop.js +1 -1
  258. package/dist/process/service-processes.js +1 -1
  259. package/dist/process/stoppable-settlement.js +1 -0
  260. package/dist/process/url-redaction.js +1 -0
  261. package/dist/process/windows-cli-owner.js +3 -3
  262. package/dist/process/windows-native.js +1 -1
  263. package/dist/repo/ci-environment.js +1 -1
  264. package/dist/repo/fingerprint-policy.js +1 -1
  265. package/dist/repo/managed-git.js +1 -1
  266. package/dist/repo/physical-tree.js +1 -1
  267. package/dist/repo/publish-directory.js +3 -0
  268. package/dist/repo/state.js +4 -4
  269. package/dist/steps/build-config.js +1 -1
  270. package/dist/steps/configured-step-testkit-modules.js +1 -1
  271. package/dist/steps/configured-steps.js +1 -1
  272. package/dist/steps/environment.js +1 -1
  273. package/dist/steps/index.js +1 -1
  274. package/dist/steps/run.js +2 -2
  275. package/dist/toolchains/archive.js +1 -1
  276. package/dist/toolchains/index.js +3 -3
  277. package/dist/toolchains/node-provisioning.js +2 -2
  278. package/dist/toolchains/semver.js +1 -1
  279. package/dist/toolchains/vitest/index.js +1 -1
  280. package/dist/tracker/redaction.js +1 -2
  281. package/dist/{config/runtime/build-assets.d.ts → types/config-build-assets.d.ts} +5 -3
  282. package/dist/{database/steps.d.ts → types/config-database-steps.d.ts} +7 -7
  283. package/dist/{config/runtime/next-runtime-tsconfig.d.ts → types/config-next-runtime-tsconfig.d.ts} +5 -3
  284. package/dist/types/config.d.ts +501 -0
  285. package/dist/types/drizzle.d.ts +13 -0
  286. package/dist/{config/runtime/env/index.d.ts → types/env.d.ts} +22 -20
  287. package/dist/types/environment.d.ts +40 -0
  288. package/dist/types/index.d.ts +21 -0
  289. package/dist/types/node-vitest-contract.d.ts +75 -0
  290. package/dist/types/node-vitest-data.d.ts +407 -0
  291. package/dist/types/playwright.d.ts +130 -0
  292. package/dist/types/tooling-vitest.d.ts +13 -0
  293. package/dist/types/workspace.d.ts +617 -0
  294. package/docs/bug-records.md +83 -81
  295. package/docs/engines.md +213 -0
  296. package/docs/test-types.md +35 -33
  297. package/package.json +22 -29
  298. package/testkit-config-schema.md +403 -171
  299. package/dist/app/bugs/areas.d.ts +0 -38
  300. package/dist/app/bugs/assessment.d.ts +0 -9
  301. package/dist/app/bugs/categories.d.ts +0 -41
  302. package/dist/app/bugs/ci-report.d.ts +0 -21
  303. package/dist/app/bugs/ci-summary.d.ts +0 -13
  304. package/dist/app/bugs/draft.d.ts +0 -70
  305. package/dist/app/bugs/facts.d.ts +0 -48
  306. package/dist/app/bugs/file.d.ts +0 -45
  307. package/dist/app/bugs/gate.d.ts +0 -22
  308. package/dist/app/bugs/guide.d.ts +0 -20
  309. package/dist/app/bugs/issue.d.ts +0 -18
  310. package/dist/app/bugs/known-failures.d.ts +0 -49
  311. package/dist/app/bugs/record.d.ts +0 -14
  312. package/dist/app/bugs/run-reading.d.ts +0 -51
  313. package/dist/app/bugs/store.d.ts +0 -34
  314. package/dist/app/campaigns/brief.d.ts +0 -7
  315. package/dist/app/campaigns/campaign.d.ts +0 -14
  316. package/dist/app/campaigns/index.d.ts +0 -38
  317. package/dist/app/campaigns/store.d.ts +0 -5
  318. package/dist/app/campaigns/summary.d.ts +0 -13
  319. package/dist/app/cleanup/index.d.ts +0 -52
  320. package/dist/app/db-schema/prepare.d.ts +0 -11
  321. package/dist/app/db-schema/refresh.d.ts +0 -17
  322. package/dist/app/db-schema/verify.d.ts +0 -11
  323. package/dist/app/destroy/index.d.ts +0 -16
  324. package/dist/app/discover/index.d.ts +0 -8
  325. package/dist/app/doctor/index.d.ts +0 -17
  326. package/dist/app/file-selection.d.ts +0 -1
  327. package/dist/app/inspect/artifacts.d.ts +0 -30
  328. package/dist/app/inspect/index.d.ts +0 -112
  329. package/dist/app/lint/index.d.ts +0 -28
  330. package/dist/app/lint/native.d.ts +0 -10
  331. package/dist/app/lint/options.d.ts +0 -67
  332. package/dist/app/lint/policy.d.ts +0 -21
  333. package/dist/app/lint/rules/data.d.ts +0 -3
  334. package/dist/app/lint/rules/engine-imports.d.ts +0 -3
  335. package/dist/app/lint/rules/syntax.d.ts +0 -4
  336. package/dist/app/lint/rules/unit.d.ts +0 -3
  337. package/dist/app/lint/shared.d.ts +0 -36
  338. package/dist/app/package-inspection.d.ts +0 -20
  339. package/dist/app/run/endpoint-readiness.d.ts +0 -43
  340. package/dist/app/run/endpoint-readiness.js +0 -1
  341. package/dist/app/run/engine-evidence-persistence.d.ts +0 -39
  342. package/dist/app/run/engine-execution-cleanup.d.ts +0 -8
  343. package/dist/app/run/engine-execution-cleanup.js +0 -1
  344. package/dist/app/run/engine-execution-failures.d.ts +0 -41
  345. package/dist/app/run/engine-execution-observer.d.ts +0 -21
  346. package/dist/app/run/engine-execution-reporting.d.ts +0 -17
  347. package/dist/app/run/engine-execution.d.ts +0 -63
  348. package/dist/app/run/engine-failure-stack.d.ts +0 -1
  349. package/dist/app/run/engine-orchestration.d.ts +0 -49
  350. package/dist/app/run/failure-details.d.ts +0 -37
  351. package/dist/app/run/live-run.d.ts +0 -27
  352. package/dist/app/run/operation-progress.d.ts +0 -13
  353. package/dist/app/run/orchestrator.d.ts +0 -68
  354. package/dist/app/run/planning-types.d.ts +0 -68
  355. package/dist/app/run/planning.d.ts +0 -15
  356. package/dist/app/run/playwright-configuration.d.ts +0 -2
  357. package/dist/app/run/playwright-configuration.js +0 -1
  358. package/dist/app/run/request.d.ts +0 -30
  359. package/dist/app/run/results.d.ts +0 -161
  360. package/dist/app/run/run-events.d.ts +0 -144
  361. package/dist/app/run/run-finalization.d.ts +0 -52
  362. package/dist/app/run/run-guards.d.ts +0 -3
  363. package/dist/app/run/runtime-failures.d.ts +0 -18
  364. package/dist/app/run/runtime-fixtures.d.ts +0 -2
  365. package/dist/app/run/runtime-task-types.d.ts +0 -20
  366. package/dist/app/run/scheduler/estimates.d.ts +0 -32
  367. package/dist/app/run/scheduler/identity.d.ts +0 -9
  368. package/dist/app/run/scheduler/index.d.ts +0 -124
  369. package/dist/app/run/scheduler/observations.d.ts +0 -20
  370. package/dist/app/run/selection.d.ts +0 -10
  371. package/dist/app/run/setup/runtime-node-setup-errors.d.ts +0 -13
  372. package/dist/app/run/setup/runtime-node-setup-protocol.d.ts +0 -85
  373. package/dist/app/run/setup/runtime-node-setup-worker.d.ts +0 -1
  374. package/dist/app/run/setup/runtime-node-setup.d.ts +0 -48
  375. package/dist/app/run/task-batches.d.ts +0 -23
  376. package/dist/app/run/worker-loop.d.ts +0 -57
  377. package/dist/app/setup/playwright.d.ts +0 -22
  378. package/dist/app/status/index.d.ts +0 -9
  379. package/dist/app/status/model.d.ts +0 -29
  380. package/dist/app/status/runs.d.ts +0 -99
  381. package/dist/app/stop/index.d.ts +0 -14
  382. package/dist/app/tracker/index.d.ts +0 -8
  383. package/dist/app/tracker/remote.d.ts +0 -13
  384. package/dist/app/tracker/token.d.ts +0 -7
  385. package/dist/app/typecheck/index.d.ts +0 -63
  386. package/dist/cli/command-catalog.d.ts +0 -137
  387. package/dist/cli/command-flags.d.ts +0 -19
  388. package/dist/cli/command-registry.d.ts +0 -3
  389. package/dist/cli/commands/artifacts.d.ts +0 -48
  390. package/dist/cli/commands/bug/file.d.ts +0 -16
  391. package/dist/cli/commands/bug/guide.d.ts +0 -5
  392. package/dist/cli/commands/bug/record.d.ts +0 -9
  393. package/dist/cli/commands/campaign/finish.d.ts +0 -10
  394. package/dist/cli/commands/campaign/start.d.ts +0 -7
  395. package/dist/cli/commands/campaign/status.d.ts +0 -13
  396. package/dist/cli/commands/ci/report.d.ts +0 -15
  397. package/dist/cli/commands/cleanup.d.ts +0 -13
  398. package/dist/cli/commands/db/schema/refresh.d.ts +0 -2
  399. package/dist/cli/commands/db/schema/verify.d.ts +0 -2
  400. package/dist/cli/commands/destroy.d.ts +0 -9
  401. package/dist/cli/commands/discover.d.ts +0 -2
  402. package/dist/cli/commands/doctor.d.ts +0 -2
  403. package/dist/cli/commands/guard/unsafe-entrypoint.d.ts +0 -2
  404. package/dist/cli/commands/lint.d.ts +0 -2
  405. package/dist/cli/commands/run/status.d.ts +0 -5
  406. package/dist/cli/commands/run/stop.d.ts +0 -7
  407. package/dist/cli/commands/run.d.ts +0 -9
  408. package/dist/cli/commands/setup/playwright.d.ts +0 -2
  409. package/dist/cli/commands/status.d.ts +0 -5
  410. package/dist/cli/commands/stop.d.ts +0 -12
  411. package/dist/cli/commands/typecheck.d.ts +0 -2
  412. package/dist/cli/commands/workspace.d.ts +0 -2
  413. package/dist/cli/entrypoint.d.ts +0 -1
  414. package/dist/cli/framework/command.d.ts +0 -21
  415. package/dist/cli/framework/definitions.d.ts +0 -100
  416. package/dist/cli/framework/errors.d.ts +0 -6
  417. package/dist/cli/framework/execute.d.ts +0 -14
  418. package/dist/cli/framework/help.d.ts +0 -11
  419. package/dist/cli/framework/index.d.ts +0 -3
  420. package/dist/cli/framework/parser.d.ts +0 -6
  421. package/dist/cli/index.d.ts +0 -4
  422. package/dist/cli/json-errors.d.ts +0 -3
  423. package/dist/cli/operations/db/schema/refresh/operation.d.ts +0 -7
  424. package/dist/cli/operations/db/schema/verify/operation.d.ts +0 -7
  425. package/dist/cli/operations/run/operation.d.ts +0 -24
  426. package/dist/cli/process-signal.d.ts +0 -1
  427. package/dist/cli/renderers/bug/text.d.ts +0 -8
  428. package/dist/cli/renderers/campaign/text.d.ts +0 -2
  429. package/dist/cli/renderers/ci/text.d.ts +0 -2
  430. package/dist/cli/renderers/cleanup/format.d.ts +0 -14
  431. package/dist/cli/renderers/db-schema/text.d.ts +0 -4
  432. package/dist/cli/renderers/destroy/text.d.ts +0 -4
  433. package/dist/cli/renderers/discover/report.d.ts +0 -7
  434. package/dist/cli/renderers/discover/text.d.ts +0 -3
  435. package/dist/cli/renderers/doctor/text.d.ts +0 -2
  436. package/dist/cli/renderers/lint/text.d.ts +0 -2
  437. package/dist/cli/renderers/run/events.d.ts +0 -8
  438. package/dist/cli/renderers/run/failure.d.ts +0 -8
  439. package/dist/cli/renderers/run/formatting.d.ts +0 -79
  440. package/dist/cli/renderers/run/status.d.ts +0 -6
  441. package/dist/cli/renderers/run/text-reporter.d.ts +0 -19
  442. package/dist/cli/renderers/status/text.d.ts +0 -2
  443. package/dist/cli/renderers/stop/text.d.ts +0 -7
  444. package/dist/cli/renderers/typecheck/text.d.ts +0 -2
  445. package/dist/cli/terminal/colors.d.ts +0 -10
  446. package/dist/cli/terminal/layout.d.ts +0 -11
  447. package/dist/cli/version-drift.d.ts +0 -25
  448. package/dist/config/authoring/build-config-contract.d.ts +0 -27
  449. package/dist/config/authoring/configured-step-contract.d.ts +0 -18
  450. package/dist/config/authoring/http-execution-contract.d.ts +0 -70
  451. package/dist/config/authoring/http-methods.d.ts +0 -18
  452. package/dist/config/authoring/index.d.ts +0 -381
  453. package/dist/config/authoring/preset-env.d.ts +0 -19
  454. package/dist/config/authoring/runtime.d.ts +0 -64
  455. package/dist/config/loader/bugs.d.ts +0 -15
  456. package/dist/config/loader/config-loader.d.ts +0 -9
  457. package/dist/config/loader/database-materialization.d.ts +0 -19
  458. package/dist/config/loader/database-roles.d.ts +0 -2
  459. package/dist/config/loader/database.d.ts +0 -55
  460. package/dist/config/loader/decode-discovery.d.ts +0 -5
  461. package/dist/config/loader/decode-execution.d.ts +0 -9
  462. package/dist/config/loader/dependencies.d.ts +0 -7
  463. package/dist/config/loader/discover-tests.d.ts +0 -111
  464. package/dist/config/loader/discovery-summary.d.ts +0 -29
  465. package/dist/config/loader/discovery.d.ts +0 -54
  466. package/dist/config/loader/env.d.ts +0 -4
  467. package/dist/config/loader/execution-model.d.ts +0 -16
  468. package/dist/config/loader/file-metadata.d.ts +0 -19
  469. package/dist/config/loader/index.d.ts +0 -10
  470. package/dist/config/loader/load.d.ts +0 -91
  471. package/dist/config/loader/managed-configs.d.ts +0 -23
  472. package/dist/config/loader/path-policy.d.ts +0 -9
  473. package/dist/config/loader/paths.d.ts +0 -5
  474. package/dist/config/loader/runtime-isolation.d.ts +0 -44
  475. package/dist/config/loader/runtime.d.ts +0 -25
  476. package/dist/config/loader/skip-config.d.ts +0 -44
  477. package/dist/config/loader/test-selection.d.ts +0 -15
  478. package/dist/config/loader/validation.d.ts +0 -16
  479. package/dist/config/loader/values.d.ts +0 -4
  480. package/dist/config/loader/values.js +0 -1
  481. package/dist/database/activity-gate.d.ts +0 -22
  482. package/dist/database/admin.d.ts +0 -31
  483. package/dist/database/cleanup.d.ts +0 -36
  484. package/dist/database/configured-steps.d.ts +0 -27
  485. package/dist/database/constants.d.ts +0 -11
  486. package/dist/database/docker-metadata.d.ts +0 -3
  487. package/dist/database/docker.d.ts +0 -65
  488. package/dist/database/drizzle/index.d.ts +0 -13
  489. package/dist/database/fingerprint.d.ts +0 -12
  490. package/dist/database/index.d.ts +0 -39
  491. package/dist/database/lifecycle-cleanup.d.ts +0 -7
  492. package/dist/database/local-postgres.d.ts +0 -71
  493. package/dist/database/naming.d.ts +0 -17
  494. package/dist/database/postgres/index.d.ts +0 -71
  495. package/dist/database/progress.d.ts +0 -6
  496. package/dist/database/roles.d.ts +0 -19
  497. package/dist/database/runtime-config.d.ts +0 -16
  498. package/dist/database/runtime-reservations.d.ts +0 -19
  499. package/dist/database/schema-operations.d.ts +0 -18
  500. package/dist/database/schema-source.d.ts +0 -96
  501. package/dist/database/source-refresh-lock.d.ts +0 -8
  502. package/dist/database/source-url.d.ts +0 -22
  503. package/dist/database/state-files.d.ts +0 -13
  504. package/dist/database/state.d.ts +0 -26
  505. package/dist/database/template-steps.d.ts +0 -39
  506. package/dist/domain/file-timeout.d.ts +0 -28
  507. package/dist/domain/identifiers.d.ts +0 -9
  508. package/dist/domain/operation-display.d.ts +0 -10
  509. package/dist/domain/operation-reason.d.ts +0 -5
  510. package/dist/domain/postgres-route.d.ts +0 -4
  511. package/dist/domain/runtime-identity.d.ts +0 -1
  512. package/dist/domain/runtime-isolation-contract.d.ts +0 -5
  513. package/dist/domain/service-name.d.ts +0 -2
  514. package/dist/domain/suite-selection.d.ts +0 -20
  515. package/dist/domain/test-outcomes.d.ts +0 -3
  516. package/dist/domain/test-types.d.ts +0 -16
  517. package/dist/engines/adapters/evidence-files.d.ts +0 -32
  518. package/dist/engines/adapters/evidence-identity.d.ts +0 -12
  519. package/dist/engines/adapters/execution.d.ts +0 -42
  520. package/dist/engines/adapters/native-report.d.ts +0 -25
  521. package/dist/engines/adapters/node-startup-cache.d.ts +0 -8
  522. package/dist/engines/adapters/workspace.d.ts +0 -4
  523. package/dist/engines/api/capabilities.d.ts +0 -31
  524. package/dist/engines/api/capabilities.js +0 -1
  525. package/dist/engines/api/evidence.d.ts +0 -38
  526. package/dist/engines/api/execution-observer.d.ts +0 -8
  527. package/dist/engines/api/execution-scope.d.ts +0 -17
  528. package/dist/engines/api/execution.d.ts +0 -101
  529. package/dist/engines/api/index.d.ts +0 -5
  530. package/dist/engines/api/k6-runtime-input.d.ts +0 -26
  531. package/dist/engines/api/k6-runtime-input.js +0 -1
  532. package/dist/engines/api/runtime-artifact.d.ts +0 -19
  533. package/dist/engines/bundle-cache.d.ts +0 -32
  534. package/dist/engines/catalog.d.ts +0 -27
  535. package/dist/engines/contracts/fixture-manifest.d.ts +0 -34
  536. package/dist/engines/contracts/json-bounds.d.ts +0 -36
  537. package/dist/engines/contracts/json-bounds.js +0 -2
  538. package/dist/engines/contracts/k6-repository-configuration.d.ts +0 -12
  539. package/dist/engines/contracts/k6-repository-configuration.js +0 -1
  540. package/dist/engines/contracts/test-context.d.ts +0 -15
  541. package/dist/engines/contracts/test-context.js +0 -1
  542. package/dist/engines/definitions.d.ts +0 -22
  543. package/dist/engines/factory.d.ts +0 -6
  544. package/dist/engines/generated-performance.d.ts +0 -1
  545. package/dist/engines/installation-catalog.d.ts +0 -27
  546. package/dist/engines/installation-catalog.js +0 -1
  547. package/dist/engines/installations/k6.d.ts +0 -98
  548. package/dist/engines/installations/k6.js +0 -1
  549. package/dist/engines/installations/node-vitest.d.ts +0 -33
  550. package/dist/engines/installations/package-requirements.d.ts +0 -28
  551. package/dist/engines/installations/package-resolution.d.ts +0 -51
  552. package/dist/engines/installations/playwright-resolution-child.d.ts +0 -1
  553. package/dist/engines/installations/playwright.d.ts +0 -75
  554. package/dist/engines/installations/types.d.ts +0 -10
  555. package/dist/engines/k6/adapter/bundle.d.ts +0 -25
  556. package/dist/engines/k6/adapter/bundle.js +0 -112
  557. package/dist/engines/k6/adapter/evidence.d.ts +0 -15
  558. package/dist/engines/k6/adapter/evidence.js +0 -4
  559. package/dist/engines/k6/adapter/executor.d.ts +0 -13
  560. package/dist/engines/k6/adapter/executor.js +0 -1
  561. package/dist/engines/k6/adapter/index.d.ts +0 -1
  562. package/dist/engines/k6/adapter/index.js +0 -1
  563. package/dist/engines/k6/adapter/input.d.ts +0 -21
  564. package/dist/engines/k6/adapter/input.js +0 -1
  565. package/dist/engines/k6/adapter/native-summary.d.ts +0 -11
  566. package/dist/engines/k6/adapter/native-summary.js +0 -1
  567. package/dist/engines/k6/adapter/repository-configuration.d.ts +0 -2
  568. package/dist/engines/k6/adapter/repository-configuration.js +0 -1
  569. package/dist/engines/k6/authoring-type-paths.d.ts +0 -3
  570. package/dist/engines/k6/authoring-type-paths.js +0 -1
  571. package/dist/engines/k6/runtime/ambient-types/bundle-manifest.json +0 -146
  572. package/dist/engines/k6/runtime/ambient-types/k6/LICENSE +0 -21
  573. package/dist/engines/k6/runtime/ambient-types/k6/browser/index.d.ts +0 -6332
  574. package/dist/engines/k6/runtime/ambient-types/k6/crypto/index.d.ts +0 -218
  575. package/dist/engines/k6/runtime/ambient-types/k6/data/index.d.ts +0 -16
  576. package/dist/engines/k6/runtime/ambient-types/k6/encoding/index.d.ts +0 -46
  577. package/dist/engines/k6/runtime/ambient-types/k6/execution/index.d.ts +0 -127
  578. package/dist/engines/k6/runtime/ambient-types/k6/experimental/csv/index.d.ts +0 -96
  579. package/dist/engines/k6/runtime/ambient-types/k6/experimental/fs/index.d.ts +0 -104
  580. package/dist/engines/k6/runtime/ambient-types/k6/experimental/redis/index.d.ts +0 -821
  581. package/dist/engines/k6/runtime/ambient-types/k6/experimental/streams/index.d.ts +0 -198
  582. package/dist/engines/k6/runtime/ambient-types/k6/global.d.ts +0 -83
  583. package/dist/engines/k6/runtime/ambient-types/k6/html/index.d.ts +0 -1325
  584. package/dist/engines/k6/runtime/ambient-types/k6/http/index.d.ts +0 -806
  585. package/dist/engines/k6/runtime/ambient-types/k6/index.d.ts +0 -126
  586. package/dist/engines/k6/runtime/ambient-types/k6/metrics/index.d.ts +0 -66
  587. package/dist/engines/k6/runtime/ambient-types/k6/net/grpc/index.d.ts +0 -247
  588. package/dist/engines/k6/runtime/ambient-types/k6/options/index.d.ts +0 -459
  589. package/dist/engines/k6/runtime/ambient-types/k6/package.json +0 -79
  590. package/dist/engines/k6/runtime/ambient-types/k6/secrets/index.d.ts +0 -36
  591. package/dist/engines/k6/runtime/ambient-types/k6/timers/index.d.ts +0 -47
  592. package/dist/engines/k6/runtime/ambient-types/k6/websockets/index.d.ts +0 -324
  593. package/dist/engines/k6/runtime/ambient-types/k6/ws/index.d.ts +0 -283
  594. package/dist/engines/k6/runtime/ambient-types/xk6-sql/LICENSE +0 -201
  595. package/dist/engines/k6/runtime/ambient-types/xk6-sql/index.d.ts +0 -397
  596. package/dist/engines/k6/runtime/ambient-types/xk6-sql/package.json +0 -15
  597. package/dist/engines/k6/runtime/artifacts.d.ts +0 -2
  598. package/dist/engines/k6/runtime/artifacts.js +0 -1
  599. package/dist/engines/k6/runtime/checks.d.ts +0 -17
  600. package/dist/engines/k6/runtime/checks.js +0 -1
  601. package/dist/engines/k6/runtime/dal-fixtures.d.ts +0 -24
  602. package/dist/engines/k6/runtime/dal-fixtures.js +0 -1
  603. package/dist/engines/k6/runtime/dal-suite.d.ts +0 -24
  604. package/dist/engines/k6/runtime/dal-suite.js +0 -1
  605. package/dist/engines/k6/runtime/dal.d.ts +0 -10
  606. package/dist/engines/k6/runtime/dal.js +0 -1
  607. package/dist/engines/k6/runtime/fixtures.d.ts +0 -3
  608. package/dist/engines/k6/runtime/fixtures.js +0 -1
  609. package/dist/engines/k6/runtime/http-assertions.d.ts +0 -19
  610. package/dist/engines/k6/runtime/http-assertions.js +0 -1
  611. package/dist/engines/k6/runtime/http-checks.d.ts +0 -19
  612. package/dist/engines/k6/runtime/http-checks.js +0 -1
  613. package/dist/engines/k6/runtime/http-suite-runtime.d.ts +0 -103
  614. package/dist/engines/k6/runtime/http-suite-runtime.js +0 -1
  615. package/dist/engines/k6/runtime/http.d.ts +0 -15
  616. package/dist/engines/k6/runtime/http.js +0 -1
  617. package/dist/engines/k6/runtime/index.d.ts +0 -11
  618. package/dist/engines/k6/runtime/index.js +0 -1
  619. package/dist/engines/k6/runtime/input.d.ts +0 -3
  620. package/dist/engines/k6/runtime/input.js +0 -1
  621. package/dist/engines/k6/runtime/k6-repository-configuration.d.ts +0 -9
  622. package/dist/engines/k6/runtime/k6-repository-configuration.js +0 -1
  623. package/dist/engines/k6/runtime/node-setup.d.ts +0 -13
  624. package/dist/engines/k6/runtime/node-setup.js +0 -1
  625. package/dist/engines/k6/runtime/runtime-globals.d.ts +0 -10
  626. package/dist/engines/k6/runtime/runtime.d.ts +0 -54
  627. package/dist/engines/k6/runtime/runtime.js +0 -1
  628. package/dist/engines/k6/runtime/shared/assertion-details.d.ts +0 -19
  629. package/dist/engines/k6/runtime/shared/assertion-details.js +0 -2
  630. package/dist/engines/k6/runtime/shared/db-normalization.d.ts +0 -19
  631. package/dist/engines/k6/runtime/shared/db-normalization.js +0 -1
  632. package/dist/engines/k6/runtime/shared/error-body.d.ts +0 -3
  633. package/dist/engines/k6/runtime/shared/error-body.js +0 -1
  634. package/dist/engines/k6/runtime/shared/file-data.d.ts +0 -1
  635. package/dist/engines/k6/runtime/shared/file-data.js +0 -1
  636. package/dist/engines/k6/runtime/shared/fixture-engine.d.ts +0 -8
  637. package/dist/engines/k6/runtime/shared/fixture-engine.js +0 -2
  638. package/dist/engines/k6/runtime/shared/http-check-plan.d.ts +0 -29
  639. package/dist/engines/k6/runtime/shared/http-check-plan.js +0 -1
  640. package/dist/engines/k6/runtime/shared/http-parsing.d.ts +0 -10
  641. package/dist/engines/k6/runtime/shared/http-parsing.js +0 -3
  642. package/dist/engines/k6/runtime/shared/ordering.d.ts +0 -2
  643. package/dist/engines/k6/runtime/shared/ordering.js +0 -1
  644. package/dist/engines/k6/runtime/shared/properties.d.ts +0 -1
  645. package/dist/engines/k6/runtime/shared/properties.js +0 -1
  646. package/dist/engines/k6/runtime/suite.d.ts +0 -4
  647. package/dist/engines/k6/runtime/suite.js +0 -1
  648. package/dist/engines/k6/runtime/types.d.ts +0 -244
  649. package/dist/engines/k6/runtime/types.js +0 -1
  650. package/dist/engines/k6/runtime/xk6-sql-driver-postgres.d.ts +0 -7
  651. package/dist/engines/k6/runtime/xk6-sql-driver-postgres.js +0 -1
  652. package/dist/engines/managed-module-resolution-policy-input.d.ts +0 -9
  653. package/dist/engines/managed-module-resolution-policy.d.ts +0 -25
  654. package/dist/engines/managed-module-resolution.d.ts +0 -13
  655. package/dist/engines/manager.d.ts +0 -25
  656. package/dist/engines/node-vitest/adapter/adapter.d.ts +0 -16
  657. package/dist/engines/node-vitest/adapter/consumer-typescript-paths.d.ts +0 -17
  658. package/dist/engines/node-vitest/adapter/consumer-typescript-paths.js +0 -3
  659. package/dist/engines/node-vitest/adapter/evidence.d.ts +0 -33
  660. package/dist/engines/node-vitest/adapter/failure-details.d.ts +0 -3
  661. package/dist/engines/node-vitest/adapter/index.d.ts +0 -1
  662. package/dist/engines/node-vitest/adapter/reporter.d.ts +0 -7
  663. package/dist/engines/node-vitest/adapter/resolution.d.ts +0 -12
  664. package/dist/engines/node-vitest/adapter/resolution.js +0 -1
  665. package/dist/engines/node-vitest/adapter/workspace.d.ts +0 -19
  666. package/dist/engines/node-vitest/runtime/contract/index.d.ts +0 -64
  667. package/dist/engines/node-vitest/runtime/data/http.d.ts +0 -4
  668. package/dist/engines/node-vitest/runtime/data/index.d.ts +0 -8
  669. package/dist/engines/node-vitest/runtime/data/primitives.d.ts +0 -1
  670. package/dist/engines/node-vitest/runtime/data/report.d.ts +0 -3
  671. package/dist/engines/node-vitest/runtime/data/runner.d.ts +0 -4
  672. package/dist/engines/node-vitest/runtime/data/scenario.d.ts +0 -12
  673. package/dist/engines/node-vitest/runtime/data/types.d.ts +0 -412
  674. package/dist/engines/node-vitest/runtime/runtime-input.d.ts +0 -64
  675. package/dist/engines/playwright/adapter/adapter.d.ts +0 -18
  676. package/dist/engines/playwright/adapter/attachments.d.ts +0 -26
  677. package/dist/engines/playwright/adapter/config.d.ts +0 -45
  678. package/dist/engines/playwright/adapter/evidence-validation.d.ts +0 -12
  679. package/dist/engines/playwright/adapter/evidence.d.ts +0 -32
  680. package/dist/engines/playwright/adapter/failure-details.d.ts +0 -2
  681. package/dist/engines/playwright/adapter/index.d.ts +0 -3
  682. package/dist/engines/playwright/adapter/reporter.d.ts +0 -12
  683. package/dist/engines/playwright/runtime/config-file.d.ts +0 -2
  684. package/dist/engines/playwright/runtime/config.d.ts +0 -24
  685. package/dist/engines/playwright/runtime/index.d.ts +0 -4
  686. package/dist/engines/playwright/runtime/runtime-input.d.ts +0 -36
  687. package/dist/engines/playwright/runtime/sandbox.d.ts +0 -84
  688. package/dist/engines/runtime-input-file.d.ts +0 -27
  689. package/dist/environment/lifecycle-artifacts.d.ts +0 -7
  690. package/dist/environment/lifecycle-controller.d.ts +0 -70
  691. package/dist/environment/lifecycle.d.ts +0 -29
  692. package/dist/environment/maintenance.d.ts +0 -68
  693. package/dist/environment/planning-types.d.ts +0 -35
  694. package/dist/environment/readiness.d.ts +0 -12
  695. package/dist/environment/readiness.js +0 -1
  696. package/dist/environment/ready-environment.d.ts +0 -19
  697. package/dist/environment/run-environment.d.ts +0 -38
  698. package/dist/environment/run-stopping.d.ts +0 -13
  699. package/dist/environment/runtime-contexts.d.ts +0 -33
  700. package/dist/environment/runtime-manager.d.ts +0 -95
  701. package/dist/environment/runtime-planning.d.ts +0 -16
  702. package/dist/environment/runtime-preparation.d.ts +0 -30
  703. package/dist/environment/runtime-service.d.ts +0 -18
  704. package/dist/environment/services.d.ts +0 -48
  705. package/dist/environment/state.d.ts +0 -18
  706. package/dist/environment/status-runtime.d.ts +0 -53
  707. package/dist/environment/template.d.ts +0 -180
  708. package/dist/evidence/artifact-config.d.ts +0 -14
  709. package/dist/evidence/artifact-validation.d.ts +0 -5
  710. package/dist/evidence/artifacts.d.ts +0 -75
  711. package/dist/evidence/bundles.d.ts +0 -27
  712. package/dist/evidence/ci-provenance.d.ts +0 -9
  713. package/dist/evidence/contracts.d.ts +0 -154
  714. package/dist/evidence/file-evidence.d.ts +0 -23
  715. package/dist/evidence/finalization.d.ts +0 -9
  716. package/dist/evidence/index.d.ts +0 -8
  717. package/dist/evidence/logs.d.ts +0 -31
  718. package/dist/evidence/operation-timings.d.ts +0 -60
  719. package/dist/evidence/read-bundle.d.ts +0 -4
  720. package/dist/evidence/read-fields.d.ts +0 -22
  721. package/dist/evidence/read-provenance.d.ts +0 -2
  722. package/dist/evidence/read-redaction.d.ts +0 -2
  723. package/dist/evidence/read-retention.d.ts +0 -2
  724. package/dist/evidence/read-run.d.ts +0 -2
  725. package/dist/evidence/reading.d.ts +0 -28
  726. package/dist/evidence/reporting-types.d.ts +0 -330
  727. package/dist/evidence/reporting.d.ts +0 -3
  728. package/dist/evidence/secure-file-copy.d.ts +0 -24
  729. package/dist/evidence/setup-progress.d.ts +0 -63
  730. package/dist/evidence/step-output.d.ts +0 -16
  731. package/dist/evidence/storage-inventory.d.ts +0 -27
  732. package/dist/evidence/storage.d.ts +0 -27
  733. package/dist/evidence/timing.d.ts +0 -23
  734. package/dist/file.d.ts +0 -11
  735. package/dist/index.d.ts +0 -4
  736. package/dist/kernel/error-serialization.d.ts +0 -38
  737. package/dist/kernel/redaction.d.ts +0 -2
  738. package/dist/kernel/unknown-values.d.ts +0 -6
  739. package/dist/kernel/work-metrics.d.ts +0 -6
  740. package/dist/process/capture-output.d.ts +0 -7
  741. package/dist/process/command-shell.d.ts +0 -1
  742. package/dist/process/environment-overlay.d.ts +0 -17
  743. package/dist/process/environment.d.ts +0 -33
  744. package/dist/process/files/contained-path.d.ts +0 -8
  745. package/dist/process/files/directory-status.d.ts +0 -14
  746. package/dist/process/files/dotenv.d.ts +0 -2
  747. package/dist/process/files/file-snapshot.d.ts +0 -34
  748. package/dist/process/files/json-file.d.ts +0 -12
  749. package/dist/process/files/paths.d.ts +0 -1
  750. package/dist/process/files/product-dir.d.ts +0 -1
  751. package/dist/process/files/temp-dir.d.ts +0 -11
  752. package/dist/process/host/metadata.d.ts +0 -6
  753. package/dist/process/host/platform.d.ts +0 -57
  754. package/dist/process/host-command.d.ts +0 -4
  755. package/dist/process/host-inspection-command.d.ts +0 -13
  756. package/dist/process/host-process.d.ts +0 -19
  757. package/dist/process/index.d.ts +0 -9
  758. package/dist/process/lifecycle-fence.d.ts +0 -11
  759. package/dist/process/locks.d.ts +0 -28
  760. package/dist/process/process-contracts.d.ts +0 -78
  761. package/dist/process/process-group.d.ts +0 -12
  762. package/dist/process/process-identity.d.ts +0 -27
  763. package/dist/process/process-limits.d.ts +0 -6
  764. package/dist/process/process.d.ts +0 -12
  765. package/dist/process/readiness.d.ts +0 -37
  766. package/dist/process/recovery.d.ts +0 -3
  767. package/dist/process/runs/inspection.d.ts +0 -5
  768. package/dist/process/runs/manifest.d.ts +0 -86
  769. package/dist/process/runs/ownership.d.ts +0 -11
  770. package/dist/process/runs/product-state.d.ts +0 -2
  771. package/dist/process/runs/schema.d.ts +0 -3
  772. package/dist/process/runs/stop.d.ts +0 -19
  773. package/dist/process/runtime-socket.d.ts +0 -4
  774. package/dist/process/service-processes.d.ts +0 -13
  775. package/dist/process/shutdown.d.ts +0 -10
  776. package/dist/process/windows-cli-owner.d.ts +0 -2
  777. package/dist/process/windows-native.d.ts +0 -6
  778. package/dist/process/windows-process-identity.d.ts +0 -4
  779. package/dist/repo/ci-environment.d.ts +0 -7
  780. package/dist/repo/fingerprint-policy.d.ts +0 -15
  781. package/dist/repo/git-path.d.ts +0 -2
  782. package/dist/repo/history.d.ts +0 -17
  783. package/dist/repo/managed-git.d.ts +0 -10
  784. package/dist/repo/metadata.d.ts +0 -3
  785. package/dist/repo/physical-tree.d.ts +0 -37
  786. package/dist/repo/remote.d.ts +0 -6
  787. package/dist/repo/state.d.ts +0 -26
  788. package/dist/repo/tree-listing.d.ts +0 -10
  789. package/dist/steps/build-config.d.ts +0 -35
  790. package/dist/steps/configured-step-testkit-modules.d.ts +0 -19
  791. package/dist/steps/configured-steps.d.ts +0 -51
  792. package/dist/steps/environment.d.ts +0 -84
  793. package/dist/steps/index.d.ts +0 -2
  794. package/dist/steps/module-runner.d.ts +0 -1
  795. package/dist/steps/run.d.ts +0 -36
  796. package/dist/toolchains/archive.d.ts +0 -53
  797. package/dist/toolchains/esbuild.d.ts +0 -9
  798. package/dist/toolchains/host-node-support.d.ts +0 -3
  799. package/dist/toolchains/index.d.ts +0 -114
  800. package/dist/toolchains/managed-node-releases.d.ts +0 -28
  801. package/dist/toolchains/node-cache.d.ts +0 -20
  802. package/dist/toolchains/node-integrity.d.ts +0 -18
  803. package/dist/toolchains/node-provisioning.d.ts +0 -29
  804. package/dist/toolchains/semver.d.ts +0 -13
  805. package/dist/toolchains/shared-operation.d.ts +0 -11
  806. package/dist/toolchains/timeouts.d.ts +0 -1
  807. package/dist/toolchains/vitest/index.d.ts +0 -13
  808. package/dist/tracker/gitea.d.ts +0 -14
  809. package/dist/tracker/github.d.ts +0 -14
  810. package/dist/tracker/http.d.ts +0 -33
  811. package/dist/tracker/index.d.ts +0 -4
  812. package/dist/tracker/redaction.d.ts +0 -4
  813. package/dist/tracker/requests.d.ts +0 -17
  814. package/dist/tracker/responses.d.ts +0 -24
  815. package/dist/tracker/types.d.ts +0 -51
  816. package/docs/engine-architecture.md +0 -654
  817. /package/dist/engines/{k6/runtime/runtime-globals.js → api/profiles.js} +0 -0
@@ -1 +1 @@
1
- import{isEngineTaskDeadlineExceededReason as d}from"../api/index.js";import"../../domain/test-outcomes.js";export async function executeEngineTasks(e,t,n,i,o){const a=[];for(const r of t){e.observer?.taskStarted(r.task);const s=Date.now(),c=taskBeforeStartOutcome(r.task,e.signal,s,n);c!==null?a.push(c):r.preparationFailure!==null?a.push(terminalOutcome(r.task.id,"failed",s,emptyEvidence(),r.preparationFailure)):a.push(await i(r,s))}for(const[r,s]of a.entries())e.observer?.evidenceRecorded(t[r].task.id,s.evidence),e.observer?.taskFinished(s);return{evidence:{artifacts:a.flatMap(r=>r.evidence.artifacts),logs:a.flatMap(r=>r.evidence.logs),metrics:a.flatMap(r=>r.evidence.metrics),native:o},invocationId:e.invocationId,outcomes:a}}export function taskBeforeStartOutcome(e,t,n,i){return e.deadlineMs<=n||d(t.reason)?terminalOutcome(e.id,"failed",n,emptyEvidence(),taskTimeoutFailure(e.timeoutMs,i)):t.aborted?terminalOutcome(e.id,"cancelled",n,emptyEvidence(),{code:`${i.codePrefix}_CANCELLED`,message:`${i.label} task was cancelled before its process started`}):null}export function taskTimeoutFailure(e,t){return{code:`${t.codePrefix}_TASK_TIMEOUT`,details:{timeoutMs:e},message:`${t.label} task exceeded its ${e.toString()}ms timeout`}}export function managedProcessFailure(e,t,n=null){return e.terminationError===null?null:{classification:"infra",code:`${t.codePrefix}_PROCESS_TERMINATION_INCOMPLETE`,details:{cancelled:e.cancelled,...n===null?{}:{evidenceCollectionFailure:errorDetails(n)},outputLimitExceeded:e.outputLimitExceeded,timedOut:e.timedOut},message:`${t.label} managed-process termination was incomplete: ${e.terminationError.message}`,...e.terminationError.stack===void 0?{}:{stack:e.terminationError.stack}}}export function classifyManagedProcessResult(e,t,n,i){const o=r=>({failure:r,status:"failed"}),a=managedProcessFailure(e,i);return a!==null?o(a):e.timedOut||n?o(taskTimeoutFailure(t,i)):e.cancelled?{failure:{code:`${i.codePrefix}_CANCELLED`,message:`${i.label} task was cancelled`},status:"cancelled"}:e.outputLimitExceeded?o({code:`${i.codePrefix}_OUTPUT_LIMIT`,message:`${i.label} task exceeded the bounded stdout/stderr capture limit`}):e.error!==null?o({...failureFromError(e.error,`${i.codePrefix}_PROCESS_START_FAILED`),classification:"infra"}):null}export function processExitDetails(e){return{...e.exitCode===null?{}:{exitCode:e.exitCode},...e.exitSignal===null?{}:{exitSignal:e.exitSignal}}}export function processExitFailure(e,t,n=null,i=t.label){return{failure:{code:`${t.codePrefix}_PROCESS_FAILED`,details:processExitDetails(e),message:n??(e.exitCode===null?`${i} process terminated by ${e.exitSignal??"an unknown signal"}`:`${i} process exited with code ${e.exitCode.toString()}`)},status:"failed"}}export function firstOutputLine(e){const t=e.split(/\r?\n/u).map(n=>n.trim()).find(Boolean);return t===void 0?null:t.slice(0,4e3)}export function terminalOutcome(e,t,n,i,o){const a=Date.now();return{durationMs:Math.max(0,a-n),evidence:i,failure:o,finishedAtMs:a,startedAtMs:n,status:t,taskId:e}}export function processOutputEvidence(e){return{artifacts:[],logs:[...e.stdout.length===0?[]:[{stream:"stdout",text:e.stdout}],...e.stderr.length===0?[]:[{stream:"stderr",text:e.stderr}]],metrics:[]}}export function emptyEvidence(){return{artifacts:[],logs:[],metrics:[]}}export function failureFromError(e,t){const n=toError(e);return{code:t,message:n.message,...n.stack===void 0?{}:{stack:n.stack}}}export function errorDetails(e){return{message:e.message,name:e.name,...e.stack===void 0?{}:{stack:e.stack}}}export function toError(e){return e instanceof Error?e:new Error(String(e))}
1
+ import{isEngineTaskDeadlineExceededReason as d}from"../api/index.js";import"../../domain/test-outcomes.js";import{toError as l}from"../../kernel/error-serialization.js";export async function executeEngineTasks(e,t,n,i,a){const r=[];for(const o of t){e.observer?.taskStarted(o.task);const s=Date.now(),c=taskBeforeStartOutcome(o.task,e.signal,s,n);c!==null?r.push(c):o.preparationFailure!==null?r.push(terminalOutcome(o.task.id,"failed",s,emptyEvidence(),o.preparationFailure)):r.push(await i(o,s))}return engineExecutionResult(e,r,a)}export function engineExecutionResult(e,t,n,i=[]){for(const a of t)e.observer?.evidenceRecorded(a.taskId,a.evidence),e.observer?.taskFinished(a);return{evidence:{artifacts:t.flatMap(a=>a.evidence.artifacts),logs:t.flatMap(a=>a.evidence.logs),metrics:t.flatMap(a=>a.evidence.metrics),native:n},invocationId:e.invocationId,outcomes:t,...i.length===0?{}:{runErrors:i}}}export function taskBeforeStartOutcome(e,t,n,i){return e.deadlineMs<=n||d(t.reason)?terminalOutcome(e.id,"failed",n,emptyEvidence(),taskTimeoutFailure(e.timeoutMs,i)):t.aborted?terminalOutcome(e.id,"cancelled",n,emptyEvidence(),{code:`${i.codePrefix}_CANCELLED`,message:`${i.label} task was cancelled before its process started`}):null}export function taskTimeoutFailure(e,t){return{code:`${t.codePrefix}_TASK_TIMEOUT`,details:{timeoutMs:e},message:`${t.label} task exceeded its ${e.toString()}ms timeout`}}export function managedProcessFailure(e,t,n=null){return e.terminationError===null?null:{classification:"infra",code:`${t.codePrefix}_PROCESS_TERMINATION_INCOMPLETE`,details:{cancelled:e.cancelled,...n===null?{}:{evidenceCollectionFailure:errorDetails(n)},outputLimitExceeded:e.outputLimitExceeded,timedOut:e.timedOut},message:`${t.label} managed-process termination was incomplete: ${e.terminationError.message}`,...e.terminationError.stack===void 0?{}:{stack:e.terminationError.stack}}}export function classifyManagedProcessResult(e,t,n,i){const a=o=>({failure:o,status:"failed"}),r=managedProcessFailure(e,i);return r!==null?a(r):e.timedOut||n?a(taskTimeoutFailure(t,i)):e.cancelled?{failure:{code:`${i.codePrefix}_CANCELLED`,message:`${i.label} task was cancelled`},status:"cancelled"}:e.outputLimitExceeded?a({code:`${i.codePrefix}_OUTPUT_LIMIT`,message:`${i.label} task exceeded the bounded stdout/stderr capture limit`}):e.error!==null?a({...failureFromError(e.error,`${i.codePrefix}_PROCESS_START_FAILED`),classification:"infra"}):null}export function processExitDetails(e){return{...e.exitCode===null?{}:{exitCode:e.exitCode},...e.exitSignal===null?{}:{exitSignal:e.exitSignal}}}export function processExitFailure(e,t,n=null,i=t.label){return{failure:{code:`${t.codePrefix}_PROCESS_FAILED`,details:processExitDetails(e),message:n??(e.exitCode===null?`${i} process terminated by ${e.exitSignal??"an unknown signal"}`:`${i} process exited with code ${e.exitCode.toString()}`)},status:"failed"}}export function firstOutputLine(e){const t=e.split(/\r?\n/u).map(n=>n.trim()).find(Boolean);return t===void 0?null:t.slice(0,4e3)}export function terminalOutcome(e,t,n,i,a){const r=Date.now();return{durationMs:Math.max(0,r-n),evidence:i,failure:a,finishedAtMs:r,startedAtMs:n,status:t,taskId:e}}export function processOutputEvidence(e){return{artifacts:[],logs:[...e.stdout.length===0?[]:[{stream:"stdout",text:e.stdout}],...e.stderr.length===0?[]:[{stream:"stderr",text:e.stderr}]],metrics:[]}}export function emptyEvidence(){return{artifacts:[],logs:[],metrics:[]}}export function failureFromError(e,t){const n=l(e);return{code:t,message:n.message,...n.stack===void 0?{}:{stack:n.stack}}}export function errorDetails(e){return{message:e.message,name:e.name,...e.stack===void 0?{}:{stack:e.stack}}}
@@ -0,0 +1,2 @@
1
+ export const RUNTIME_INPUT_JSON_BOUNDS=Object.freeze({maxCollectionEntries:1e4,maxDepth:32,maxNodes:5e4,maxStringBytes:4194304});export function requireBoundedJsonValue(o,n,t){let r=0;const i=(e,s)=>{if(r+=1,r>t.maxNodes)throw new Error(`${n} exceeds the ${t.maxNodes.toString()} node limit`);if(s>t.maxDepth)throw new Error(`${n} exceeds the ${t.maxDepth.toString()} level depth limit`);if(typeof e=="string"){if(Buffer.byteLength(e,"utf8")>t.maxStringBytes)throw new Error(`${n} contains a string larger than ${t.maxStringBytes.toString()} bytes`);return}if(typeof e=="number"){if(!Number.isFinite(e))throw new Error(`${n} contains a non-finite number`);return}if(e===null||typeof e=="boolean")return;if(typeof e!="object")throw new Error(`${n} contains a non-JSON value`);const a=Array.isArray(e)?e:Object.values(e);if(a.length>t.maxCollectionEntries)throw new Error(`${n} contains a collection larger than ${t.maxCollectionEntries.toString()} entries`);for(const c of a)i(c,s+1)};i(o,0)}export function serializeBoundedJson(o,n,t){requireBoundedJsonValue(o,n,t);const r=JSON.stringify(o);if(typeof r!="string")throw new Error(`${n} is not JSON-serializable`);return`${r}
2
+ `}
@@ -1 +1 @@
1
- import n from"node:fs/promises";import a from"node:path";import{fileURLToPath as p}from"node:url";import{requireBoundedJsonValue as u,serializeBoundedJson as w}from"../contracts/json-bounds.js";export const NATIVE_REPORT_JSON_BOUNDS=Object.freeze({maxCollectionEntries:1e5,maxDepth:64,maxNodes:1e5,maxStringUnits:1024*1024});export async function writeNativeReport(t,e,r){const o=await n.realpath(t.workspaceDirectory),c=await n.realpath(a.dirname(t.reportFile));if(o!==a.resolve(t.workspaceDirectory)||c!==o)throw new Error("Native report must stay in its invocation workspace");const s=w({schemaVersion:1,...t.identity,result:e},"Testkit native report",NATIVE_REPORT_JSON_BOUNDS,{unitLabel:"bytes",unitsOf:f=>Buffer.byteLength(f,"utf8")});if(Buffer.byteLength(s,"utf8")>r)throw new Error(`Testkit native report exceeds ${r.toString()} bytes`);const i=await n.open(t.reportFile,"wx",384);try{await i.writeFile(s,"utf8"),await i.sync()}finally{await i.close()}}export function readNativeReport(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new Error("Testkit native report must contain an object");const r=t;if(r.schemaVersion!==1)throw new Error("Unsupported Testkit native report schemaVersion");for(const o of["engineId","invocationId","taskId","sourceFile"])if(r[o]!==e[o])throw new Error(`Testkit native report ${o} does not match its invocation`);return{schemaVersion:1,...e,result:r.result}}export function nativeReporterFile(t){const e=p(new URL("../../../",import.meta.url));return a.join(e,"dist","engines",t,"adapter","reporter.js")}export function requireNativeEvidenceJson(t,e){u(t,e,NATIVE_REPORT_JSON_BOUNDS,{unitLabel:"bytes",unitsOf:r=>Buffer.byteLength(r,"utf8")})}
1
+ import n from"node:fs/promises";import a from"node:path";import{fileURLToPath as p}from"node:url";import{requireBoundedJsonValue as f,serializeBoundedJson as w}from"./json-bounds.js";export const NATIVE_REPORT_JSON_BOUNDS=Object.freeze({maxCollectionEntries:1e5,maxDepth:64,maxNodes:1e5,maxStringBytes:1024*1024});export async function writeNativeReport(e,t,r){const o=await n.realpath(e.workspaceDirectory),c=await n.realpath(a.dirname(e.reportFile));if(o!==a.resolve(e.workspaceDirectory)||c!==o)throw new Error("Native report must stay in its invocation workspace");const s=w({schemaVersion:1,...e.identity,result:t},"Testkit native report",NATIVE_REPORT_JSON_BOUNDS);if(Buffer.byteLength(s,"utf8")>r)throw new Error(`Testkit native report exceeds ${r.toString()} bytes`);const i=await n.open(e.reportFile,"wx",384);try{await i.writeFile(s,"utf8"),await i.sync()}finally{await i.close()}}export function readNativeReport(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("Testkit native report must contain an object");const r=e;if(r.schemaVersion!==1)throw new Error("Unsupported Testkit native report schemaVersion");for(const o of["engineId","invocationId","taskId","sourceFile"])if(r[o]!==t[o])throw new Error(`Testkit native report ${o} does not match its invocation`);return{schemaVersion:1,...t,result:r.result}}export function nativeReporterFile(e){const t=p(new URL("../../../",import.meta.url));return a.join(t,"dist","engines",e,"adapter","reporter.js")}export function requireNativeEvidenceJson(e,t){f(e,t,NATIVE_REPORT_JSON_BOUNDS)}
@@ -1 +1 @@
1
- export class EngineInvocationCleanupDeadlineExceededError extends Error{timeoutMs;constructor(n){super(`Engine invocation cleanup exceeded its independent ${n.toString()} ms deadline`),this.name="EngineInvocationCleanupDeadlineExceededError",this.timeoutMs=n}}export function createEngineInvocationScope(t){const n=[];let i=!0,e=null;const s=Object.freeze({defer(r){if(!i)throw new Error("Engine invocation cleanup cannot be registered after draining starts");n.push(r)}});return Object.freeze({drain(){return e!==null||(i=!1,e=l(n.splice(0).reverse(),t.timeoutMs)),e},scope:s})}async function l(t,n){const i=Date.now()+n,e=[];for(const s of t){let r;try{r=s()}catch(u){e.push(a(u));continue}if(r===void 0)continue;const o=Math.max(0,i-Date.now());if(o===0){Promise.resolve(r).catch(()=>{}),e.push(new EngineInvocationCleanupDeadlineExceededError(n));continue}const c=await d(r,o);c==="timeout"?e.push(new EngineInvocationCleanupDeadlineExceededError(n)):c instanceof Error&&e.push(c)}return Object.freeze(e)}async function d(t,n){let i;const e=Promise.resolve(t).then(()=>"fulfilled",o=>a(o)),s=new Promise(o=>{i=setTimeout(()=>{o("timeout")},n)}),r=await Promise.race([e,s]);return clearTimeout(i),r}function a(t){return t instanceof Error?t:new Error(String(t))}
1
+ import{toError as a}from"../../kernel/error-serialization.js";export class EngineInvocationCleanupDeadlineExceededError extends Error{timeoutMs;constructor(n){super(`Engine invocation cleanup exceeded its independent ${n.toString()} ms deadline`),this.name="EngineInvocationCleanupDeadlineExceededError",this.timeoutMs=n}}export function createEngineInvocationScope(i){const n=[];let r=!0,e=null;const s=Object.freeze({defer(t){if(!r)throw new Error("Engine invocation cleanup cannot be registered after draining starts");n.push(t)}});return Object.freeze({drain(){return e!==null||(r=!1,e=l(n.splice(0).reverse(),i.timeoutMs)),e},scope:s})}async function l(i,n){const r=Date.now()+n,e=[];for(const s of i){let t;try{t=s()}catch(u){e.push(a(u));continue}if(t===void 0)continue;const o=Math.max(0,r-Date.now());if(o===0){Promise.resolve(t).catch(()=>{}),e.push(new EngineInvocationCleanupDeadlineExceededError(n));continue}const c=await d(t,o);c==="timeout"?e.push(new EngineInvocationCleanupDeadlineExceededError(n)):c instanceof Error&&e.push(c)}return Object.freeze(e)}async function d(i,n){let r;const e=Promise.resolve(i).then(()=>"fulfilled",o=>a(o)),s=new Promise(o=>{r=setTimeout(()=>{o("timeout")},n)}),t=await Promise.race([e,s]);return clearTimeout(r),t}
@@ -1 +1 @@
1
- import{createValidatingObserverSession as u}from"./execution-observer.js";export const ENGINE_TASK_DEADLINE_EXCEEDED_CODE="TESTKIT_ENGINE_TASK_DEADLINE_EXCEEDED";export class EngineTaskDeadlineExceededError extends Error{code=ENGINE_TASK_DEADLINE_EXCEEDED_CODE;deadlineMs;constructor(n){super(`Engine task deadline ${n.toString()} was exceeded`),this.name="EngineTaskDeadlineExceededError",this.deadlineMs=n}}export const ENGINE_PROTOCOL_LIMITS=Object.freeze({cleanupTimeoutMs:3e4});export function isEngineTaskDeadlineExceededReason(e){return typeof e=="object"&&e!==null&&Reflect.get(e,"code")===ENGINE_TASK_DEADLINE_EXCEEDED_CODE&&typeof Reflect.get(e,"deadlineMs")=="number"&&Number.isSafeInteger(Reflect.get(e,"deadlineMs"))&&Number(Reflect.get(e,"deadlineMs"))>0}export function resolveEngineTaskInputs(e,n){const r=e.target.inputs,t=n.inputs;return Object.freeze({...t.configuration!==void 0?{configuration:t.configuration}:r.configuration!==void 0?{configuration:r.configuration}:{},environment:Object.freeze({...r.environment,...t.environment}),fixtures:Object.freeze({...r.fixtures,...t.fixtures}),...t.setupData!==void 0?{setupData:t.setupData}:r.setupData!==void 0?{setupData:r.setupData}:{},supportModules:Object.freeze({...r.supportModules,...t.supportModules})})}export function beginEngineExecution(e){const n=u(e),r=Object.freeze({...e,...n===null?{}:{observer:n.observer}});let t=null,o=!1,i=!1;return Object.freeze({request:r,acceptResult(s){if(o)throw new Error("Engine execution boundary is already closed");if(t!==null)throw new Error("Engine execution boundary already accepted a result");return n?.assertValid(),t=s,t},close(){o||(n?.close(),o=!0)},commit(){if(!o)throw new Error("Engine execution boundary must be closed before it is committed");if(i)throw new Error("Engine execution boundary is already committed");if(t===null)throw new Error("Engine execution boundary cannot commit without an accepted result");n?.assertValid(),n?.commit(),i=!0}})}
1
+ import{createValidatingObserverSession as u}from"./execution-observer.js";export const ENGINE_TASK_DEADLINE_EXCEEDED_CODE="TESTKIT_ENGINE_TASK_DEADLINE_EXCEEDED";export class EngineTaskDeadlineExceededError extends Error{code=ENGINE_TASK_DEADLINE_EXCEEDED_CODE;deadlineMs;constructor(n){super(`Engine task deadline ${n.toString()} was exceeded`),this.name="EngineTaskDeadlineExceededError",this.deadlineMs=n}}export const ENGINE_CLEANUP_TIMEOUT_MS=3e4;export function isEngineTaskDeadlineExceededReason(e){return typeof e=="object"&&e!==null&&Reflect.get(e,"code")===ENGINE_TASK_DEADLINE_EXCEEDED_CODE&&typeof Reflect.get(e,"deadlineMs")=="number"&&Number.isSafeInteger(Reflect.get(e,"deadlineMs"))&&Number(Reflect.get(e,"deadlineMs"))>0}export function resolveEngineTaskInputs(e,n){const r=e.target.inputs,t=n.inputs;return Object.freeze({...t.configuration!==void 0?{configuration:t.configuration}:r.configuration!==void 0?{configuration:r.configuration}:{},environment:Object.freeze({...r.environment,...t.environment}),fixtures:Object.freeze({...r.fixtures,...t.fixtures}),...t.setupData!==void 0?{setupData:t.setupData}:r.setupData!==void 0?{setupData:r.setupData}:{},supportModules:Object.freeze({...r.supportModules,...t.supportModules})})}export function beginEngineExecution(e){const n=u(e),r=Object.freeze({...e,...n===null?{}:{observer:n.observer}});let t=null,o=!1,i=!1;return Object.freeze({request:r,acceptResult(s){if(o)throw new Error("Engine execution boundary is already closed");if(t!==null)throw new Error("Engine execution boundary already accepted a result");return n?.assertValid(),t=s,t},close(){o||(n?.close(),o=!0)},commit(){if(!o)throw new Error("Engine execution boundary must be closed before it is committed");if(i)throw new Error("Engine execution boundary is already committed");if(t===null)throw new Error("Engine execution boundary cannot commit without an accepted result");n?.assertValid(),n?.commit(),i=!0}})}
@@ -1 +1 @@
1
- export*from"./capabilities.js";export*from"./evidence.js";export*from"./execution.js";export{EngineInvocationCleanupDeadlineExceededError,createEngineInvocationScope}from"./execution-scope.js";export{ENGINE_RUNTIME_ARTIFACT_MARKER,encodeEngineRuntimeArtifactPayload,findEncodedEngineRuntimeArtifacts,normalizeEngineJsonValue}from"./runtime-artifact.js";
1
+ export*from"./profiles.js";export*from"./evidence.js";export*from"./execution.js";export{EngineInvocationCleanupDeadlineExceededError,createEngineInvocationScope}from"./execution-scope.js";export{normalizeEngineJsonValue}from"./runtime-artifact.js";
@@ -1 +1 @@
1
- export const ENGINE_RUNTIME_ARTIFACT_MARKER="TESTKIT_ARTIFACT:",MAX_ENGINE_RUNTIME_ARTIFACT_BYTES=1048576,MAX_ENGINE_RUNTIME_ARTIFACT_DEPTH=64,MAX_ENGINE_RUNTIME_ARTIFACT_NODES=1e5,MAX_ENCODED_ENGINE_RUNTIME_ARTIFACT_BYTES=4194304;export function normalizeEngineRuntimeArtifactPayload(t){const e=m(t,"Engine runtime artifact");N(e,["contentType","data","emittedAt","kind","name","summary"]);const n={contentType:c(e.contentType,"Engine runtime artifact.contentType",200),data:normalizeEngineJsonValue(e.data,"Engine runtime artifact data"),emittedAt:A(e.emittedAt),kind:T(e.kind,"Engine runtime artifact.kind",200),name:c(e.name,"Engine runtime artifact.name",200),summary:T(e.summary,"Engine runtime artifact.summary",4096)},r=JSON.stringify(n);if(a(r)>1048576)throw new Error("Engine runtime artifact exceeds 1048576 bytes");return Object.freeze(n)}export function encodeEngineRuntimeArtifactPayload(t){const e=encodeURIComponent(JSON.stringify(normalizeEngineRuntimeArtifactPayload(t)));if(a(e)>4194304)throw new Error("Encoded engine runtime artifact exceeds 4194304 bytes");return e}export function decodeEngineRuntimeArtifactPayload(t){if(typeof t!="string"||t.length===0)throw new Error("Encoded engine runtime artifact must be a non-empty string");if(a(t)>4194304)throw new Error("Encoded engine runtime artifact exceeds 4194304 bytes");let e;try{e=decodeURIComponent(t)}catch(r){throw new Error("Encoded engine runtime artifact is not valid URI data",{cause:r})}let n;try{n=JSON.parse(e)}catch(r){throw new Error("Encoded engine runtime artifact is not valid JSON",{cause:r})}return normalizeEngineRuntimeArtifactPayload(n)}export function findEncodedEngineRuntimeArtifacts(t){const e=[];let n=0;for(;n<t.length;){const r=t.indexOf(ENGINE_RUNTIME_ARTIFACT_MARKER,n);if(r<0)break;const i=r+ENGINE_RUNTIME_ARTIFACT_MARKER.length;let o=i;for(;o<t.length&&!I(t.charCodeAt(o));)o+=1;e.push(t.slice(i,o)),n=Math.max(o,i+1)}return Object.freeze(e)}export function normalizeEngineJsonValue(t,e="Engine JSON value"){return s(t,e,"$",0,new Set,{nodes:0})}function s(t,e,n,r,i,o){if(o.nodes+=1,o.nodes>1e5)throw new Error(`${e} exceeds 100000 JSON nodes`);if(r>64)throw new Error(`${e} exceeds depth 64 at ${n}`);if(t===null||typeof t=="string"||typeof t=="boolean")return t;if(typeof t=="number"){if(!Number.isFinite(t))throw new Error(`${e} ${n} must be finite`);return t}if(typeof t!="object")throw new Error(`${e} ${n} is not a JSON value`);if(i.has(t))throw new Error(`${e} contains a cycle at ${n}`);i.add(t);try{if(Array.isArray(t))return Object.freeze(t.map((E,f)=>s(E,e,`${n}[${f.toString()}]`,r+1,i,o)));const d=Object.getPrototypeOf(t);if(d!==Object.prototype&&d!==null)throw new Error(`${e} ${n} must be a plain JSON object`);const _={};for(const[E,f]of Object.entries(t))_[E]=s(f,e,`${n}.${E}`,r+1,i,o);return Object.freeze(_)}finally{i.delete(t)}}function A(t){const e=c(t,"Engine runtime artifact.emittedAt",100);if(!Number.isFinite(Date.parse(e)))throw new Error("Engine runtime artifact.emittedAt must be a timestamp");return e}function T(t,e,n){return t===null?null:c(t,e,n)}function c(t,e,n){if(typeof t!="string"||t.trim().length===0)throw new Error(`${e} must be a non-empty string`);if(t.length>n)throw new Error(`${e} exceeds ${n.toString()} characters`);return t.trim()}function N(t,e){const n=new Set(e),r=Object.keys(t).find(i=>!n.has(i));if(r!==void 0)throw new Error(`Engine runtime artifact contains unexpected field ${r}`);for(const i of e)if(!Object.hasOwn(t,i))throw new Error(`Engine runtime artifact is missing field ${i}`)}function m(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`${e} must be an object`);return t}function I(t){return t===34||t===9||t===10||t===13||t===32}function a(t){let e=0;for(let n=0;n<t.length;n+=1){const r=t.charCodeAt(n);if(r<128)e+=1;else if(r<2048)e+=2;else if(r>=55296&&r<=56319){const i=t.charCodeAt(n+1);i>=56320&&i<=57343?(n+=1,e+=4):e+=3}else e+=3}return e}
1
+ export const MAX_ENGINE_RUNTIME_ARTIFACT_DEPTH=64,MAX_ENGINE_RUNTIME_ARTIFACT_NODES=1e5;export function normalizeEngineJsonValue(r,o="Engine JSON value"){return _(r,o,"$",0,new Set,{nodes:0})}function _(r,o,t,E,n,e){if(e.nodes+=1,e.nodes>1e5)throw new Error(`${o} exceeds 100000 JSON nodes`);if(E>64)throw new Error(`${o} exceeds depth 64 at ${t}`);if(r===null||typeof r=="string"||typeof r=="boolean")return r;if(typeof r=="number"){if(!Number.isFinite(r))throw new Error(`${o} ${t} must be finite`);return r}if(typeof r!="object")throw new Error(`${o} ${t} is not a JSON value`);if(n.has(r))throw new Error(`${o} contains a cycle at ${t}`);n.add(r);try{if(Array.isArray(r))return Object.freeze(r.map((i,N)=>_(i,o,`${t}[${N.toString()}]`,E+1,n,e)));const f=Object.getPrototypeOf(r);if(f!==Object.prototype&&f!==null)throw new Error(`${o} ${t} must be a plain JSON object`);const T={};for(const[i,N]of Object.entries(r))T[i]=_(N,o,`${t}.${i}`,E+1,n,e);return Object.freeze(T)}finally{n.delete(r)}}
@@ -1 +1 @@
1
- import p from"fs";import c from"path";import{collectDirectorySummary as E,listFiles as g}from"../process/files/directory-status.js";const S="manifest.json",M=10080*60*1e3;export function collectBundleCacheStatus(t,e="shared"){const n=c.join(t,".testkit","_bundles",e||"shared"),s=E(n),r=g(n),o=r.filter(a=>a.path.endsWith(".js")),u=r.filter(a=>a.path.endsWith(".entry.mjs")),l=C(n),i=new Set(l.entries.flatMap(a=>[a.outputFile,a.entryFile].filter(m).map(x=>c.resolve(x)))),f=D(u),h=[...f.values()].filter(a=>a.length>1).length,d=r.filter(a=>c.basename(a.path)!==S&&!i.has(c.resolve(a.path))),F=w(o,l);return{serviceName:e,path:n,exists:s.exists,sizeBytes:s.sizeBytes,fileCount:s.fileCount,jsFileCount:o.length,entryFileCount:u.length,sourceFileCount:f.size||l.sourceFileCount,duplicatedSourceCount:h,sourcemapFileCount:F.count,sourcemapStatus:F.status,manifest:{exists:l.exists,entryCount:l.entries.length},unmanagedFileCount:d.length}}export function collectBundleCleanupTargets(t,{allConfigs:e=[],serviceName:n=null}={}){const s=n?[n]:e.map(o=>o.name).sort(),r=[];for(const o of s){const u=c.join(t,".testkit","_bundles",o||"shared");if(g(u).length===0)continue;const i=C(u),f=N(u,i.entries);r.push(...f.map(h=>({...h,serviceName:o})))}return _(r)}function C(t){const e=c.join(t,S);if(!p.existsSync(e))return{exists:!1,entries:[],sourceFileCount:0};try{const n=JSON.parse(p.readFileSync(e,"utf8")),s=b(n);return{exists:!0,entries:s,sourceFileCount:new Set(s.map(r=>r.sourceFile).filter(m)).size}}catch{return{exists:!0,entries:[],sourceFileCount:0}}}function b(t){return!A(t)||!Array.isArray(t.entries)?[]:t.entries.map(j).filter(e=>e!==null)}function j(t){if(!A(t))return null;const e={hasSourcemap:!!t.hasSourcemap};return typeof t.cacheKey=="string"&&(e.cacheKey=t.cacheKey),typeof t.createdAt=="string"&&(e.createdAt=t.createdAt),typeof t.entryFile=="string"&&(e.entryFile=t.entryFile),typeof t.lastUsedAt=="string"&&(e.lastUsedAt=t.lastUsedAt),typeof t.outputFile=="string"&&(e.outputFile=t.outputFile),typeof t.sourceFile=="string"&&(e.sourceFile=t.sourceFile),e}function D(t){const e=new Map;for(const n of t){const s=P(n.path);if(!s)continue;const r=e.get(s)||[];r.push(n),e.set(s,r)}return e}function P(t){try{const n=p.readFileSync(t,"utf8").match(/import \* as suiteModule from ("(?:\\.|[^"])+");/);if(!n)return null;const s=JSON.parse(n[1]);return typeof s=="string"?s:null}catch{return null}}function w(t,e){if(e.entries.length>0){const r=e.entries.filter(o=>o.hasSourcemap).length;return{count:r,status:r>0?"present":"none"}}const n=t.slice(0,25);return n.some(r=>T(r.path))?{count:null,status:"detected"}:{count:0,status:t.length>n.length?"not-detected-in-sample":"none"}}function T(t){try{return/sourceMappingURL=data:application\/json/.test(p.readFileSync(t,"utf8"))}catch{return!1}}function N(t,e){if(e.length===0)return[];const n=Date.now(),s=K(e,o=>o.sourceFile||o.cacheKey||o.outputFile),r=[];for(const o of s.values()){const u=[...o].sort(z),l=new Set(u.filter((i,f)=>f<2||n-y(i)<M).map(i=>i.cacheKey||i.outputFile));for(const i of u){const f=i.cacheKey||i.outputFile;if(!l.has(f))for(const h of[i.outputFile,i.entryFile].filter(m)){const d=U(t,h);d&&r.push({path:d,reason:"stale-bundle-version",sourceFile:i.sourceFile||null})}}}return r}function U(t,e){const n=c.resolve(t),s=c.resolve(n,e);if(!B(n,s))return null;const r=c.dirname(s);if(!p.existsSync(r))return s;try{const o=p.realpathSync.native(n),u=p.realpathSync.native(r);if(u!==o&&!B(o,u))return null}catch{return null}return s}function B(t,e){const n=c.relative(t,e);return!!n&&n!==".."&&!n.startsWith(`..${c.sep}`)&&!c.isAbsolute(n)}function z(t,e){return y(e)-y(t)||(t.outputFile||"").localeCompare(e.outputFile||"")}function y(t){return Date.parse(String(t.lastUsedAt||t.createdAt||0))}function K(t,e){const n=new Map;for(const s of t){const r=e(s),o=n.get(r)||[];o.push(s),n.set(r,o)}return n}function _(t){const e=new Map;for(const n of t)n.path&&e.set(c.resolve(n.path),{...n,path:c.resolve(n.path)});return[...e.values()].sort((n,s)=>n.path.localeCompare(s.path))}function A(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function m(t){return typeof t=="string"&&t.length>0}
1
+ import p from"fs";import c from"path";import{collectDirectorySummary as E,listFiles as g}from"../process/files/directory-status.js";import{isUnknownRecord as S}from"../kernel/unknown-values.js";const C="manifest.json",M=10080*60*1e3;export function collectBundleCacheStatus(t,e="shared"){const n=c.join(t,".testkit","_bundles",e||"shared"),s=E(n),r=g(n),o=r.filter(a=>a.path.endsWith(".js")),u=r.filter(a=>a.path.endsWith(".entry.mjs")),l=B(n),i=new Set(l.entries.flatMap(a=>[a.outputFile,a.entryFile].filter(y).map(A=>c.resolve(A)))),f=j(u),h=[...f.values()].filter(a=>a.length>1).length,d=r.filter(a=>c.basename(a.path)!==C&&!i.has(c.resolve(a.path))),F=P(o,l);return{serviceName:e,path:n,exists:s.exists,sizeBytes:s.sizeBytes,fileCount:s.fileCount,jsFileCount:o.length,entryFileCount:u.length,sourceFileCount:f.size||l.sourceFileCount,duplicatedSourceCount:h,sourcemapFileCount:F.count,sourcemapStatus:F.status,manifest:{exists:l.exists,entryCount:l.entries.length},unmanagedFileCount:d.length}}export function collectBundleCleanupTargets(t,{allConfigs:e=[],serviceName:n=null}={}){const s=n?[n]:e.map(o=>o.name).sort(),r=[];for(const o of s){const u=c.join(t,".testkit","_bundles",o||"shared");if(g(u).length===0)continue;const i=B(u),f=U(u,i.entries);r.push(...f.map(h=>({...h,serviceName:o})))}return K(r)}function B(t){const e=c.join(t,C);if(!p.existsSync(e))return{exists:!1,entries:[],sourceFileCount:0};try{const n=JSON.parse(p.readFileSync(e,"utf8")),s=D(n);return{exists:!0,entries:s,sourceFileCount:new Set(s.map(r=>r.sourceFile).filter(y)).size}}catch{return{exists:!0,entries:[],sourceFileCount:0}}}function D(t){return!S(t)||!Array.isArray(t.entries)?[]:t.entries.map(b).filter(e=>e!==null)}function b(t){if(!S(t))return null;const e={hasSourcemap:!!t.hasSourcemap};return typeof t.cacheKey=="string"&&(e.cacheKey=t.cacheKey),typeof t.createdAt=="string"&&(e.createdAt=t.createdAt),typeof t.entryFile=="string"&&(e.entryFile=t.entryFile),typeof t.lastUsedAt=="string"&&(e.lastUsedAt=t.lastUsedAt),typeof t.outputFile=="string"&&(e.outputFile=t.outputFile),typeof t.sourceFile=="string"&&(e.sourceFile=t.sourceFile),e}function j(t){const e=new Map;for(const n of t){const s=w(n.path);if(!s)continue;const r=e.get(s)||[];r.push(n),e.set(s,r)}return e}function w(t){try{const n=p.readFileSync(t,"utf8").match(/import \* as suiteModule from ("(?:\\.|[^"])+");/);if(!n)return null;const s=JSON.parse(n[1]);return typeof s=="string"?s:null}catch{return null}}function P(t,e){if(e.entries.length>0){const r=e.entries.filter(o=>o.hasSourcemap).length;return{count:r,status:r>0?"present":"none"}}const n=t.slice(0,25);return n.some(r=>T(r.path))?{count:null,status:"detected"}:{count:0,status:t.length>n.length?"not-detected-in-sample":"none"}}function T(t){try{return/sourceMappingURL=data:application\/json/.test(p.readFileSync(t,"utf8"))}catch{return!1}}function U(t,e){if(e.length===0)return[];const n=Date.now(),s=z(e,o=>o.sourceFile||o.cacheKey||o.outputFile),r=[];for(const o of s.values()){const u=[...o].sort(k),l=new Set(u.filter((i,f)=>f<2||n-m(i)<M).map(i=>i.cacheKey||i.outputFile));for(const i of u){const f=i.cacheKey||i.outputFile;if(!l.has(f))for(const h of[i.outputFile,i.entryFile].filter(y)){const d=N(t,h);d&&r.push({path:d,reason:"stale-bundle-version",sourceFile:i.sourceFile||null})}}}return r}function N(t,e){const n=c.resolve(t),s=c.resolve(n,e);if(!x(n,s))return null;const r=c.dirname(s);if(!p.existsSync(r))return s;try{const o=p.realpathSync.native(n),u=p.realpathSync.native(r);if(u!==o&&!x(o,u))return null}catch{return null}return s}function x(t,e){const n=c.relative(t,e);return!!n&&n!==".."&&!n.startsWith(`..${c.sep}`)&&!c.isAbsolute(n)}function k(t,e){return m(e)-m(t)||(t.outputFile||"").localeCompare(e.outputFile||"")}function m(t){return Date.parse(String(t.lastUsedAt||t.createdAt||0))}function z(t,e){const n=new Map;for(const s of t){const r=e(s),o=n.get(r)||[];o.push(s),n.set(r,o)}return n}function K(t){const e=new Map;for(const n of t)n.path&&e.set(c.resolve(n.path),{...n,path:c.resolve(n.path)});return[...e.values()].sort((n,s)=>n.path.localeCompare(s.path))}function y(t){return typeof t=="string"&&t.length>0}
@@ -1 +1 @@
1
- import{builtinModules as u}from"node:module";import{NODE_VITEST_PACKAGE_REQUIREMENTS as s,NODE_VITEST_PRIVATE_PACKAGE_PREFIXES as d}from"./installations/package-requirements.js";import{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS as a}from"./installations/package-requirements.js";import{BUILT_IN_RUNNER_PROFILES as i}from"./definitions.js";export{isEngineProfileIdentity}from"./definitions.js";export const BUILT_IN_ENGINE_CATALOG=Object.freeze({profiles:i,profilesForTestType(e){return Object.freeze(i.filter(n=>n.supportedTestTypes.includes(e)))},resolve(e,n){const t=i.find(r=>r.engineId===n&&r.supportedTestTypes.includes(e));if(!t)throw new Error(`Unsupported engine/test-type pair: ${n}/${e}`);return t}});export{i as BUILT_IN_RUNNER_PROFILES};export function resolveEngineProfile(e,n){return BUILT_IN_ENGINE_CATALOG.resolve(e,n)}const p=new Set(u.map(e=>e.replace(/^node:/u,""))),l=Object.freeze([...s.map(({packageName:e})=>Object.freeze({engineId:"node-vitest",name:e})),...a.map(({packageName:e})=>Object.freeze({engineId:"playwright",name:e}))]);export async function buildEngineConfigurations(e,n){if(!n.has("k6"))return;const{buildK6RepositoryConfiguration:t}=await import("./k6/adapter/repository-configuration.js"),r=t(e);return r===void 0?void 0:{k6:r}}export function expectedEngineAuthoringModule(e){switch(e){case"k6-http":case"k6-dal":return"@gfdelarue/testkit/k6";case"node-vitest-data":return"@gfdelarue/testkit/node-vitest/data";case"node-vitest-contract":return"@gfdelarue/testkit/node-vitest/contract";case"playwright-ui":return"@gfdelarue/testkit/playwright"}}export function invalidEngineAuthoringImport(e,n,t,r=expectedEngineAuthoringModule(n.profileId)){return new Error(`Invalid Testkit authoring in "${e}": ${n.engineId}/${n.profileId} may not import "${t}"; use "${r}" for this suite`)}export function requireMatchingHostImport(e,n,t){if(n.engineId==="k6"&&g(t))throw new Error(`Invalid Testkit authoring in "${e}": k6 suites may not import Node built-in module "${t}"`);if(n.engineId!=="k6"&&I(t))throw new Error(`Invalid Testkit authoring in "${e}": ${n.engineId} suites may not import k6 module "${t}"`);if(d.some(o=>t.startsWith(o)))throw new Error(`Invalid Testkit authoring in "${e}": ${n.engineId} suites may not import private Vitest implementation package "${t}"`);const r=managedPublicPackageOwner(t);if(r!==null&&r.engineId!==n.engineId)throw new Error(`Invalid Testkit authoring in "${e}": ${n.engineId} suites may not import ${r.engineId} package "${t}"`)}export function managedPublicPackageOwner(e){for(const n of l)if(e===n.name||e.startsWith(`${n.name}/`))return n;return null}function g(e){const n=e.replace(/^node:/u,"");return p.has(n)}function I(e){return e==="k6"||e.startsWith("k6/")}
1
+ import{NODE_VITEST_PACKAGE_REQUIREMENTS as u,NODE_VITEST_PRIVATE_PACKAGE_PREFIXES as l}from"./installations/package-requirements.js";import{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS as a}from"./installations/package-requirements.js";import{BUILT_IN_RUNNER_PROFILES as i,identityProfile as s}from"./definitions.js";export{isEngineProfileIdentity}from"./definitions.js";export{listPlainVitestFiles}from"./node-vitest/inventory/index.js";export{resolveVitestSelection}from"./node-vitest/selection.js";export function profilesForTestType(e){return Object.freeze(i.filter(t=>t.supportedTestTypes.includes(e)))}export{i as BUILT_IN_RUNNER_PROFILES};export function resolveEngineProfile(e,t){const n=s({engineId:t,testType:e});if(!n)throw new Error(`Unsupported engine/test-type pair: ${t}/${e}`);return n}export function resolveExecutionProfile(e){const t=s(e);if(t===void 0||t.id!==e.profileId)throw new Error(`Execution identity ${e.testType??"untyped"}/${e.engineId}/${e.profileId} conflicts with catalog profile ${t?.id??"none"}`);return t}const p=Object.freeze([...u.map(({packageName:e})=>Object.freeze({engineId:"node-vitest",name:e})),...a.map(({packageName:e})=>Object.freeze({engineId:"playwright",name:e}))]);export function expectedEngineAuthoringModule(e){switch(e){case"node-vitest-data":return"@gfdelarue/testkit/node-vitest/data";case"node-vitest-contract":return"@gfdelarue/testkit/node-vitest/contract";case"node-vitest":return null;case"playwright-ui":return"@gfdelarue/testkit/playwright"}}export function allowsEngineAuthoringImport(e,t){return t===e||t==="@gfdelarue/testkit/environment"||!(t.startsWith("@gfdelarue/testkit/")||t.startsWith("@gfdelarue/testkit-engine-"))}export function invalidEngineAuthoringImport(e,t,n,r=expectedEngineAuthoringModule(t.profileId)){const o=r===null?"":`; use "${r}" for this suite`;return new Error(`Invalid Testkit authoring in "${e}": ${t.engineId}/${t.profileId} may not import "${n}"${o}`)}export function requireMatchingEngineImport(e,t,n){if(l.some(o=>n.startsWith(o)))throw new Error(`Invalid Testkit authoring in "${e}": ${t.engineId} suites may not import private Vitest implementation package "${n}"`);const r=managedPublicPackageOwner(n);if(r!==null&&r.engineId!==t.engineId)throw new Error(`Invalid Testkit authoring in "${e}": ${t.engineId} suites may not import ${r.engineId} package "${n}"`)}export function managedPublicPackageOwner(e){for(const t of p)if(e===t.name||e.startsWith(`${t.name}/`))return t;return null}
@@ -0,0 +1 @@
1
+ import{isUnknownRecord as o}from"../../kernel/unknown-values.js";const u="TESTKIT_ENVIRONMENT_VALUE_MISSING",f=16,l=256,m=2048,E=16384,p=8,g={database:"database URL",endpoint:"URL",handle:"handle"},h=/^EnvironmentValueMissingError: This Testkit run provides no (?:(database|endpoint|handle) named ("(?:[^"\\\n]|\\.)*")|default (URL|database URL))\./gmu;export class EnvironmentValueMissingError extends Error{code=u;available;kind;valueName;constructor(e,n,r){super(M(e,n,r)),this.name="EnvironmentValueMissingError",this.available=Object.freeze([...r??[]]),this.kind=e,this.valueName=n}}export function requireEnvironmentValue(t,e,n){if(typeof n!="string"||n.length===0)throw new TypeError(`The ${e} name must be a non-empty string`);if(t===null)throw new EnvironmentValueMissingError(e,n,null);const r=e==="endpoint"?t.endpoints:t.databases;if(!Object.hasOwn(r,n))throw new EnvironmentValueMissingError(e,n,Object.keys(r).sort());return r[n]}export function readEnvironmentValueMissing(t){let e=t;for(let n=0;n<p&&o(e);n+=1){if(e.code===u&&e.name==="EnvironmentValueMissingError")return d(e);e=e.cause}return null}export function readEnvironmentValueMissingText(t){return[...t.matchAll(h)].flatMap(e=>{const[,n,r]=e,i=e.at(3);if(i!==void 0)return[{kind:i==="URL"?"endpoint":"database",valueName:null}];if(n!=="database"&&n!=="endpoint"&&n!=="handle")return[];const s=parseJson(r);return typeof s=="string"&&s.length>0?[{kind:n,valueName:s}]:[]})}export function boundEnvironmentValueMissingText(t){return t.slice(0,E)}function c(t){const e=new Set,n=[];for(const{kind:r,valueName:i}of t){const s=i===null?null:i.slice(0,l),a=JSON.stringify([r,s]);if(!e.has(a)&&(e.add(a),n.push({kind:r,valueName:s}),n.length===f))break}return n}export function environmentValueMissingFailure(t,e){return{classification:"infra",code:u,details:{missing:c(t).map(({kind:n,valueName:r})=>({kind:n,valueName:r}))},message:e.slice(0,m)}}export function parseEnvironmentValueMissingFailure(t,e){if(t===void 0)return null;const n=readEnvironmentValueMissingFailure(t);if(n===null||!o(t)||typeof t.message!="string")throw new Error(`${e} must name the missing values`);return environmentValueMissingFailure(n,t.message)}export function readEnvironmentValueMissingFailure(t){if(!o(t)||t.code!==u||t.classification!=="infra"||!o(t.details))return null;const e=t.details.missing;if(!Array.isArray(e)||e.length===0)return null;const n=e.map(d);return n.some(r=>r===null)?null:c(n.filter(r=>r!==null))}function d(t){if(!o(t))return null;const{kind:e,valueName:n}=t;return e!=="database"&&e!=="endpoint"&&e!=="handle"?null:n===null?{kind:e,valueName:n}:typeof n!="string"||n.length===0?null:{kind:e,valueName:n.slice(0,l)}}export function parseEnvironmentValueRecord(t,e){if(!o(t))throw new Error(`${e} must be an object`);const n={};for(const[r,i]of Object.entries(t)){if(r.length===0||typeof i!="string"||i.length===0||i.includes("\0"))throw new Error(`${e} must map names to non-empty strings`);Object.defineProperty(n,r,{enumerable:!0,value:i})}return Object.freeze(n)}function M(t,e,n){const r=e===null?`default ${g[t]}`:`${t} named ${JSON.stringify(e)}`;if(n===null)return`No ${r} is available, because this process is not running in a Testkit run`;const i=n.length===0?`It provides no ${t}s.`:`It provides ${n.join(", ")}.`;return`This Testkit run provides no ${r}. ${i}`}export function parseJson(t){try{return JSON.parse(t)}catch{return null}}
@@ -1 +1 @@
1
- export function resolveRuntimeFixtureEntry(t,r){const n=t.filter(e=>e.aliases.includes(r));if(n.length===0){const e=t.map(o=>o.path).join(", ")||"none";throw new Error(`Unknown testkit fixture "${r}". Available fixtures: ${e}`)}if(n.length>1)throw new Error(`Ambiguous testkit fixture "${r}". Use one of: ${n.map(e=>e.path).join(", ")}`);return n[0]}export function parseRuntimeFixtureManifestEntries(t,r){if(s(t)&&Object.keys(t).length===0)return[];if(!s(t))throw new Error(`${r} must contain an object`);if(Reflect.get(t,"version")!==1)throw new Error(`${r}.version must be 1`);i(t,"testFile",r);const n=Reflect.get(t,"entries");if(!Array.isArray(n))throw new Error(`${r}.entries must be an array`);return n.map((e,o)=>a(e,`${r}.entries[${String(o)}]`))}function a(t,r){if(!s(t))throw new Error(`${r} must be an object`);return{absolutePath:i(t,"absolutePath",r),aliases:c(t,"aliases",r),contentType:i(t,"contentType",r),filename:i(t,"filename",r),path:i(t,"path",r),root:i(t,"root",r),rootRelativePath:i(t,"rootRelativePath",r),sha256:i(t,"sha256",r),sizeBytes:g(t,"sizeBytes",r)}}function i(t,r,n){const e=Reflect.get(t,r);if(typeof e!="string"||e.length===0)throw new Error(`${n}.${String(r)} must be a non-empty string`);return e}function c(t,r,n){const e=Reflect.get(t,r);if(!Array.isArray(e))throw new Error(`${n}.${String(r)} must be an array`);return e.map((o,f)=>{if(typeof o!="string"||o.length===0)throw new Error(`${n}.${String(r)}[${String(f)}] must be a non-empty string`);return o})}function g(t,r,n){const e=Reflect.get(t,r);if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new Error(`${n}.${String(r)} must be a non-negative integer`);return e}function s(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}
1
+ import{isUnknownRecord as s}from"../../kernel/unknown-values.js";export function resolveRuntimeFixtureEntry(r,t){const n=r.filter(e=>e.aliases.includes(t));if(n.length===0){const e=r.map(o=>o.path).join(", ")||"none";throw new Error(`Unknown testkit fixture "${t}". Available fixtures: ${e}`)}if(n.length>1)throw new Error(`Ambiguous testkit fixture "${t}". Use one of: ${n.map(e=>e.path).join(", ")}`);return n[0]}export function parseRuntimeFixtureManifestEntries(r,t){if(s(r)&&Object.keys(r).length===0)return[];if(!s(r))throw new Error(`${t} must contain an object`);if(Reflect.get(r,"version")!==1)throw new Error(`${t}.version must be 1`);i(r,"testFile",t);const n=Reflect.get(r,"entries");if(!Array.isArray(n))throw new Error(`${t}.entries must be an array`);return n.map((e,o)=>a(e,`${t}.entries[${String(o)}]`))}function a(r,t){if(!s(r))throw new Error(`${t} must be an object`);return{absolutePath:i(r,"absolutePath",t),aliases:c(r,"aliases",t),contentType:i(r,"contentType",t),filename:i(r,"filename",t),path:i(r,"path",t),root:i(r,"root",t),rootRelativePath:i(r,"rootRelativePath",t),sha256:i(r,"sha256",t),sizeBytes:g(r,"sizeBytes",t)}}function i(r,t,n){const e=Reflect.get(r,t);if(typeof e!="string"||e.length===0)throw new Error(`${n}.${String(t)} must be a non-empty string`);return e}function c(r,t,n){const e=Reflect.get(r,t);if(!Array.isArray(e))throw new Error(`${n}.${String(t)} must be an array`);return e.map((o,f)=>{if(typeof o!="string"||o.length===0)throw new Error(`${n}.${String(t)}[${String(f)}] must be a non-empty string`);return o})}function g(r,t,n){const e=Reflect.get(r,t);if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new Error(`${n}.${String(t)} must be a non-negative integer`);return e}
@@ -1 +1 @@
1
- export const BUILT_IN_ENGINE_DEFINITIONS=Object.freeze({k6:Object.freeze({id:"k6",profiles:Object.freeze([t({capabilities:{applicationRuntime:"required",databaseRuntime:"optional",endpointAccess:"published-http",executionHost:"orchestrator",runtimeIsolation:"orchestrated",taskBatching:"isolated"},engineId:"k6",id:"k6-http",supportedTestTypes:["int","e2e","load"],endpointReadinessOwner:"orchestrator-http"}),t({capabilities:{applicationRuntime:"none",databaseRuntime:"required",endpointAccess:"none",executionHost:"orchestrator",runtimeIsolation:"orchestrated",taskBatching:"isolated"},engineId:"k6",id:"k6-dal",supportedTestTypes:["dal"],endpointReadinessOwner:"adapter"})]),async resolveInstallation(e){return(await import("./installations/k6.js")).resolveK6Installation(e)},async loadExecutor(){return(await import("./k6/adapter/index.js")).executeK6Engine}}),"node-vitest":Object.freeze({id:"node-vitest",profiles:Object.freeze([t({capabilities:{applicationRuntime:"required",databaseRuntime:"optional",endpointAccess:"published-http",executionHost:"orchestrator",runtimeIsolation:"orchestrated",taskBatching:"isolated"},engineId:"node-vitest",id:"node-vitest-data",supportedTestTypes:["data"],endpointReadinessOwner:"adapter"}),t({capabilities:{applicationRuntime:"required",databaseRuntime:"optional",endpointAccess:"published-http",executionHost:"orchestrator",runtimeIsolation:"orchestrated",taskBatching:"isolated"},engineId:"node-vitest",id:"node-vitest-contract",supportedTestTypes:["contract"],endpointReadinessOwner:"adapter"})]),async resolveInstallation(e){return(await import("./installations/node-vitest.js")).resolveNodeVitestInstallation(e)},async loadExecutor(){return(await import("./node-vitest/adapter/index.js")).executeNodeVitestEngine}}),playwright:Object.freeze({id:"playwright",profiles:Object.freeze([t({capabilities:{applicationRuntime:"required",databaseRuntime:"optional",endpointAccess:"published-http",executionHost:"orchestrator",runtimeIsolation:"orchestrated",taskBatching:"compatible"},engineId:"playwright",id:"playwright-ui",supportedTestTypes:["ui"],endpointReadinessOwner:"orchestrator-http"})]),async resolveInstallation(e){return(await import("./installations/playwright.js")).resolvePlaywrightInstallation(e)},async loadExecutor(){return(await import("./playwright/adapter/index.js")).executePlaywrightEngine}})}),BUILT_IN_RUNNER_PROFILES=Object.freeze(Object.values(BUILT_IN_ENGINE_DEFINITIONS).flatMap(e=>e.profiles));export function isEngineProfileIdentity(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const i=e,n=BUILT_IN_RUNNER_PROFILES.find(a=>a.engineId===i.engineId&&a.supportedTestTypes.some(o=>o===i.testType));return n!==void 0&&n.id===i.profileId}function t(e){return Object.freeze(e.capabilities),Object.freeze(e.supportedTestTypes),Object.freeze(e)}
1
+ export const BUILT_IN_ENGINE_DEFINITIONS=Object.freeze({"node-vitest":Object.freeze({id:"node-vitest",profiles:Object.freeze([i({taskBatching:"isolated",engineId:"node-vitest",id:"node-vitest-data",supportedTestTypes:["data"]}),i({taskBatching:"isolated",engineId:"node-vitest",id:"node-vitest-contract",supportedTestTypes:["contract"]}),i({taskBatching:"selection",engineId:"node-vitest",id:"node-vitest",supportedTestTypes:[]})]),async resolveInstallation(e){return(await import("./installations/node-vitest.js")).resolveNodeVitestInstallation(e)},async loadExecutor(){return(await import("./node-vitest/adapter/index.js")).executeNodeVitestEngine}}),playwright:Object.freeze({id:"playwright",profiles:Object.freeze([i({taskBatching:"compatible",engineId:"playwright",id:"playwright-ui",supportedTestTypes:["ui"]})]),async resolveInstallation(e){return(await import("./installations/playwright.js")).resolvePlaywrightInstallation(e)},async loadExecutor(){return(await import("./playwright/adapter/index.js")).executePlaywrightEngine}})}),BUILT_IN_RUNNER_PROFILES=Object.freeze(Object.values(BUILT_IN_ENGINE_DEFINITIONS).flatMap(e=>e.profiles));export function isEngineProfileIdentity(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return typeof t.profileId=="string"&&identityProfile(t)?.id===t.profileId}export function identityProfile(e){return BUILT_IN_RUNNER_PROFILES.find(t=>t.engineId===e.engineId&&(e.testType===void 0?t.supportedTestTypes.length===0:t.supportedTestTypes.some(n=>n===e.testType)))}function i(e){return Object.freeze(e.supportedTestTypes),Object.freeze(e)}
@@ -0,0 +1 @@
1
+ import w from"node:http";import E from"node:https";import{isIP as f}from"node:net";import{isUnknownRecord as o}from"../../kernel/unknown-values.js";import{EnvironmentValueMissingError as p,parseJson as b}from"../contracts/environment-values.js";export const HANDLE_OPERATION_TIMEOUT_MS=1e4,HANDLE_RESPONSE_MAX_BYTES=32*1024*1024;const l="ambiguous",g=/^https?:\/\/(\[[^\]]*\]|[^\s/?#@:[\]]+)(?::(\d{1,5}))?(?:\/\S*)?$/u,m=/^[A-Za-z0-9._~\u00a1-\uffff-]+$/u;export class EnvironmentHandleError extends Error{code="TESTKIT_ENVIRONMENT_HANDLE_FAILED";handleName;reason;constructor(r,e,n,s){super(n,s),this.name="EnvironmentHandleError",this.handleName=r,this.reason=e}}export class EnvironmentHandleAmbiguousError extends EnvironmentHandleError{count;constructor(r,e){super(r,"ambiguous",`${e.toString()} captures share the handle name ${JSON.stringify(r)}. Give each capture a distinct id in its setup module.`),this.name="EnvironmentHandleAmbiguousError",this.count=e}}export function ambiguousHandleDescriptor(t){return{count:t,kind:l}}export function requireEnvironmentHandle(t,r){if(typeof r!="string"||r.length===0)throw new TypeError("The handle name must be a non-empty string");if(t===null)throw new p("handle",r,null);if(!Object.hasOwn(t,r))throw new p("handle",r,Object.keys(t).sort());const e=t[r];if(e.kind===l)throw new EnvironmentHandleAmbiguousError(r,typeof e.count=="number"?e.count:2);if(e.kind!=="http-capture")throw new EnvironmentHandleError(r,"unsupported",`Handle ${JSON.stringify(r)} has kind ${JSON.stringify(e.kind)}, which this Testkit cannot use`);return O(r,H(r,e))}export function parseEnvironmentHandleRecord(t,r){if(!o(t))throw new Error(`${r} must be an object`);const e={};for(const[n,s]of Object.entries(t)){if(n.length===0||!o(s)||typeof s.kind!="string"||!s.kind)throw new Error(`${r} must map names to handle descriptors with a kind`);Object.defineProperty(e,n,{enumerable:!0,value:s})}return Object.freeze(e)}function H(t,r){const{requestsUrl:e,resetUrl:n,url:s}=r;if(!u(s)||!u(e)||!u(n))throw new EnvironmentHandleError(t,"invalid",`Handle ${JSON.stringify(t)} is not a valid http-capture descriptor: url, requestsUrl and resetUrl must be HTTP URLs`);return{requestsUrl:e,resetUrl:n,url:s}}function O(t,r){return Object.freeze({kind:"http-capture",url:r.url,async requests(){const e=await h(t,"GET",r.requestsUrl),n=b(e);if(!o(n)||!Array.isArray(n.requests)||!n.requests.every(N))throw new EnvironmentHandleError(t,"invalid",`Handle ${JSON.stringify(t)} returned malformed requests`);return n.requests},async reset(){await h(t,"DELETE",r.resetUrl)}})}async function h(t,r,e){let n;try{n=await T(r,e)}catch(s){throw new EnvironmentHandleError(t,"unavailable",y(t),{cause:s})}if(n.status===404||n.status===405)throw new EnvironmentHandleError(t,"refused",`Handle ${JSON.stringify(t)} was refused: its capture does not offer this operation to this reference`);if(n.status<200||n.status>=300)throw new EnvironmentHandleError(t,"unavailable",y(t));return n.body}function T(t,r){return new Promise((e,n)=>{const s=(r.startsWith("https:")?E:w).request(r,{method:t,signal:AbortSignal.timeout(HANDLE_OPERATION_TIMEOUT_MS)});s.on("error",n),s.once("response",i=>{const a=[];let c=0;i.on("data",d=>{if(c+=d.length,c>HANDLE_RESPONSE_MAX_BYTES){s.destroy(new Error("The handle operation response is too large"));return}a.push(d)}),i.on("error",n),i.once("end",()=>{e({body:Buffer.concat(a).toString("utf8"),status:i.statusCode??0})})}),s.end()})}function y(t){return`Handle ${JSON.stringify(t)} is unavailable: its capture did not answer, and closes when the environment that prepared it is released`}function N(t){return o(t)&&typeof t.bodyBytes=="number"&&typeof t.bodyText=="string"&&typeof t.bodyTruncated=="boolean"&&o(t.headers)&&(t.method===null||typeof t.method=="string")&&(t.path===null||typeof t.path=="string")&&typeof t.receivedAt=="string"}function u(t){if(typeof t!="string"||t.length>2048)return!1;const r=g.exec(t);if(r===null||!URL.canParse(t))return!1;const e=r.at(2);return(e===void 0||Number(e)<=65535)&&S(r[1])}function S(t){if(t.startsWith("["))return f(t.slice(1,-1))===6;if(!m.test(t))return!1;const r=t.endsWith(".")?t.slice(0,-1):t;return!/^(?:\d+|0x[0-9a-f]*)$/iu.test(r.split(".").at(-1)??"")||f(r)===4}
@@ -0,0 +1 @@
1
+ import{requireEnvironmentHandle as o}from"./handles.js";import{requireEnvironmentValue as t}from"../contracts/environment-values.js";import{readNodeVitestRuntimeInput as i}from"../node-vitest/runtime/runtime-input.js";import{readPlaywrightContext as a}from"../playwright/runtime/runtime-input.js";export{EnvironmentHandleAmbiguousError,EnvironmentHandleError}from"./handles.js";export{EnvironmentValueMissingError}from"../contracts/environment-values.js";let e;export function endpoint(n){return t(r(),"endpoint",n)}export function database(n){return t(r(),"database",n)}export function handle(n){return o(r()?.handles??null,n)}function r(){if(e!==void 0)return e;const n=a()??i();return n===null?null:(e={databases:n.databases,endpoints:n.endpoints,handles:n.handles},e)}
@@ -1 +1 @@
1
- import e from"node:fs";import i from"node:path";import{BUILT_IN_ENGINE_INSTALLATION_CATALOG as c}from"./installation-catalog.js";import{EngineManager as s}from"./manager.js";export function createEngineManager(t,r={}){return new s({catalog:r.catalog??c,productRoot:a(t)})}function a(t){if(!i.isAbsolute(t))throw new Error("Testkit product directory must be absolute");const r=i.resolve(t);let o;try{o=e.statSync(r)}catch(n){throw new Error(`Testkit product directory does not exist: ${r}`,{cause:n})}if(!o.isDirectory())throw new Error(`Testkit product directory is not a directory: ${r}`);return e.realpathSync.native(r)}
1
+ import o from"node:fs";import i from"node:path";import{EngineManager as s}from"./manager.js";export function createEngineManager(r){return new s(c(r))}function c(r){if(!i.isAbsolute(r))throw new Error("Testkit product directory must be absolute");const t=i.resolve(r);let e;try{e=o.statSync(t)}catch(n){throw new Error(`Testkit product directory does not exist: ${t}`,{cause:n})}if(!e.isDirectory())throw new Error(`Testkit product directory is not a directory: ${t}`);return o.realpathSync.native(t)}
@@ -1 +1 @@
1
- import{NODE_VITEST_PACKAGE_REQUIREMENTS as u}from"./package-requirements.js";export{NODE_VITEST_PACKAGE_REQUIREMENTS,NODE_VITEST_PRIVATE_PACKAGE_PREFIXES}from"./package-requirements.js";import l from"node:fs";import p from"node:path";import{isPathWithin as d}from"../../process/files/paths.js";import{BrokenPackageInstallationError as f,RootPackageResolver as y,importResolvedPackageEntrypoint as g}from"./package-resolution.js";const v=Object.freeze({packageResolver:new y});export function resolveNodeVitestInstallation(t,e=v){t.signal.throwIfAborted();const o=new Map;for(const n of u)o.set(n.packageName,e.packageResolver.resolveImportFromRoot({dependencyGroup:"dependencies",packageName:n.packageName,publicEntrypoint:n.publicEntrypoints[0]}));const r=s(o,"vitest");return Object.freeze({authoringEntrypoints:m(e.packageResolver),engineId:"node-vitest",packages:Object.freeze({esbuild:c(s(o,"esbuild")),typescript:c(s(o,"typescript")),vite:c(s(o,"vite")),vitest:Object.freeze({...c(r),cli:h(r,e.packageResolver)})})})}function m(t){return Object.freeze({config:t.resolveRootPublicEntrypoint("@gfdelarue/testkit/config"),contract:t.resolveRootPublicEntrypoint("@gfdelarue/testkit/node-vitest/contract"),data:t.resolveRootPublicEntrypoint("@gfdelarue/testkit/node-vitest/data"),root:t.resolveRootPublicEntrypoint("@gfdelarue/testkit"),rootPackageJson:t.packageJsonPath})}export async function preflightNodeVitestInstallation(t,e,o=g){for(const r of u){b(e.signal);const i=t.packages[r.packageName];try{const n=await o(i);await k(r.packageName,n)}catch(n){throw b(e.signal),new f(i.name,i.version,`its public ${r.packageName} capability failed; reinstall without omitting optional dependencies`,{cause:T(n)})}}}function s(t,e){const o=t.get(e);if(o===void 0||o.name!==e)throw new TypeError(`Node/Vitest package resolution did not select ${e}`);return o}function c(t){return Object.freeze({entrypoint:t.entrypoint,name:t.name,root:t.root,version:t.version})}function h(t,e){try{const r=w(t.manifestPath).bin,i=typeof r=="object"&&r!==null&&!Array.isArray(r)?r.vitest:r;if(typeof i!="string"||p.isAbsolute(i))throw new TypeError("package bin.vitest must be a relative path");const n=l.realpathSync(p.resolve(t.root,i));if(!d(t.root,n)||!l.statSync(n).isFile())throw new TypeError("package bin.vitest must resolve to a contained regular file");return n}catch(o){throw e.brokenInstallation(t,"its public Vitest CLI is invalid",o)}}function w(t){const e=JSON.parse(l.readFileSync(t,"utf8"));if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("package manifest must contain a JSON object");return e}async function k(t,e){const o=E(e,`${t} public module`);switch(t){case"vitest":a(o,"expect",t),a(o,"test",t);return;case"vite":return;case"typescript":{const r=E(o.ScriptTarget,"typescript ScriptTarget");a(o,"createSourceFile",t)("preflight.ts","export {};",r.Latest);return}case"esbuild":a(o,"stop",t),await a(o,"build",t)({stdin:{contents:"export {};",loader:"js"},write:!1})}}function E(t,e){if(typeof t!="object"||t===null)throw new TypeError(`${e} must be an object`);return t}function a(t,e,o){const r=t[e];if(typeof r!="function")throw new TypeError(`${o} public module must export function ${e}`);return r}function T(t){return t instanceof f&&t.cause!==void 0?t.cause:t}function b(t){if(t.aborted)throw t.reason instanceof Error?t.reason:new Error("Node/Vitest installation check cancelled",{cause:t.reason})}
1
+ import{NODE_VITEST_PACKAGE_REQUIREMENTS as c}from"./package-requirements.js";import{RootPackageResolver as d}from"./package-resolution.js";export function resolveNodeVitestInstallation(e,t=new d){e.signal.throwIfAborted();const o=(n,i)=>t.resolveImportFromRoot({dependencyGroup:"dependencies",packageName:n,publicEntrypoint:i});for(const{packageName:n,publicEntrypoints:i}of c)o(n,i[0]);const{entrypoint:r,root:a,version:s}=o("vitest","vitest");return Object.freeze({authoringEntrypoints:Object.freeze({config:t.resolveRootPublicEntrypoint("@gfdelarue/testkit/config"),contract:t.resolveRootPublicEntrypoint("@gfdelarue/testkit/node-vitest/contract"),data:t.resolveRootPublicEntrypoint("@gfdelarue/testkit/node-vitest/data"),environment:t.resolveRootPublicEntrypoint("@gfdelarue/testkit/environment"),root:t.resolveRootPublicEntrypoint("@gfdelarue/testkit"),rootPackageJson:t.packageJsonPath}),engineId:"node-vitest",vitest:Object.freeze({entrypoint:o("vitest","vitest/node").entrypoint,index:r,name:"vitest",root:a,version:s})})}export function managedVitestAliases({authoringEntrypoints:e,vitest:t}){return{"@gfdelarue/testkit":e.root,"@gfdelarue/testkit/config":e.config,"@gfdelarue/testkit/environment":e.environment,"@gfdelarue/testkit/node-vitest/contract":e.contract,"@gfdelarue/testkit/node-vitest/data":e.data,"@gfdelarue/testkit/package.json":e.rootPackageJson,vitest:t.index}}
@@ -1 +1 @@
1
- import u from"node:fs";import{createRequire as h}from"node:module";import l from"node:path";import{fileURLToPath as $,pathToFileURL as b}from"node:url";import{isPathWithin as m}from"../../process/files/paths.js";export const TESTKIT_PACKAGE_NAME="@gfdelarue/testkit";const S=$(new URL("../../../package.json",import.meta.url)),k=/^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u;export class RootPackageDeclarationError extends Error{code="TESTKIT_ROOT_PACKAGE_DECLARATION_INVALID";constructor(t,e){super(t,e),this.name="RootPackageDeclarationError"}}export class MissingDirectPackageError extends Error{code="TESTKIT_DIRECT_PACKAGE_MISSING";packageName;version;constructor(t,e,n,r,i){super(`Testkit direct dependency ${t}@${e} could not resolve its public entrypoint ${JSON.stringify(n)} from ${TESTKIT_PACKAGE_NAME}. Run a clean npm install from the consumer lockfile${r?" without omitting optional dependencies":""}.`,i),this.name="MissingDirectPackageError",this.packageName=t,this.version=e}}export class BrokenPackageInstallationError extends Error{code="TESTKIT_PACKAGE_INSTALLATION_BROKEN";packageName;version;constructor(t,e,n,r){super(`Testkit dependency ${t}@${e} is installed but broken: ${n}. Run a clean npm install from the consumer lockfile.`,r),this.name="BrokenPackageInstallationError",this.packageName=t,this.version=e}}export class RootPackageResolver{packageJsonPath;packageRoot;manifest;requireFromRoot;resolveRootImport;constructor(t={}){const e=l.resolve(t.packageJsonPath??S);this.packageJsonPath=p(e,`${TESTKIT_PACKAGE_NAME} package manifest`,(n,r)=>new RootPackageDeclarationError(n,d(r))),this.packageRoot=l.dirname(this.packageJsonPath),this.manifest=T(this.packageJsonPath),this.requireFromRoot=h(this.packageJsonPath),this.resolveRootImport=t.resolveImportFromRoot??F}resolveImportFromRoot(t){const e=this.declaredVersion(t);return g({label:TESTKIT_PACKAGE_NAME,manifestRequire:this.requireFromRoot,resolveEntrypoint:n=>D(this.resolveRootImport(n)),rootSelection:!0},t,e)}resolveRequireFromRoot(t){const e=this.declaredVersion(t);return g({label:TESTKIT_PACKAGE_NAME,manifestRequire:this.requireFromRoot,resolveEntrypoint:this.requireFromRoot.resolve,rootSelection:!0},t,e)}resolveRequireFromPackage(t,e){const n=this.declaredVersion(e),r=v(t),i=h(r.manifestPath);return g({label:`${r.name}@${r.version}`,manifestRequire:i,resolveEntrypoint:i.resolve,rootSelection:!1},e,n)}resolveRequirePublicEntrypoint(t,e){const n=v(t);R(n.name,e);let r;try{r=h(n.manifestPath).resolve(e)}catch(i){throw s(n.name,n.version,`public entrypoint ${JSON.stringify(e)} could not be resolved`,i)}return _(r,n.root,n.name,n.version,e)}resolveRootPublicEntrypoint(t){R(TESTKIT_PACKAGE_NAME,t);let e;try{e=this.requireFromRoot.resolve(t)}catch(r){throw new RootPackageDeclarationError(`${TESTKIT_PACKAGE_NAME} public entrypoint ${JSON.stringify(t)} could not be resolved from its package anchor`,{cause:r})}const n=p(e,`${TESTKIT_PACKAGE_NAME} public entrypoint ${JSON.stringify(t)}`,(r,i)=>new RootPackageDeclarationError(r,d(i)));if(!m(this.packageRoot,n))throw new RootPackageDeclarationError(`${TESTKIT_PACKAGE_NAME} public entrypoint ${JSON.stringify(t)} resolves outside its package root`);return n}brokenInstallation(t,e,n){const r=v(t);return s(r.name,r.version,e,n)}declaredVersion(t){R(t.packageName,t.publicEntrypoint);const e=this.manifest[t.dependencyGroup]?.[t.packageName];if(typeof e!="string"||!k.test(e))throw new RootPackageDeclarationError(`${TESTKIT_PACKAGE_NAME} ${t.dependencyGroup}.${t.packageName} must be an exact version; received ${JSON.stringify(e)}`);return e}}export async function importResolvedPackageEntrypoint(o){const t=P(o);try{return await import(b(t.entrypoint).href)}catch(e){throw s(t.name,t.version,`importing its resolved public entrypoint ${JSON.stringify(t.entrypoint)} failed`,e)}}function g(o,t,e){let n;try{n=o.resolveEntrypoint(t.publicEntrypoint)}catch(a){throw o.rootSelection&&I(a,t.packageName,t.publicEntrypoint)?new MissingDirectPackageError(t.packageName,e,t.publicEntrypoint,t.dependencyGroup==="optionalDependencies",{cause:a}):s(t.packageName,e,o.rootSelection?`its public entrypoint ${JSON.stringify(t.publicEntrypoint)} could not be resolved from the root package anchor`:`its public entrypoint ${JSON.stringify(t.publicEntrypoint)} could not be resolved from the selected ${o.label} package chain`,a)}let r;try{r=p(n,`${t.packageName} public entrypoint ${JSON.stringify(t.publicEntrypoint)}`,(a,y)=>s(t.packageName,e,a,y))}catch(a){throw a instanceof BrokenPackageInstallationError?a:s(t.packageName,e,`its public entrypoint ${JSON.stringify(t.publicEntrypoint)} is invalid`,a)}const i=N(o.manifestRequire,r,t.packageName,e),c=l.dirname(i);if(!m(c,r))throw s(t.packageName,e,`public entrypoint ${JSON.stringify(t.publicEntrypoint)} resolves outside its owning package root`);const f=J(i,t.packageName,e);return Object.freeze({entrypoint:r,manifestPath:i,name:f.name,root:c,version:f.version})}function N(o,t,e,n){try{const i=p(o.resolve(`${e}/package.json`),`${e} package manifest`,(f,a)=>s(e,n,f,a)),c=l.dirname(i);if(!m(c,t))throw s(e,n,"the selected public entrypoint resolves outside the exported package manifest root");return i}catch(i){if(i instanceof BrokenPackageInstallationError)throw i;if(!U(i,e))throw s(e,n,"exported package manifest resolution failed",i)}let r=l.dirname(t);for(;r!==l.parse(r).root;){const i=l.join(r,"package.json");if(A(i,e,n)){const c=p(i,`${e} package manifest`,(a,y)=>s(e,n,a,y)),f=w(c,e,n);if(f.name!==e)throw s(e,n,`manifest discovery reached incompatible package boundary ${JSON.stringify(f.name)} before ${JSON.stringify(e)}`);return c}r=l.dirname(r)}throw s(e,n,"no owning package manifest was found for the selected public entrypoint")}function T(o){const t=O(o,`${TESTKIT_PACKAGE_NAME} package manifest`,(e,n)=>new RootPackageDeclarationError(e,d(n)));if(t.name!==TESTKIT_PACKAGE_NAME)throw new RootPackageDeclarationError(`Root package manifest must name ${JSON.stringify(TESTKIT_PACKAGE_NAME)}; received ${JSON.stringify(t.name)}`);if(typeof t.version!="string")throw new RootPackageDeclarationError(`Root package manifest version must be a string; received ${JSON.stringify(t.version)}`);return E(t,"dependencies"),E(t,"optionalDependencies"),t}function J(o,t,e){const n=w(o,t,e);if(n.name!==t||n.version!==e)throw s(t,e,`manifest must be exactly ${t}@${e}; received ${n.name}@${n.version}`);return n}function w(o,t,e){const n=O(o,`${t} package manifest`,(r,i)=>s(t,e,r,i));if(typeof n.name!="string"||typeof n.version!="string")throw s(t,e,`manifest name and version must be strings; received ${String(n.name)}@${String(n.version)}`);return{name:n.name,version:n.version}}function O(o,t,e){let n;try{n=JSON.parse(u.readFileSync(o,"utf8"))}catch(r){throw e(`${t} could not be read as JSON`,r)}if(typeof n!="object"||n===null||Array.isArray(n))throw e(`${t} must contain a JSON object`);return n}function E(o,t){const e=o[t];if(e!==void 0&&(typeof e!="object"||e===null||Array.isArray(e)))throw new RootPackageDeclarationError(`Root package manifest ${t} must be a JSON object`)}function v(o){if(typeof o.name!="string"||typeof o.version!="string"||typeof o.root!="string"||typeof o.manifestPath!="string"||typeof o.entrypoint!="string")throw new TypeError("Resolved package must contain string identity paths");return o}function P(o){if(typeof o.name!="string"||typeof o.version!="string"||typeof o.entrypoint!="string")throw new TypeError("Resolved package entrypoint must contain string identity fields");return o}function R(o,t){if(o.length===0||t!==o&&!t.startsWith(`${o}/`))throw new RootPackageDeclarationError(`Public entrypoint ${JSON.stringify(t)} must belong to package ${JSON.stringify(o)}`)}function _(o,t,e,n,r){const i=p(o,`${e} public entrypoint ${JSON.stringify(r)}`,(c,f)=>s(e,n,c,f));if(!m(t,i))throw s(e,n,`public entrypoint ${JSON.stringify(r)} resolves outside its owning package root`);return i}function p(o,t,e){let n,r;try{n=u.realpathSync(o),r=u.statSync(n)}catch(i){throw e(`${t} could not be resolved as a real file`,i)}if(!r.isFile())throw e(`${t} must be a regular file`);return n}function A(o,t,e){try{return u.lstatSync(o),!0}catch(n){if(M(n))return!1;throw s(t,e,"owning package manifest discovery failed",n)}}function I(o,t,e){if(typeof o!="object"||o===null)return!1;const n=o;return(n.code==="MODULE_NOT_FOUND"||n.code==="ERR_MODULE_NOT_FOUND")&&typeof n.message=="string"&&(n.message.startsWith(`Cannot find module '${e}'`)||n.message.startsWith(`Cannot find package '${t}'`))}function D(o){let t;try{t=new URL(o)}catch(e){throw new TypeError(`Root import resolution must return an absolute URL; received ${JSON.stringify(o)}`,{cause:e})}if(t.protocol!=="file:")throw new TypeError(`Root package entrypoint must resolve to a file URL; received ${JSON.stringify(o)}`);return $(t)}function F(o){return import.meta.resolve(o)}function M(o){if(typeof o!="object"||o===null)return!1;const t=o.code;return t==="ENOENT"||t==="ENOTDIR"}function U(o,t){if(typeof o!="object"||o===null)return!1;const e=o;return e.code==="ERR_PACKAGE_PATH_NOT_EXPORTED"?!0:(e.code==="MODULE_NOT_FOUND"||e.code==="ERR_MODULE_NOT_FOUND")&&typeof e.message=="string"&&(e.message.startsWith(`Cannot find module '${t}/package.json'`)||e.message.startsWith(`Cannot find package '${t}'`))}function s(o,t,e,n){return new BrokenPackageInstallationError(o,t,e,d(n))}function d(o){return o===void 0?void 0:{cause:o}}
1
+ import d from"node:fs";import{createRequire as g}from"node:module";import l from"node:path";import{fileURLToPath as $,pathToFileURL as b}from"node:url";import{isPathWithin as u}from"../../process/files/paths.js";export const TESTKIT_PACKAGE_NAME="@gfdelarue/testkit";const k=$(new URL("../../../package.json",import.meta.url)),S=/^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u;export class RootPackageDeclarationError extends Error{code="TESTKIT_ROOT_PACKAGE_DECLARATION_INVALID";constructor(t,e){super(t,e),this.name="RootPackageDeclarationError"}}export class MissingDirectPackageError extends Error{code="TESTKIT_DIRECT_PACKAGE_MISSING";packageName;version;constructor(t,e,n,r,i){super(`Testkit direct dependency ${t}@${e} could not resolve its public entrypoint ${JSON.stringify(n)} from ${TESTKIT_PACKAGE_NAME}. Run a clean npm install from the consumer lockfile${r?" without omitting optional dependencies":""}.`,i),this.name="MissingDirectPackageError",this.packageName=t,this.version=e}}export class BrokenPackageInstallationError extends Error{code="TESTKIT_PACKAGE_INSTALLATION_BROKEN";packageName;version;constructor(t,e,n,r){super(`Testkit dependency ${t}@${e} is installed but broken: ${n}. Run a clean npm install from the consumer lockfile.`,r),this.name="BrokenPackageInstallationError",this.packageName=t,this.version=e}}export class RootPackageResolver{packageJsonPath;packageRoot;manifest;requireFromRoot;resolveRootImport;constructor(t={}){const e=l.resolve(t.packageJsonPath??k);this.packageJsonPath=p(e,`${TESTKIT_PACKAGE_NAME} package manifest`,(n,r)=>new RootPackageDeclarationError(n,m(r))),this.packageRoot=l.dirname(this.packageJsonPath),this.manifest=T(this.packageJsonPath),this.requireFromRoot=g(this.packageJsonPath),this.resolveRootImport=t.resolveImportFromRoot??D}resolveImportFromRoot(t){const e=this.declaredVersion(t);return h({label:TESTKIT_PACKAGE_NAME,manifestRequire:this.requireFromRoot,resolveEntrypoint:n=>F(this.resolveRootImport(n)),rootSelection:!0},t,e)}resolveRequireFromRoot(t){const e=this.declaredVersion(t);return h({label:TESTKIT_PACKAGE_NAME,manifestRequire:this.requireFromRoot,resolveEntrypoint:this.requireFromRoot.resolve,rootSelection:!0},t,e)}resolveRequireFromPackage(t,e){const n=this.declaredVersion(e),r=v(t),i=g(r.manifestPath);return h({label:`${r.name}@${r.version}`,manifestRequire:i,resolveEntrypoint:i.resolve,rootSelection:!1},e,n)}resolveRequirePublicEntrypoint(t,e){const n=v(t);R(n.name,e);let r;try{r=g(n.manifestPath).resolve(e)}catch(i){throw s(n.name,n.version,`public entrypoint ${JSON.stringify(e)} could not be resolved`,i)}return _(r,n.root,n.name,n.version,e)}resolveRootPublicEntrypoint(t){R(TESTKIT_PACKAGE_NAME,t);let e;try{e=this.requireFromRoot.resolve(t)}catch(r){throw new RootPackageDeclarationError(`${TESTKIT_PACKAGE_NAME} public entrypoint ${JSON.stringify(t)} could not be resolved from its package anchor`,{cause:r})}const n=p(e,`${TESTKIT_PACKAGE_NAME} public entrypoint ${JSON.stringify(t)}`,(r,i)=>new RootPackageDeclarationError(r,m(i)));if(!u(this.packageRoot,n))throw new RootPackageDeclarationError(`${TESTKIT_PACKAGE_NAME} public entrypoint ${JSON.stringify(t)} resolves outside its package root`);return n}resolveRootPackageFile(t){const e=`${TESTKIT_PACKAGE_NAME} package file ${JSON.stringify(t)}`,n=p(l.resolve(this.packageRoot,t),e,(r,i)=>new RootPackageDeclarationError(r,m(i)));if(!u(this.packageRoot,n))throw new RootPackageDeclarationError(`${e} resolves outside its package root`);return n}brokenInstallation(t,e,n){const r=v(t);return s(r.name,r.version,e,n)}declaredVersion(t){R(t.packageName,t.publicEntrypoint);const e=this.manifest[t.dependencyGroup]?.[t.packageName];if(typeof e!="string"||!S.test(e))throw new RootPackageDeclarationError(`${TESTKIT_PACKAGE_NAME} ${t.dependencyGroup}.${t.packageName} must be an exact version; received ${JSON.stringify(e)}`);return e}}export async function importResolvedPackageEntrypoint(o){const t=P(o);try{return await import(b(t.entrypoint).href)}catch(e){throw s(t.name,t.version,`importing its resolved public entrypoint ${JSON.stringify(t.entrypoint)} failed`,e)}}function h(o,t,e){let n;try{n=o.resolveEntrypoint(t.publicEntrypoint)}catch(a){throw o.rootSelection&&I(a,t.packageName,t.publicEntrypoint)?new MissingDirectPackageError(t.packageName,e,t.publicEntrypoint,t.dependencyGroup==="optionalDependencies",{cause:a}):s(t.packageName,e,o.rootSelection?`its public entrypoint ${JSON.stringify(t.publicEntrypoint)} could not be resolved from the root package anchor`:`its public entrypoint ${JSON.stringify(t.publicEntrypoint)} could not be resolved from the selected ${o.label} package chain`,a)}let r;try{r=p(n,`${t.packageName} public entrypoint ${JSON.stringify(t.publicEntrypoint)}`,(a,y)=>s(t.packageName,e,a,y))}catch(a){throw a instanceof BrokenPackageInstallationError?a:s(t.packageName,e,`its public entrypoint ${JSON.stringify(t.publicEntrypoint)} is invalid`,a)}const i=N(o.manifestRequire,r,t.packageName,e),c=l.dirname(i);if(!u(c,r))throw s(t.packageName,e,`public entrypoint ${JSON.stringify(t.publicEntrypoint)} resolves outside its owning package root`);const f=J(i,t.packageName,e);return Object.freeze({entrypoint:r,manifestPath:i,name:f.name,root:c,version:f.version})}function N(o,t,e,n){try{const i=p(o.resolve(`${e}/package.json`),`${e} package manifest`,(f,a)=>s(e,n,f,a)),c=l.dirname(i);if(!u(c,t))throw s(e,n,"the selected public entrypoint resolves outside the exported package manifest root");return i}catch(i){if(i instanceof BrokenPackageInstallationError)throw i;if(!U(i,e))throw s(e,n,"exported package manifest resolution failed",i)}let r=l.dirname(t);for(;r!==l.parse(r).root;){const i=l.join(r,"package.json");if(A(i,e,n)){const c=p(i,`${e} package manifest`,(a,y)=>s(e,n,a,y)),f=w(c,e,n);if(f.name!==e)throw s(e,n,`manifest discovery reached incompatible package boundary ${JSON.stringify(f.name)} before ${JSON.stringify(e)}`);return c}r=l.dirname(r)}throw s(e,n,"no owning package manifest was found for the selected public entrypoint")}function T(o){const t=O(o,`${TESTKIT_PACKAGE_NAME} package manifest`,(e,n)=>new RootPackageDeclarationError(e,m(n)));if(t.name!==TESTKIT_PACKAGE_NAME)throw new RootPackageDeclarationError(`Root package manifest must name ${JSON.stringify(TESTKIT_PACKAGE_NAME)}; received ${JSON.stringify(t.name)}`);if(typeof t.version!="string")throw new RootPackageDeclarationError(`Root package manifest version must be a string; received ${JSON.stringify(t.version)}`);return E(t,"dependencies"),E(t,"optionalDependencies"),t}function J(o,t,e){const n=w(o,t,e);if(n.name!==t||n.version!==e)throw s(t,e,`manifest must be exactly ${t}@${e}; received ${n.name}@${n.version}`);return n}function w(o,t,e){const n=O(o,`${t} package manifest`,(r,i)=>s(t,e,r,i));if(typeof n.name!="string"||typeof n.version!="string")throw s(t,e,`manifest name and version must be strings; received ${String(n.name)}@${String(n.version)}`);return{name:n.name,version:n.version}}function O(o,t,e){let n;try{n=JSON.parse(d.readFileSync(o,"utf8"))}catch(r){throw e(`${t} could not be read as JSON`,r)}if(typeof n!="object"||n===null||Array.isArray(n))throw e(`${t} must contain a JSON object`);return n}function E(o,t){const e=o[t];if(e!==void 0&&(typeof e!="object"||e===null||Array.isArray(e)))throw new RootPackageDeclarationError(`Root package manifest ${t} must be a JSON object`)}function v(o){if(typeof o.name!="string"||typeof o.version!="string"||typeof o.root!="string"||typeof o.manifestPath!="string"||typeof o.entrypoint!="string")throw new TypeError("Resolved package must contain string identity paths");return o}function P(o){if(typeof o.name!="string"||typeof o.version!="string"||typeof o.entrypoint!="string")throw new TypeError("Resolved package entrypoint must contain string identity fields");return o}function R(o,t){if(o.length===0||t!==o&&!t.startsWith(`${o}/`))throw new RootPackageDeclarationError(`Public entrypoint ${JSON.stringify(t)} must belong to package ${JSON.stringify(o)}`)}function _(o,t,e,n,r){const i=p(o,`${e} public entrypoint ${JSON.stringify(r)}`,(c,f)=>s(e,n,c,f));if(!u(t,i))throw s(e,n,`public entrypoint ${JSON.stringify(r)} resolves outside its owning package root`);return i}function p(o,t,e){let n,r;try{n=d.realpathSync(o),r=d.statSync(n)}catch(i){throw e(`${t} could not be resolved as a real file`,i)}if(!r.isFile())throw e(`${t} must be a regular file`);return n}function A(o,t,e){try{return d.lstatSync(o),!0}catch(n){if(M(n))return!1;throw s(t,e,"owning package manifest discovery failed",n)}}function I(o,t,e){if(typeof o!="object"||o===null)return!1;const n=o;return(n.code==="MODULE_NOT_FOUND"||n.code==="ERR_MODULE_NOT_FOUND")&&typeof n.message=="string"&&(n.message.startsWith(`Cannot find module '${e}'`)||n.message.startsWith(`Cannot find package '${t}'`))}function F(o){let t;try{t=new URL(o)}catch(e){throw new TypeError(`Root import resolution must return an absolute URL; received ${JSON.stringify(o)}`,{cause:e})}if(t.protocol!=="file:")throw new TypeError(`Root package entrypoint must resolve to a file URL; received ${JSON.stringify(o)}`);return $(t)}function D(o){return import.meta.resolve(o)}function M(o){if(typeof o!="object"||o===null)return!1;const t=o.code;return t==="ENOENT"||t==="ENOTDIR"}function U(o,t){if(typeof o!="object"||o===null)return!1;const e=o;return e.code==="ERR_PACKAGE_PATH_NOT_EXPORTED"?!0:(e.code==="MODULE_NOT_FOUND"||e.code==="ERR_MODULE_NOT_FOUND")&&typeof e.message=="string"&&(e.message.startsWith(`Cannot find module '${t}/package.json'`)||e.message.startsWith(`Cannot find package '${t}'`))}function s(o,t,e,n){return new BrokenPackageInstallationError(o,t,e,m(n))}function m(o){return o===void 0?void 0:{cause:o}}
@@ -1,2 +1,2 @@
1
- import{pathToFileURL as y}from"node:url";p();async function p(){try{const t=f(process.argv[2]);l(t.registry.canonicalValue);const e=await import(y(t.family.playwrightTest.entrypoint).href),r=m(e),n=h(r.chromium,"chromium"),s=n.executablePath;if(typeof s!="function")throw new TypeError("Authoritative @playwright/test module must expose chromium.executablePath()");const c=Reflect.apply(s,n,[]);if(typeof c!="string")throw new TypeError("chromium.executablePath() must return a string");u({browserExecutable:c,family:t.family,ok:!0,registry:t.registry})}catch(t){const e=d(t);u({error:{...e.code===void 0?{}:{code:e.code},message:e.message,name:e.name},ok:!1}),process.exitCode=1}}function f(t){if(t===void 0)throw new TypeError("Playwright resolution child requires one input");let e;try{e=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))}catch(r){throw new TypeError("Playwright resolution child input is invalid",{cause:r})}if(!o(e)||!g(e.family)||!o(e.registry)||typeof e.registry.canonicalValue!="string"||typeof e.registry.mode!="string")throw new TypeError("Playwright resolution child input is invalid");return e}function l(t){if(process.env.PLAYWRIGHT_BROWSERS_PATH!==t)throw new Error("Playwright resolution child did not receive the canonical browser registry")}function m(t){const e=a(t,"@playwright/test module namespace"),r=e.default??e["module.exports"]??e;return a(r,"@playwright/test public module")}function g(t){return o(t)&&typeof t.cli=="string"&&i(t.playwrightTest,"@playwright/test")&&i(t.playwright,"playwright")&&i(t.playwrightCore,"playwright-core")}function i(t,e){return o(t)&&t.name===e&&typeof t.version=="string"&&typeof t.root=="string"&&typeof t.entrypoint=="string"}function h(t,e){if(!o(t))throw new TypeError(`${e} must be an object`);return t}function a(t,e){if((typeof t!="object"||t===null)&&typeof t!="function")throw new TypeError(`${e} must be an object or function`);return t}function o(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function d(t){if(!(t instanceof Error))return{message:String(t),name:"Error"};const e=Reflect.get(t,"code");return{...typeof e=="string"?{code:e}:{},message:t.message,name:t.name}}function u(t){process.stdout.write(`${JSON.stringify(t)}
1
+ import{pathToFileURL as p}from"node:url";import{isUnknownRecord as o}from"../../kernel/unknown-values.js";y();async function y(){try{const e=f(process.argv[2]);l(e.registry.canonicalValue);const t=await import(p(e.family.playwrightTest.entrypoint).href),r=m(t),n=h(r.chromium,"chromium"),s=n.executablePath;if(typeof s!="function")throw new TypeError("Authoritative @playwright/test module must expose chromium.executablePath()");const c=Reflect.apply(s,n,[]);if(typeof c!="string")throw new TypeError("chromium.executablePath() must return a string");u({browserExecutable:c,family:e.family,ok:!0,registry:e.registry})}catch(e){const t=d(e);u({error:{...t.code===void 0?{}:{code:t.code},message:t.message,name:t.name},ok:!1}),process.exitCode=1}}function f(e){if(e===void 0)throw new TypeError("Playwright resolution child requires one input");let t;try{t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch(r){throw new TypeError("Playwright resolution child input is invalid",{cause:r})}if(!o(t)||!g(t.family)||!o(t.registry)||typeof t.registry.canonicalValue!="string"||typeof t.registry.mode!="string")throw new TypeError("Playwright resolution child input is invalid");return t}function l(e){if(process.env.PLAYWRIGHT_BROWSERS_PATH!==e)throw new Error("Playwright resolution child did not receive the canonical browser registry")}function m(e){const t=a(e,"@playwright/test module namespace"),r=t.default??t["module.exports"]??t;return a(r,"@playwright/test public module")}function g(e){return o(e)&&typeof e.cli=="string"&&i(e.playwrightTest,"@playwright/test")&&i(e.playwright,"playwright")&&i(e.playwrightCore,"playwright-core")}function i(e,t){return o(e)&&e.name===t&&typeof e.version=="string"&&typeof e.root=="string"&&typeof e.entrypoint=="string"}function h(e,t){if(!o(e))throw new TypeError(`${t} must be an object`);return e}function a(e,t){if((typeof e!="object"||e===null)&&typeof e!="function")throw new TypeError(`${t} must be an object or function`);return e}function d(e){if(!(e instanceof Error))return{message:String(e),name:"Error"};const t=Reflect.get(e,"code");return{...typeof t=="string"?{code:t}:{},message:e.message,name:e.name}}function u(e){process.stdout.write(`${JSON.stringify(e)}
2
2
  `)}
@@ -1 +1 @@
1
- import{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS as R}from"./package-requirements.js";export{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS}from"./package-requirements.js";import c from"node:fs";import w from"node:os";import f from"node:path";import{fileURLToPath as h}from"node:url";import{runManagedProcess as x}from"../../process/index.js";import{currentLinuxLibc as T,currentPlatformTarget as _,platformTargetKey as d,SUPPORTED_PLATFORM_TARGETS as I}from"../../process/host/platform.js";import{RootPackageResolver as m}from"./package-resolution.js";const A=64*1024,O=6e4,b="PLAYWRIGHT_BROWSERS_PATH",S=new Set(["npm_config_playwright_browsers_path","npm_package_config_playwright_browsers_path"]);export class PlaywrightInstallationError extends Error{code="TESTKIT_PLAYWRIGHT_INSTALLATION_INVALID";constructor(r,t){super(`Playwright installation is invalid: ${r}. Run testkit setup playwright --force.`,t),this.name="PlaywrightInstallationError"}}export class UnsupportedPlaywrightPlatformError extends Error{code="TESTKIT_PLAYWRIGHT_PLATFORM_UNSUPPORTED";constructor(r,t){super(`Playwright does not support ${d(r)}${r.platform==="linux"?` with ${t??"unknown"} libc`:""}`),this.name="UnsupportedPlaywrightPlatformError"}}export function resolvePlaywrightPackageFamily(e=new m){const[r,t,o]=R,i=e.resolveRequireFromRoot(u(r)),n=e.resolveImportFromRoot(u(r));L(e,i,n);const a=e.resolveRequireFromPackage(i,u(t)),s=e.resolveRequireFromPackage(a,u(o)),P=e.resolveRequirePublicEntrypoint(i,r.publicEntrypoints[1]);return Object.freeze({cli:P,playwright:p(a,"playwright"),playwrightCore:p(s,"playwright-core"),playwrightTest:p(n,"@playwright/test")})}function L(e,r,t){if(!(r.name===t.name&&r.version===t.version&&r.root===t.root))throw e.brokenInstallation(r,"the import and require public entrypoints select different physical package roots",void 0)}export function resolvePlaywrightRegistry(e){const r=e.platform==="win32"?f.win32:f.posix;if(!r.isAbsolute(e.productRoot))throw new TypeError("Playwright product root must be absolute");const t=e.configuredValue;if(t==="0")return Object.freeze({canonicalValue:"0",mode:"hermetic"});if(t!==void 0&&t.length>0){const o=r.isAbsolute(t);return Object.freeze({canonicalValue:o?r.normalize(t):r.resolve(e.productRoot,t),mode:o?"configured-absolute":"configured-relative"})}return Object.freeze({canonicalValue:r.resolve(e.productRoot,r.join(C(e.platform,e.ambientEnvironment,e.homeDirectory??w.homedir(),r),"ms-playwright")),mode:"default"})}export function playwrightRegistryEnvironment(e,r){const t={};for(const[o,i]of Object.entries(e))typeof i=="string"&&!S.has(o.toLowerCase())&&o.toUpperCase()!==b&&(t[o]=i);return t[b]=r.canonicalValue,Object.freeze(t)}export async function resolvePlaywrightInstallation(e,r={}){e.signal.throwIfAborted();const t={linuxLibc:T(),target:_()};requireSupportedPlaywrightHost(t);const o=new m,i=r.ambientEnvironment??process.env,n=resolvePlaywrightPackageFamily(o),a=resolvePlaywrightRegistry({ambientEnvironment:i,configuredValue:r.configuredRegistry??i.PLAYWRIGHT_BROWSERS_PATH,homeDirectory:w.homedir(),platform:t.target.platform,productRoot:e.productRoot}),s=await k(e,{family:n,registry:a},i);return Object.freeze({authoringEntrypoints:Object.freeze({authoring:o.resolveRootPublicEntrypoint("@gfdelarue/testkit/playwright"),root:o.resolveRootPublicEntrypoint("@gfdelarue/testkit"),rootPackageJson:o.resolveRootPublicEntrypoint("@gfdelarue/testkit/package.json")}),browserExecutable:requireBrowserExecutable(s.browserExecutable,t.target),engineId:"playwright",family:n,registry:a})}async function k(e,r,t){const o=Buffer.from(JSON.stringify(r),"utf8").toString("base64url"),i=await x({args:[N(),o],cwd:e.productRoot,displayLabel:"Playwright installation resolver",env:playwrightRegistryEnvironment(t,r.registry),executable:process.execPath,signal:e.signal,timeoutMs:O}),n=j(i);throwIfPlaywrightProcessAborted(e.signal,i,n),requireBoundedPlaywrightChildOutput(i.stdout);let a;try{a=parsePlaywrightChildOutput(i.stdout)}catch(s){throw n!==null?new PlaywrightInstallationError(`isolated resolver failed: ${n.message}`,{cause:n}):s}if(n!==null)throw new PlaywrightInstallationError(`isolated resolver failed: ${n.message}`,{cause:n});if(!a.ok){if(i.exitCode!==1||i.exitSignal!==null){const s=E(i);throw new PlaywrightInstallationError(`isolated resolver failed: ${s.message}`,{cause:s})}throw new PlaywrightInstallationError(`isolated resolver failed: ${a.error.message}`,{cause:M(a.error)})}if(i.exitCode!==0||i.exitSignal!==null){const s=E(i);throw new PlaywrightInstallationError(`isolated resolver failed: ${s.message}`,{cause:s})}return requireMatchingPlaywrightChildRequest(a,r),a}export function throwIfPlaywrightProcessAborted(e,r,t){if(e.aborted){if(!v(r)||t===null){e.throwIfAborted();return}throw t===e.reason?t:new AggregateError([e.reason,t],"Playwright process was cancelled and process cleanup also failed",{cause:e.reason})}}function v(e){return e.terminationError!==null||e.error!==null||e.timedOut||e.outputLimitExceeded}export function requireBoundedPlaywrightChildOutput(e){if(Buffer.byteLength(e,"utf8")>A)throw new PlaywrightInstallationError("isolated resolver returned oversized output")}export function parsePlaywrightChildOutput(e){let r;try{r=JSON.parse(e)}catch(t){throw new PlaywrightInstallationError("isolated resolver did not return bounded JSON",{cause:t})}if(!l(r)||typeof r.ok!="boolean")throw new PlaywrightInstallationError("isolated resolver returned an invalid response");if(!r.ok){if(!l(r.error)||typeof r.error.name!="string"||typeof r.error.message!="string"||r.error.code!==void 0&&typeof r.error.code!="string")throw new PlaywrightInstallationError("isolated resolver returned an invalid error");return{error:{...r.error.code===void 0?{}:{code:r.error.code},message:r.error.message,name:r.error.name},ok:!1}}if(typeof r.browserExecutable!="string"||!$(r.family)||!H(r.registry))throw new PlaywrightInstallationError("isolated resolver returned an invalid installation");return{browserExecutable:r.browserExecutable,family:r.family,ok:!0,registry:r.registry}}export function requireMatchingPlaywrightChildRequest(e,r){if(JSON.stringify(e.family)!==JSON.stringify(r.family))throw new PlaywrightInstallationError("isolated resolver selected a different physical package family");if(e.registry.canonicalValue!==r.registry.canonicalValue||e.registry.mode!==r.registry.mode)throw new PlaywrightInstallationError("isolated resolver selected a different browser registry")}export function requireBrowserExecutable(e,r){if(!f.isAbsolute(e))throw new PlaywrightInstallationError(`public chromium.executablePath() returned a non-absolute path ${JSON.stringify(e)}`);let t;try{t=c.statSync(e)}catch(o){throw new PlaywrightInstallationError(`public chromium.executablePath() returned missing path ${JSON.stringify(e)}`,{cause:o})}if(!t.isFile())throw new PlaywrightInstallationError(`public chromium.executablePath() must identify a regular file; received ${JSON.stringify(e)}`);if(r.platform!=="win32")try{c.accessSync(e,c.constants.X_OK)}catch(o){throw new PlaywrightInstallationError(`public chromium.executablePath() is not executable: ${JSON.stringify(e)}`,{cause:o})}return e}export function requireSupportedPlaywrightHost(e){const r=d(e.target);if(!I.some(t=>d(t)===r)||e.target.platform==="linux"&&e.linuxLibc!=="glibc")throw new UnsupportedPlaywrightPlatformError(e.target,e.linuxLibc)}function C(e,r,t,o){return e==="linux"?r.XDG_CACHE_HOME||o.join(g(t),".cache"):e==="darwin"?o.join(g(t),"Library","Caches"):r.LOCALAPPDATA||o.join(g(t),"AppData","Local")}function g(e){if(e.length===0)throw new TypeError("Playwright default registry requires a home directory");return e}function u(e){return{dependencyGroup:"dependencies",packageName:e.packageName,publicEntrypoint:e.publicEntrypoints[0]}}function p(e,r){if(e.name!==r)throw new TypeError(`Playwright package family expected ${r}, received ${e.name}`);return Object.freeze({entrypoint:e.entrypoint,name:r,root:e.root,version:e.version})}function N(){const e=h(new URL("./playwright-resolution-child.js",import.meta.url));return c.existsSync(e)?e:h(new URL("../../../dist/engines/installations/playwright-resolution-child.js",import.meta.url))}function j(e){return e.terminationError!==null?e.terminationError:e.error!==null?e.error:e.timedOut?new Error("isolated resolver timed out"):e.cancelled?new Error("isolated resolver was cancelled"):e.outputLimitExceeded?new Error("isolated resolver output exceeded the bound"):null}function E(e){return new Error(`isolated resolver exited with ${e.exitCode===null?String(e.exitSignal):e.exitCode.toString()}`)}function M(e){const r=new Error(e.message);return r.name=e.name,e.code!==void 0&&Object.defineProperty(r,"code",{enumerable:!0,value:e.code}),r}function $(e){return l(e)&&typeof e.cli=="string"&&y(e.playwrightTest,"@playwright/test")&&y(e.playwright,"playwright")&&y(e.playwrightCore,"playwright-core")}function y(e,r){return l(e)&&e.name===r&&typeof e.version=="string"&&typeof e.root=="string"&&typeof e.entrypoint=="string"}function H(e){return l(e)&&typeof e.canonicalValue=="string"&&(e.mode==="configured-absolute"||e.mode==="configured-relative"||e.mode==="default"||e.mode==="hermetic")}function l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}
1
+ import{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS as R}from"./package-requirements.js";export{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS}from"./package-requirements.js";import c from"node:fs";import y from"node:os";import f from"node:path";import{fileURLToPath as m}from"node:url";import{runManagedProcess as x}from"../../process/index.js";import{currentLinuxLibc as T,currentPlatformTarget as _,platformTargetKey as d,SUPPORTED_PLATFORM_TARGETS as I}from"../../process/host/platform.js";import{RootPackageResolver as h}from"./package-resolution.js";import{isUnknownRecord as l}from"../../kernel/unknown-values.js";const O=64*1024,S=6e4,b="PLAYWRIGHT_BROWSERS_PATH",A=new Set(["npm_config_playwright_browsers_path","npm_package_config_playwright_browsers_path"]);export class PlaywrightInstallationError extends Error{code="TESTKIT_PLAYWRIGHT_INSTALLATION_INVALID";constructor(r,t){super(`Playwright installation is invalid: ${r}. Run testkit setup playwright --force.`,t),this.name="PlaywrightInstallationError"}}export class UnsupportedPlaywrightPlatformError extends Error{code="TESTKIT_PLAYWRIGHT_PLATFORM_UNSUPPORTED";constructor(r,t){super(`Playwright does not support ${d(r)}${r.platform==="linux"?` with ${t??"unknown"} libc`:""}`),this.name="UnsupportedPlaywrightPlatformError"}}export function resolvePlaywrightPackageFamily(e=new h){const[r,t,o]=R,i=e.resolveRequireFromRoot(u(r)),n=e.resolveImportFromRoot(u(r));L(e,i,n);const a=e.resolveRequireFromPackage(i,u(t)),s=e.resolveRequireFromPackage(a,u(o)),P=e.resolveRequirePublicEntrypoint(i,r.publicEntrypoints[1]);return Object.freeze({cli:P,playwright:p(a,"playwright"),playwrightCore:p(s,"playwright-core"),playwrightTest:p(n,"@playwright/test")})}function L(e,r,t){if(!(r.name===t.name&&r.version===t.version&&r.root===t.root))throw e.brokenInstallation(r,"the import and require public entrypoints select different physical package roots",void 0)}export function resolvePlaywrightRegistry(e){const r=e.platform==="win32"?f.win32:f.posix;if(!r.isAbsolute(e.productRoot))throw new TypeError("Playwright product root must be absolute");const t=e.configuredValue;if(t==="0")return Object.freeze({canonicalValue:"0",mode:"hermetic"});if(t!==void 0&&t.length>0){const o=r.isAbsolute(t);return Object.freeze({canonicalValue:o?r.normalize(t):r.resolve(e.productRoot,t),mode:o?"configured-absolute":"configured-relative"})}return Object.freeze({canonicalValue:r.resolve(e.productRoot,r.join(C(e.platform,e.ambientEnvironment,e.homeDirectory??y.homedir(),r),"ms-playwright")),mode:"default"})}export function playwrightRegistryEnvironment(e,r){const t={};for(const[o,i]of Object.entries(e))typeof i=="string"&&!A.has(o.toLowerCase())&&o.toUpperCase()!==b&&(t[o]=i);return t[b]=r.canonicalValue,Object.freeze(t)}export async function resolvePlaywrightInstallation(e,r={}){e.signal.throwIfAborted();const t={linuxLibc:T(),target:_()};requireSupportedPlaywrightHost(t);const o=new h,i=r.ambientEnvironment??process.env,n=resolvePlaywrightPackageFamily(o),a=resolvePlaywrightRegistry({ambientEnvironment:i,configuredValue:r.configuredRegistry??i.PLAYWRIGHT_BROWSERS_PATH,homeDirectory:y.homedir(),platform:t.target.platform,productRoot:e.productRoot}),s=await v(e,{family:n,registry:a},i);return Object.freeze({authoringEntrypoints:Object.freeze({authoring:o.resolveRootPublicEntrypoint("@gfdelarue/testkit/playwright"),environment:o.resolveRootPublicEntrypoint("@gfdelarue/testkit/environment"),root:o.resolveRootPublicEntrypoint("@gfdelarue/testkit"),rootPackageJson:o.resolveRootPublicEntrypoint("@gfdelarue/testkit/package.json")}),browserExecutable:requireBrowserExecutable(s.browserExecutable,t.target),engineId:"playwright",family:n,registry:a})}async function v(e,r,t){const o=Buffer.from(JSON.stringify(r),"utf8").toString("base64url"),i=await x({args:[N(),o],cwd:e.productRoot,displayLabel:"Playwright installation resolver",env:playwrightRegistryEnvironment(t,r.registry),executable:process.execPath,signal:e.signal,timeoutMs:S}),n=j(i);throwIfPlaywrightProcessAborted(e.signal,i,n),requireBoundedPlaywrightChildOutput(i.stdout);let a;try{a=parsePlaywrightChildOutput(i.stdout)}catch(s){throw n!==null?new PlaywrightInstallationError(`isolated resolver failed: ${n.message}`,{cause:n}):s}if(n!==null)throw new PlaywrightInstallationError(`isolated resolver failed: ${n.message}`,{cause:n});if(!a.ok){if(i.exitCode!==1||i.exitSignal!==null){const s=E(i);throw new PlaywrightInstallationError(`isolated resolver failed: ${s.message}`,{cause:s})}throw new PlaywrightInstallationError(`isolated resolver failed: ${a.error.message}`,{cause:M(a.error)})}if(i.exitCode!==0||i.exitSignal!==null){const s=E(i);throw new PlaywrightInstallationError(`isolated resolver failed: ${s.message}`,{cause:s})}return requireMatchingPlaywrightChildRequest(a,r),a}export function throwIfPlaywrightProcessAborted(e,r,t){if(e.aborted){if(!k(r)||t===null){e.throwIfAborted();return}throw t===e.reason?t:new AggregateError([e.reason,t],"Playwright process was cancelled and process cleanup also failed",{cause:e.reason})}}function k(e){return e.terminationError!==null||e.error!==null||e.timedOut||e.outputLimitExceeded}export function requireBoundedPlaywrightChildOutput(e){if(Buffer.byteLength(e,"utf8")>O)throw new PlaywrightInstallationError("isolated resolver returned oversized output")}export function parsePlaywrightChildOutput(e){let r;try{r=JSON.parse(e)}catch(t){throw new PlaywrightInstallationError("isolated resolver did not return bounded JSON",{cause:t})}if(!l(r)||typeof r.ok!="boolean")throw new PlaywrightInstallationError("isolated resolver returned an invalid response");if(!r.ok){if(!l(r.error)||typeof r.error.name!="string"||typeof r.error.message!="string"||r.error.code!==void 0&&typeof r.error.code!="string")throw new PlaywrightInstallationError("isolated resolver returned an invalid error");return{error:{...r.error.code===void 0?{}:{code:r.error.code},message:r.error.message,name:r.error.name},ok:!1}}if(typeof r.browserExecutable!="string"||!$(r.family)||!U(r.registry))throw new PlaywrightInstallationError("isolated resolver returned an invalid installation");return{browserExecutable:r.browserExecutable,family:r.family,ok:!0,registry:r.registry}}export function requireMatchingPlaywrightChildRequest(e,r){if(JSON.stringify(e.family)!==JSON.stringify(r.family))throw new PlaywrightInstallationError("isolated resolver selected a different physical package family");if(e.registry.canonicalValue!==r.registry.canonicalValue||e.registry.mode!==r.registry.mode)throw new PlaywrightInstallationError("isolated resolver selected a different browser registry")}export function requireBrowserExecutable(e,r){if(!f.isAbsolute(e))throw new PlaywrightInstallationError(`public chromium.executablePath() returned a non-absolute path ${JSON.stringify(e)}`);let t;try{t=c.statSync(e)}catch(o){throw new PlaywrightInstallationError(`public chromium.executablePath() returned missing path ${JSON.stringify(e)}`,{cause:o})}if(!t.isFile())throw new PlaywrightInstallationError(`public chromium.executablePath() must identify a regular file; received ${JSON.stringify(e)}`);if(r.platform!=="win32")try{c.accessSync(e,c.constants.X_OK)}catch(o){throw new PlaywrightInstallationError(`public chromium.executablePath() is not executable: ${JSON.stringify(e)}`,{cause:o})}return e}export function requireSupportedPlaywrightHost(e){const r=d(e.target);if(!I.some(t=>d(t)===r)||e.target.platform==="linux"&&e.linuxLibc!=="glibc")throw new UnsupportedPlaywrightPlatformError(e.target,e.linuxLibc)}function C(e,r,t,o){return e==="linux"?r.XDG_CACHE_HOME||o.join(g(t),".cache"):e==="darwin"?o.join(g(t),"Library","Caches"):r.LOCALAPPDATA||o.join(g(t),"AppData","Local")}function g(e){if(e.length===0)throw new TypeError("Playwright default registry requires a home directory");return e}function u(e){return{dependencyGroup:"dependencies",packageName:e.packageName,publicEntrypoint:e.publicEntrypoints[0]}}function p(e,r){if(e.name!==r)throw new TypeError(`Playwright package family expected ${r}, received ${e.name}`);return Object.freeze({entrypoint:e.entrypoint,name:r,root:e.root,version:e.version})}function N(){const e=m(new URL("./playwright-resolution-child.js",import.meta.url));return c.existsSync(e)?e:m(new URL("../../../dist/engines/installations/playwright-resolution-child.js",import.meta.url))}function j(e){return e.terminationError!==null?e.terminationError:e.error!==null?e.error:e.timedOut?new Error("isolated resolver timed out"):e.cancelled?new Error("isolated resolver was cancelled"):e.outputLimitExceeded?new Error("isolated resolver output exceeded the bound"):null}function E(e){return new Error(`isolated resolver exited with ${e.exitCode===null?String(e.exitSignal):e.exitCode.toString()}`)}function M(e){const r=new Error(e.message);return r.name=e.name,e.code!==void 0&&Object.defineProperty(r,"code",{enumerable:!0,value:e.code}),r}function $(e){return l(e)&&typeof e.cli=="string"&&w(e.playwrightTest,"@playwright/test")&&w(e.playwright,"playwright")&&w(e.playwrightCore,"playwright-core")}function w(e,r){return l(e)&&e.name===r&&typeof e.version=="string"&&typeof e.root=="string"&&typeof e.entrypoint=="string"}function U(e){return l(e)&&typeof e.canonicalValue=="string"&&(e.mode==="configured-absolute"||e.mode==="configured-relative"||e.mode==="default"||e.mode==="hermetic")}
@@ -1 +1 @@
1
- import{isPathWithin as l}from"../process/files/paths.js";import s from"node:fs";import c from"node:path";export function normalizeExistingFileRecord(e,r){const o={};for(const[t,n]of Object.entries(e).sort(([i],[u])=>i.localeCompare(u)))o[t]=requireExistingFile(n,`${r}.${t}`);return Object.freeze(o)}export function normalizeAbsoluteFiles(e,r,o){return normalizeStrings(e.map((t,n)=>{const i=`${r}[${n.toString()}]`;return o?requireExistingFile(t,i):a(t,i)}))}export function normalizeDirectories(e,r){return normalizeStrings(e.map((o,t)=>{const n=a(o,`${r}[${t.toString()}]`),i=s.realpathSync(n);if(!s.statSync(i).isDirectory())throw new Error(`Managed module-resolution policy ${r} must contain directories`);return i}))}export function normalizeStrings(e){return Object.freeze([...new Set(e)].sort())}export function requireDirectTargetsWithinRoots(e,r){for(const[o,t]of Object.entries(e))if(!r.some(n=>l(n,t)||c.basename(t)==="package.json"&&c.dirname(t)===c.dirname(n)))throw new Error(`Managed direct module ${o} is outside every direct bridge root`)}export function requireExistingFile(e,r){const o=a(e,r),t=s.realpathSync(o);if(!s.statSync(t).isFile())throw new Error(`Managed module-resolution policy ${r} must be a file`);return t}function a(e,r){if(!c.isAbsolute(e))throw new Error(`Managed module-resolution policy ${r} must be absolute`);return c.resolve(e)}export function readRecord(e){const r=JSON.parse(s.readFileSync(e,"utf8"));if(!isRecord(r))throw new Error(`Invalid package manifest: ${e}`);return r}export function isErrorCode(e,r){return typeof e=="object"&&e!==null&&"code"in e&&Reflect.get(e,"code")===r}export function isRecord(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}
1
+ import{isPathWithin as l}from"../process/files/paths.js";import s from"node:fs";import c from"node:path";import{isUnknownRecord as f}from"../kernel/unknown-values.js";export function normalizeExistingFileRecord(e,r){const o={};for(const[t,n]of Object.entries(e).sort(([i],[u])=>i.localeCompare(u)))o[t]=requireExistingFile(n,`${r}.${t}`);return Object.freeze(o)}export function normalizeAbsoluteFiles(e,r,o){return normalizeStrings(e.map((t,n)=>{const i=`${r}[${n.toString()}]`;return o?requireExistingFile(t,i):a(t,i)}))}export function normalizeDirectories(e,r){return normalizeStrings(e.map((o,t)=>{const n=a(o,`${r}[${t.toString()}]`),i=s.realpathSync(n);if(!s.statSync(i).isDirectory())throw new Error(`Managed module-resolution policy ${r} must contain directories`);return i}))}export function normalizeStrings(e){return Object.freeze([...new Set(e)].sort())}export function requireDirectTargetsWithinRoots(e,r){for(const[o,t]of Object.entries(e))if(!r.some(n=>l(n,t)||c.basename(t)==="package.json"&&c.dirname(t)===c.dirname(n)))throw new Error(`Managed direct module ${o} is outside every direct bridge root`)}export function requireExistingFile(e,r){const o=a(e,r),t=s.realpathSync(o);if(!s.statSync(t).isFile())throw new Error(`Managed module-resolution policy ${r} must be a file`);return t}function a(e,r){if(!c.isAbsolute(e))throw new Error(`Managed module-resolution policy ${r} must be absolute`);return c.resolve(e)}export function readRecord(e){const r=JSON.parse(s.readFileSync(e,"utf8"));if(!f(r))throw new Error(`Invalid package manifest: ${e}`);return r}export function isErrorCode(e,r){return typeof e=="object"&&e!==null&&"code"in e&&Reflect.get(e,"code")===r}
@@ -1 +1 @@
1
- import{isPathWithin as m}from"../process/files/paths.js";import d from"node:fs";import a from"node:path";import{isErrorCode as j,isRecord as b,normalizeAbsoluteFiles as g,normalizeDirectories as w,normalizeExistingFileRecord as v,normalizeStrings as E,readRecord as k,requireDirectTargetsWithinRoots as y,requireExistingFile as h}from"./managed-module-resolution-policy-input.js";export function inspectManagedNodeModuleResolutionPolicy(t){const{engineLabel:o,stateSymbol:r}=t,e=w(t.consumerRoots,"consumerRoots"),n=v(t.direct,"direct"),s=w(t.directBridgeRoots,"directBridgeRoots");y(n,s);const i=S(t.packageAnchors,"packageAnchors"),c=E(t.reservedPackageNames),f=F(i);return Object.freeze({consumerRoots:e,dependencyRoots:f,managedImporterRoots:Object.freeze([...Object.values(i),...f.flatMap(l=>t.forbiddenConsumerPackagePrefixes.map(u=>a.join(l,u)).filter(u=>d.existsSync(u)).map(u=>d.realpathSync(u)))]),direct:n,directBridgeRoots:s,engineLabel:o,forbiddenConsumerPackagePrefixes:E(t.forbiddenConsumerPackagePrefixes),packageExports:$(i,o),packageRoots:i,reservedPackageNames:c,stateSymbol:r,trustedImporterFiles:g(t.trustedImporterFiles,"trustedImporterFiles",!1),trustedInternalEntrypoints:g(t.trustedInternalEntrypoints,"trustedInternalEntrypoints",!0),trustedInternalRoots:R(t.trustedInternalEntrypoints,c),verifiedParentlessPackageFiles:x(t.verifiedParentlessPackageFiles,i),verifiedProcessEntrypoints:g(t.verifiedProcessEntrypoints,"verifiedProcessEntrypoints",!0)})}function R(t,o){const r=new Set;for(const e of t){let n=a.dirname(h(e,"trustedInternalEntrypoints"));for(;;){const s=a.join(n,"package.json");if(d.existsSync(s)){const c=k(s);if(typeof c.name=="string"&&o.includes(c.name)){const f=a.relative(n,e),[l]=f.split(a.sep);if(l&&l!==".."&&!a.isAbsolute(f)){const u=a.join(n,l);d.statSync(u).isDirectory()&&r.add(d.realpathSync(u))}}break}const i=a.dirname(n);if(i===n)break;n=i}}return Object.freeze([...r].sort())}function x(t,o){const r=new Set;for(const[e,n]of Object.entries(t)){if(!Object.hasOwn(o,e))throw new Error(`Parentless preload package is not managed: ${e}`);const s=o[e];for(const[i,c]of n.entries()){if(a.isAbsolute(c)||c.length===0||c.includes("\0"))throw new Error(`Parentless preload ${e}[${i.toString()}] must be a relative file`);const f=a.resolve(s,c);if(!m(s,f))throw new Error(`Parentless preload escapes managed package ${e}`);const l=h(f,`verifiedParentlessPackageFiles.${e}[${i.toString()}]`);if(!m(s,l))throw new Error(`Parentless preload escapes managed package ${e}`);r.add(l)}}return Object.freeze([...r].sort())}function S(t,o){const r={};for(const[e,n]of Object.entries(t).sort(([s],[i])=>s.localeCompare(i)))r[e]=O(e,h(n,o));return Object.freeze(r)}function O(t,o){let r=a.dirname(o);for(;;){const e=a.join(r,"package.json");if(d.existsSync(e)&&k(e).name===t)return d.realpathSync(r);const n=a.dirname(r);if(n===r)throw new Error(`Managed package anchor has no matching package root: ${t}`);r=n}}function $(t,o){const r={};for(const[e,n]of Object.entries(t)){const s=k(a.join(n,"package.json"));if(s.name!==e||!b(s.exports))throw new Error(`Managed ${o} package manifest is invalid: ${e}`);for(const[i,c]of Object.entries(s.exports)){if(i!=="."&&!i.startsWith("./")||i.includes("*"))continue;const f=i==="."?e:`${e}${i.slice(1)}`;r[f]=Object.freeze({default:P(e,i,n,p(c,new Set(["node","default"]))),import:P(e,i,n,p(c,new Set(["node","import","default"]))),require:P(e,i,n,p(c,new Set(["node","require","default"])))})}}return Object.freeze(r)}function p(t,o){if(typeof t=="string")return t;if(Array.isArray(t)){for(const r of t){const e=p(r,o);if(e!==null)return e}return null}if(!b(t))return null;for(const[r,e]of Object.entries(t)){if(r==="types"||!o.has(r))continue;const n=p(e,o);if(n!==null)return n}return null}function P(t,o,r,e){if(e===null)return null;if(!e.startsWith("./"))throw new Error(`Managed package export must be relative: ${t}${o}`);const n=a.resolve(r,e);if(!m(r,n))throw new Error(`Managed package export escapes its verified root: ${t}${o}`);try{const s=d.realpathSync(n);if(!m(r,s)||!d.statSync(s).isFile())throw new Error(`Managed package export is not a verified file: ${t}${o}`);return s}catch(s){if(j(s,"ENOENT"))return null;throw s}}function F(t){const o=new Set;for(const[r,e]of Object.entries(t))o.add(r.startsWith("@")?a.dirname(a.dirname(e)):a.dirname(e));return Object.freeze([...o].sort())}
1
+ import{isPathWithin as m}from"../process/files/paths.js";import{isUnknownRecord as b}from"../kernel/unknown-values.js";import d from"node:fs";import a from"node:path";import{isErrorCode as j,normalizeAbsoluteFiles as g,normalizeDirectories as w,normalizeExistingFileRecord as v,normalizeStrings as E,readRecord as k,requireDirectTargetsWithinRoots as y,requireExistingFile as h}from"./managed-module-resolution-policy-input.js";export function inspectManagedNodeModuleResolutionPolicy(t){const{engineLabel:o,stateSymbol:r}=t,e=w(t.consumerRoots,"consumerRoots"),n=v(t.direct,"direct"),s=w(t.directBridgeRoots,"directBridgeRoots");y(n,s);const i=S(t.packageAnchors,"packageAnchors"),c=E(t.reservedPackageNames),f=F(i);return Object.freeze({consumerRoots:e,dependencyRoots:f,managedImporterRoots:Object.freeze([...Object.values(i),...f.flatMap(l=>t.forbiddenConsumerPackagePrefixes.map(u=>a.join(l,u)).filter(u=>d.existsSync(u)).map(u=>d.realpathSync(u)))]),direct:n,directBridgeRoots:s,engineLabel:o,forbiddenConsumerPackagePrefixes:E(t.forbiddenConsumerPackagePrefixes),packageExports:$(i,o),packageRoots:i,reservedPackageNames:c,stateSymbol:r,trustedImporterFiles:g(t.trustedImporterFiles,"trustedImporterFiles",!1),trustedInternalEntrypoints:g(t.trustedInternalEntrypoints,"trustedInternalEntrypoints",!0),trustedInternalRoots:R(t.trustedInternalEntrypoints,c),verifiedParentlessPackageFiles:x(t.verifiedParentlessPackageFiles,i),verifiedProcessEntrypoints:g(t.verifiedProcessEntrypoints,"verifiedProcessEntrypoints",!0)})}function R(t,o){const r=new Set;for(const e of t){let n=a.dirname(h(e,"trustedInternalEntrypoints"));for(;;){const s=a.join(n,"package.json");if(d.existsSync(s)){const c=k(s);if(typeof c.name=="string"&&o.includes(c.name)){const f=a.relative(n,e),[l]=f.split(a.sep);if(l&&l!==".."&&!a.isAbsolute(f)){const u=a.join(n,l);d.statSync(u).isDirectory()&&r.add(d.realpathSync(u))}}break}const i=a.dirname(n);if(i===n)break;n=i}}return Object.freeze([...r].sort())}function x(t,o){const r=new Set;for(const[e,n]of Object.entries(t)){if(!Object.hasOwn(o,e))throw new Error(`Parentless preload package is not managed: ${e}`);const s=o[e];for(const[i,c]of n.entries()){if(a.isAbsolute(c)||c.length===0||c.includes("\0"))throw new Error(`Parentless preload ${e}[${i.toString()}] must be a relative file`);const f=a.resolve(s,c);if(!m(s,f))throw new Error(`Parentless preload escapes managed package ${e}`);const l=h(f,`verifiedParentlessPackageFiles.${e}[${i.toString()}]`);if(!m(s,l))throw new Error(`Parentless preload escapes managed package ${e}`);r.add(l)}}return Object.freeze([...r].sort())}function S(t,o){const r={};for(const[e,n]of Object.entries(t).sort(([s],[i])=>s.localeCompare(i)))r[e]=O(e,h(n,o));return Object.freeze(r)}function O(t,o){let r=a.dirname(o);for(;;){const e=a.join(r,"package.json");if(d.existsSync(e)&&k(e).name===t)return d.realpathSync(r);const n=a.dirname(r);if(n===r)throw new Error(`Managed package anchor has no matching package root: ${t}`);r=n}}function $(t,o){const r={};for(const[e,n]of Object.entries(t)){const s=k(a.join(n,"package.json"));if(s.name!==e||!b(s.exports))throw new Error(`Managed ${o} package manifest is invalid: ${e}`);for(const[i,c]of Object.entries(s.exports)){if(i!=="."&&!i.startsWith("./")||i.includes("*"))continue;const f=i==="."?e:`${e}${i.slice(1)}`;r[f]=Object.freeze({default:P(e,i,n,p(c,new Set(["node","default"]))),import:P(e,i,n,p(c,new Set(["node","import","default"]))),require:P(e,i,n,p(c,new Set(["node","require","default"])))})}}return Object.freeze(r)}function p(t,o){if(typeof t=="string")return t;if(Array.isArray(t)){for(const r of t){const e=p(r,o);if(e!==null)return e}return null}if(!b(t))return null;for(const[r,e]of Object.entries(t)){if(r==="types"||!o.has(r))continue;const n=p(e,o);if(n!==null)return n}return null}function P(t,o,r,e){if(e===null)return null;if(!e.startsWith("./"))throw new Error(`Managed package export must be relative: ${t}${o}`);const n=a.resolve(r,e);if(!m(r,n))throw new Error(`Managed package export escapes its verified root: ${t}${o}`);try{const s=d.realpathSync(n);if(!m(r,s)||!d.statSync(s).isFile())throw new Error(`Managed package export is not a verified file: ${t}${o}`);return s}catch(s){if(j(s,"ENOENT"))return null;throw s}}function F(t){const o=new Set;for(const[r,e]of Object.entries(t))o.add(r.startsWith("@")?a.dirname(a.dirname(e)):a.dirname(e));return Object.freeze([...o].sort())}
@@ -1,11 +1,11 @@
1
- import{ownedGeneratedScript as o}from"./generated-performance.js";import{inspectManagedNodeModuleResolutionPolicy as s}from"./managed-module-resolution-policy.js";export function createManagedNodeModuleResolution(e){const t=s(e),n={...t.direct};for(const[a,i]of Object.entries(t.packageExports)){const r=i.import??i.default??i.require;r!==null&&(n[a]=r)}return Object.freeze({aliases:Object.freeze(n),bootstrapSource:c(t),dependencyRoots:t.managedImporterRoots})}export function managedNodeModuleResolutionBootstrapSource(e){return createManagedNodeModuleResolution(e).bootstrapSource}function c(e){return o(`
1
+ import{ownedGeneratedScript as o}from"./generated-performance.js";import{inspectManagedNodeModuleResolutionPolicy as s}from"./managed-module-resolution-policy.js";export function createManagedNodeModuleResolution(t){const e=s(t),n={...e.direct};for(const[a,i]of Object.entries(e.packageExports)){const r=i.import??i.default??i.require;r!==null&&(n[a]=r)}return Object.freeze({aliases:Object.freeze(n),bootstrapSource:c(e),dependencyRoots:e.managedImporterRoots})}function c(t){return o(`
2
2
  const fs = require("node:fs");
3
3
  const path = require("node:path");
4
4
  const { isBuiltin, registerHooks } = require("node:module");
5
5
  const { fileURLToPath, pathToFileURL } = require("node:url");
6
6
 
7
7
  let canonicalPaths = null;
8
- const POLICY = Object.freeze(${JSON.stringify(e)});
8
+ const POLICY = Object.freeze(${JSON.stringify(t)});
9
9
  const CONSUMER_ROOTS = Object.freeze(
10
10
  POLICY.consumerRoots.map((root) => verifiedDirectory(root, "consumer root")),
11
11
  );
@@ -1 +1 @@
1
- import{ENGINE_PROTOCOL_LIMITS as d,beginEngineExecution as E,createEngineInvocationScope as h}from"./api/index.js";import"../domain/identifiers.js";export class EngineExecutorLoadError extends Error{code="TESTKIT_ENGINE_EXECUTOR_LOAD_FAILED";engineId;constructor(t,o){super(`Resolved ${t} executor could not be loaded`,o),this.name="EngineExecutorLoadError",this.engineId=t}}export class EngineManager{catalog;productRoot;installations=new WeakMap;constructor(t){this.catalog=t.catalog,this.productRoot=t.productRoot}resolve(t){return this.catalog.resolve(t)}async withEngine(t,o,i){const c=this.resolve(t);o.throwIfAborted();let n=this.installations.get(o);n||(n=new Map,this.installations.set(o,n));let r=n.get(t);if(!r){const a=n;r=c.resolveInstallation({productRoot:this.productRoot,signal:o}).catch(l=>{throw a.delete(t),l}),a.set(t,r)}const s=await r;return o.throwIfAborted(),i(w(c,s))}}function w(e,t){return Object.freeze({engineId:e.id,async execute(o){u(o.signal);const i=E(o),c=h({timeoutMs:d.cleanupTimeoutMs});let n=null,r,s=!1;try{const l=await g(e);u(o.signal),n=i.acceptResult(await l(i.request,t,c.scope))}catch(l){s=!0,r=l}finally{i.close()}const a=await c.drain();if(s)throw a.length===0?r:new AggregateError([r,...a],`Engine invocation failed and ${a.length.toString()} cleanup handler(s) also failed`,{cause:r});if(a.length>0)throw new AggregateError(a,`${a.length.toString()} engine invocation cleanup handler(s) failed`);if(n===null)throw new Error("Engine invocation completed without a result");return i.commit(),n}})}function u(e){if(e.aborted)throw e.reason instanceof Error?e.reason:new Error("Resolved engine invocation was cancelled",{cause:e.reason})}async function g(e){try{return await e.loadExecutor()}catch(t){throw new EngineExecutorLoadError(e.id,{cause:t})}}
1
+ import{BUILT_IN_ENGINE_DEFINITIONS as E}from"./definitions.js";import{ENGINE_CLEANUP_TIMEOUT_MS as d,beginEngineExecution as h,createEngineInvocationScope as w}from"./api/index.js";import"../domain/identifiers.js";export class EngineExecutorLoadError extends Error{code="TESTKIT_ENGINE_EXECUTOR_LOAD_FAILED";engineId;constructor(t,o){super(`Resolved ${t} executor could not be loaded`,o),this.name="EngineExecutorLoadError",this.engineId=t}}export class EngineManager{productRoot;installations=new WeakMap;constructor(t){this.productRoot=t}async withEngine(t,o,i){const c=E[t];o.throwIfAborted();let n=this.installations.get(o);n||(n=new Map,this.installations.set(o,n));let r=n.get(t);if(!r){const a=n;r=c.resolveInstallation({productRoot:this.productRoot,signal:o}).catch(l=>{throw a.delete(t),l}),a.set(t,r)}const s=await r;return o.throwIfAborted(),i(f(c,s))}}function f(e,t){return Object.freeze({engineId:e.id,async execute(o){u(o.signal);const i=h(o),c=w({timeoutMs:d});let n=null,r,s=!1;try{const l=await p(e);u(o.signal),n=i.acceptResult(await l(i.request,t,c.scope))}catch(l){s=!0,r=l}finally{i.close()}const a=await c.drain();if(s)throw a.length===0?r:new AggregateError([r,...a],`Engine invocation failed and ${a.length.toString()} cleanup handler(s) also failed`,{cause:r});if(a.length>0)throw new AggregateError(a,`${a.length.toString()} engine invocation cleanup handler(s) failed`);if(n===null)throw new Error("Engine invocation completed without a result");return i.commit(),n}})}function u(e){if(e.aborted)throw e.reason instanceof Error?e.reason:new Error("Resolved engine invocation was cancelled",{cause:e.reason})}async function p(e){try{return await e.loadExecutor()}catch(t){throw new EngineExecutorLoadError(e.id,{cause:t})}}
@@ -1 +1 @@
1
- import{makeTempDirAsync as h}from"../../../process/files/temp-dir.js";import{classifyManagedProcessResult as H,terminalOutcome as E,processOutputEvidence as J,emptyEvidence as R,failureFromError as p,firstOutputLine as x,processExitFailure as Y,toError as M,executeEngineTasks as G,managedProcessFailure as Q,taskTimeoutFailure as X}from"../../adapters/execution.js";import{requireRootDirectory as Z,requireAbsoluteWorkspacePath as P,requireConsumerFile as L,safeSegment as A}from"../../adapters/workspace.js";import f from"node:fs/promises";import c from"node:path";import{pathToFileURL as q}from"node:url";import{isEngineTaskDeadlineExceededReason as tt,resolveEngineTaskInputs as et}from"../../api/index.js";import{createInvocationProcessEnvironment as it,runManagedProcess as rt}from"../../../process/index.js";import{preflightNodeVitestInstallation as nt}from"../../installations/node-vitest.js";import{collectNodeVitestEvidence as ot}from"./evidence.js";import{assertNodeVitestSpawnEnvironmentBudget as C,NODE_VITEST_RUNTIME_INPUT_FILE_ENV as at,NODE_VITEST_RUNTIME_INPUT_SHA256_ENV as st,selectNodeVitestForwardedEnvironment as ct,verifyOwnedNodeVitestRuntimeInput as ut,writeOwnedNodeVitestRuntimeInput as dt}from"../runtime/runtime-input.js";import{writeNodeVitestWorkspace as lt}from"./workspace.js";import{engineEvidenceIdentity as pt}from"../../adapters/evidence-identity.js";import{getNodeStartupCacheEnvironment as ft}from"../../adapters/node-startup-cache.js";const I={codePrefix:"NODE_VITEST",label:"Node/Vitest"};class b extends Error{constructor(e){const i=M(e);super(i.message,{cause:i}),this.name="NodeVitestConsumerPreparationError"}}export const nodeVitestExecutorDependencies={removeOwnedDirectory:t=>f.rm(t,{force:!0,recursive:!0}),writeRuntimeInput:dt,writeWorkspace:lt};export async function executeNodeVitestEngine(t,e,i,r=nodeVitestExecutorDependencies){const n=await mt(t,e,r,i);return G(t,n.tasks,I,(a,o)=>Et(t,n,a,o),yt(t,n.installation))}async function mt(t,e,i,r){const n=t.profile.id,a=e.packages.vitest.cli,o=await Z(t.workspace.rootDirectory);P(t.workspace.temporaryDirectory,"temporary directory"),P(t.workspace.artifactDirectory,"artifact directory"),await f.mkdir(t.workspace.temporaryDirectory,{recursive:!0}),await f.mkdir(t.workspace.artifactDirectory,{recursive:!0});const d=await f.realpath(t.workspace.temporaryDirectory),T=await f.realpath(t.workspace.artifactDirectory),l=Object.freeze({...e.authoringEntrypoints,cli:e.packages.vitest.cli,packages:e.packages}),m=await h(`node-vitest-${A(t.invocationId)}-`,{parentDir:d});r.defer(()=>i.removeOwnedDirectory(m));const U=await it(m),g=[];for(const[B,s]of t.tasks.entries()){const v=et(t,s),S=`${B.toString().padStart(3,"0")}-${A(s.id)}`,u=c.join(m,S),y=await h(`${S}-`,{parentDir:T}),w=c.join(u,"testkit-vitest-report.json"),$=c.join(y,"data","manifest.json"),z=c.join(u,"setup.mjs"),O=c.join(u,"input-bootstrap.mjs"),F=c.join(u,"resolution-bootstrap.cjs"),V=c.join(u,"vitest.config.mjs");try{await f.mkdir(u,{mode:448,recursive:!1});const D=await N(()=>L(o,s.file,"Node/Vitest task file")),k=await N(()=>gt(o,v)),W=await N(()=>vt(t,n,s,v)),_=await i.writeRuntimeInput(u,W);await i.writeWorkspace({report:{identity:{engineId:"node-vitest",invocationId:t.invocationId,taskId:s.id,sourceFile:s.file},reportFile:w,workspaceDirectory:u},configFile:k.testkitConfig,entrypoints:l,inputBootstrapFile:O,resolutionBootstrapFile:F,rootDirectory:o,runtimeInput:{expectedFile:_.file,expectedInvocationId:t.invocationId,expectedProfileId:n,expectedSha256:_.sha256,expectedSizeBytes:_.sizeBytes,expectedTaskId:s.id},setupFile:z,sourceFile:D,timeoutMs:Math.max(1,s.deadlineMs-Date.now()),tsconfigFile:k.tsconfig,vitestConfigFile:V}),g.push({artifactDirectory:y,inputs:v,task:s,preparationFailure:null,prepared:{dataManifestFile:$,inputBootstrapFile:O,reportFile:w,resolutionBootstrapFile:F,runtimeInput:_,vitestConfigFile:V}})}catch(D){g.push({artifactDirectory:y,inputs:v,task:s,preparationFailure:Dt(D),prepared:null})}}return Object.freeze({cliFile:a,installation:e,invocationEnvironment:U.environment,profileId:n,rootDirectory:o,tasks:Object.freeze(g)})}async function Et(t,e,i,r){try{await ut(i.prepared.runtimeInput)}catch(l){return E(i.task.id,"failed",r,R(),{...p(l,"NODE_VITEST_INPUT_INVALID"),classification:"infra"})}const n=await Tt(t,e,i),a=i.task.deadlineMs-Date.now();if(a<=0)return E(i.task.id,"failed",r,R(),X(i.task.timeoutMs,I));const o=await rt({args:[e.cliFile,"run","--config",i.prepared.vitestConfigFile,"--configLoader","runner"],cwd:e.rootDirectory,displayLabel:"Node/Vitest",env:n,executable:process.execPath,signal:t.signal,timeoutMs:a});let d;try{d=await ot({identity:{engineId:"node-vitest",invocationId:t.invocationId,taskId:i.task.id,sourceFile:i.task.file},artifactDirectory:i.artifactDirectory,dataManifestFile:i.prepared.dataManifestFile,profileId:e.profileId,reportFile:i.prepared.reportFile,rootDirectory:e.rootDirectory,stderr:o.stderr,stdout:o.stdout})}catch(l){const m=J(o);return E(i.task.id,"failed",r,m,nodeVitestEvidenceCollectionFailure(o,l))}if(d.reportSummary===null&&o.exitCode!==0&&!t.signal.aborted&&!o.timedOut&&!o.outputLimitExceeded&&o.terminationError===null&&o.error===null)try{await nt(e.installation,{signal:t.signal})}catch(l){if(!t.signal.aborted)return E(i.task.id,"failed",r,d.evidence,{...p(l,"NODE_VITEST_INSTALLATION_BROKEN"),classification:"infra"})}const T=classifyNodeVitestProcessResult(o,d,i.task.timeoutMs,tt(t.signal.reason));return E(i.task.id,T.status,r,d.evidence,T.failure)}export function classifyNodeVitestProcessResult(t,e,i,r){const n=H(t,i,r,I);return n!==null?n:e.reportSummary?.numTotalTests===0?{failure:{code:"NODE_VITEST_NO_TESTS",message:"Vitest did not discover any tests for the task file"},status:"failed"}:It(e.reportSummary)?{failure:null,status:"skipped"}:t.exitCode!==0?Y(t,I,e.reportFailureMessage??x(t.stderr)??x(t.stdout),"Vitest"):e.reportError!==null?{failure:{...p(e.reportError,"NODE_VITEST_REPORT_INVALID"),classification:"infra"},status:"failed"}:e.reportFailureMessage!==null?{failure:{code:"NODE_VITEST_REPORT_FAILED",message:e.reportFailureMessage},status:"failed"}:e.dataEvidenceError!==null?{failure:p(e.dataEvidenceError,"NODE_VITEST_DATA_EVIDENCE_INVALID"),status:"failed"}:e.reportSummary===null||!e.reportSummary.success||e.reportSummary.numFailedTests>0||e.reportSummary.numPassedTests===0?{failure:{code:"NODE_VITEST_REPORT_FAILED",message:"Vitest report did not contain a completed passing test"},status:"failed"}:{failure:null,status:"passed"}}export function nodeVitestEvidenceCollectionFailure(t,e){const i=M(e);return Q(t,I,i)??{...p(i,"NODE_VITEST_EVIDENCE_FAILED"),classification:"infra"}}function It(t){return t!==null&&t.success&&t.numTotalTests>0&&t.numPassedTests===0&&t.numFailedTests===0&&(t.numPendingTests>0||t.numTodoTests>0)}async function Tt(t,e,i){const r=i.task,n=j(t,r.serviceName),a={...e.invocationEnvironment};Object.assign(a,{...n===null?{}:{BASE_URL:n},FORCE_COLOR:"0",NODE_OPTIONS:_t(i.prepared.resolutionBootstrapFile,i.prepared.inputBootstrapFile),NO_COLOR:"1",TESTKIT_ACTIVE:"1",[at]:i.prepared.runtimeInput.file,[st]:i.prepared.runtimeInput.sha256,TESTKIT_INTERNAL_FILE_DEADLINE_MS:String(r.deadlineMs),TESTKIT_INTERNAL_FILE_TIMEOUT_SECONDS:String(Math.max(1,Math.ceil(r.timeoutMs/1e3))),TESTKIT_INVOCATION_ID:t.invocationId,TESTKIT_LEASE_DIR:r.orchestration.lease.directory,TESTKIT_LEASE_ID:r.orchestration.lease.id,TESTKIT_MODE:r.orchestration.mode,...r.orchestration.runtimeId===void 0?{}:{TESTKIT_RUNTIME_ID:r.orchestration.runtimeId},TESTKIT_TEST_FILE:r.file,TESTKIT_TEST_ID:r.id,...e.profileId==="node-vitest-data"?{TESTKIT_DATA_ARTIFACT_DIR:c.dirname(i.prepared.dataManifestFile)}:{}}),C(a),Object.assign(a,await ft(t.workspace.cacheDirectory,i.inputs.environment));try{C(a)}catch{delete a.NODE_COMPILE_CACHE}return a}function vt(t,e,i,r){const n=j(t,i.serviceName),a=ct(r.environment);return{context:{baseUrl:n,engineId:"node-vitest",invocationId:t.invocationId,profileId:e,serviceName:i.serviceName,task:{file:i.file,id:i.id,suiteName:i.suiteName,testType:i.testType}},engineId:"node-vitest",environment:a,fixtures:r.fixtures,invocationId:t.invocationId,profileId:e,...r.setupData===void 0?{}:{setupData:r.setupData},taskId:i.id,version:1}}function _t(t,e){return[`--require=${JSON.stringify(t)}`,`--import=${JSON.stringify(q(e).href)}`].join(" ")}function j(t,e){return Object.hasOwn(t.target.endpoints,e)?t.target.endpoints[e]:null}async function gt(t,e){return{testkitConfig:await K(t,e.supportModules,"testkitConfig"),tsconfig:await K(t,e.supportModules,"tsconfig")}}async function K(t,e,i){if(!Object.hasOwn(e,i))return null;const r=e[i];if(!c.isAbsolute(r))throw new Error(`supportModules.${i} must be an absolute path`);return L(t,r,`supportModules.${i}`)}function yt(t,e){return{...pt({engineId:"node-vitest",installationKind:"root-direct-packages",profile:t.profile}),directPackages:{esbuild:e.packages.esbuild.version,typescript:e.packages.typescript.version,vite:e.packages.vite.version,vitest:e.packages.vitest.version}}}function Dt(t){return{...p(t,"NODE_VITEST_PREPARE_FAILED"),classification:t instanceof b?"product":"infra"}}async function N(t){try{return await t()}catch(e){throw new b(e)}}
1
+ import{makeTempDirAsync as B}from"../../../process/files/temp-dir.js";import{toError as K}from"../../../kernel/error-serialization.js";import{isDeepStrictEqual as ie}from"node:util";import{classifyManagedProcessResult as oe,engineExecutionResult as se,terminalOutcome as j,emptyEvidence as L,failureFromError as x,firstOutputLine as W,processExitDetails as ae,processExitFailure as z,taskBeforeStartOutcome as ce,managedProcessFailure as H,taskTimeoutFailure as de}from"../../adapters/execution.js";import{requireRootDirectory as le,requireAbsoluteWorkspacePath as J,requireConsumerFile as X,safeSegment as Y}from"../../adapters/workspace.js";import h from"node:fs/promises";import I from"node:path";import{pathToFileURL as ue}from"node:url";import{isEngineTaskDeadlineExceededReason as pe,resolveEngineTaskInputs as fe}from"../../api/index.js";import{createInvocationProcessEnvironment as me,runManagedProcess as Ee}from"../../../process/index.js";import{managedVitestAliases as G}from"../../installations/node-vitest.js";import{decodeVitestSelection as Te,resolveRepositoryVitest as ve}from"../selection.js";import{collectNodeVitestEvidence as Ie,readNodeVitestRunReport as ye}from"./evidence.js";import{assertNodeVitestSpawnEnvironmentBudget as Q,NODE_VITEST_RUNTIME_INPUT_FILE_ENV as De,NODE_VITEST_RUNTIME_INPUT_SHA256_ENV as ge,selectNodeVitestForwardedEnvironment as he,verifyOwnedNodeVitestRuntimeInput as we,writeOwnedNodeVitestRuntimeInput as Ne}from"../runtime/runtime-input.js";import{NODE_VITEST_DATA_RUNNER_FILE as Z,NODE_VITEST_DRIVER_FILE as _e,writeNodeVitestWorkspace as Oe}from"./workspace.js";import{nodeVitestReportOptions as Re}from"./reporter.js";import{engineEvidenceIdentity as Ve}from"../../adapters/evidence-identity.js";import{getNodeStartupCacheEnvironment as Se}from"../../adapters/node-startup-cache.js";const w={codePrefix:"NODE_VITEST",label:"Node/Vitest"},q="Unhandled Reporter Error";class ee extends Error{constructor(t){const r=K(t);super(r.message,{cause:r}),this.name="NodeVitestConsumerPreparationError"}}export const nodeVitestExecutorDependencies={removeOwnedDirectory:e=>h.rm(e,{force:!0,recursive:!0}),writeRuntimeInput:Ne,writeWorkspace:Oe};export async function executeNodeVitestEngine(e,t,r,f=nodeVitestExecutorDependencies){const c=await xe(e,t,f,r),o=Date.now(),s=c.tasks.map(d=>{e.observer?.taskStarted(d.task);const a=d.preparationFailure;return ce(d.task,e.signal,o,w)??(a===null?null:j(d.task.id,"failed",o,L(),a))}),p=c.tasks.filter((d,a)=>s[a]===null),i=[],v=p.length===0?[]:await Fe(e,c,p,o,i);let m=0;return se(e,s.map(d=>d??v[m++]),je(e,c),i)}async function xe(e,t,r,f){const c=e.profile.id,o=await le(e.workspace.rootDirectory);J(e.workspace.temporaryDirectory,"temporary directory"),J(e.workspace.artifactDirectory,"artifact directory"),await h.mkdir(e.workspace.temporaryDirectory,{recursive:!0}),await h.mkdir(e.workspace.artifactDirectory,{recursive:!0});const s=await h.realpath(e.workspace.temporaryDirectory),p=await h.realpath(e.workspace.artifactDirectory),i=await B(`node-vitest-${Y(e.invocationId)}-`,{parentDir:s});f.defer(()=>r.removeOwnedDirectory(i));const v=I.join(i,"reports");await h.mkdir(v,{mode:448});const m=await me(i);let d=[];for(const[n,u]of e.tasks.entries()){const l=fe(e,u),N=`${n.toString().padStart(3,"0")}-${Y(u.id)}`,y=await B(`${N}-`,{parentDir:p});try{const V=await M(()=>X(o,u.file,"Node/Vitest task file")),S=I.join(v,`${N}.json`),A={file:V,reportFile:S,sourceFile:u.file,taskId:u.id},k=I.join(y,"data");d.push({artifactDirectory:y,inputs:l,task:u,preparationFailure:null,prepared:{dataDirectory:k,module:A}})}catch(V){const S=te(V);d.push({artifactDirectory:y,inputs:l,task:u,preparationFailure:S,prepared:null})}}const a=d.filter(n=>n.prepared!==null),E=I.join(i,"setup.mjs"),T=I.join(i,"input-bootstrap.mjs"),D=I.join(i,"driver-request.json"),_=I.join(v,"run.json");let F=null,O=null,g=t.vitest;const R=`--import=${JSON.stringify(ue(T).href)}`;let C={...m.environment,FORCE_COLOR:"0",NODE_OPTIONS:R,NO_COLOR:"1"};if(a.length>0)try{ke(a);const{configuration:n}=a[0].inputs,u=c==="node-vitest"&&n!==void 0?Te(n):null,l=u!==null&&u.runner!=="managed"?u:null;l!==null&&(g=ve(o));const N=await M(()=>be(o,a[0].inputs)),y=await M(()=>Pe(e,c,a,l?.host??null));if(l!==null){const P=b=>process.platform==="win32"?b.toUpperCase():b,ne=new Set(Object.keys(y.environment).map(P));C={...Object.fromEntries(Object.entries(l.host).filter(([b])=>!ne.has(P(b)))),...y.environment,NODE_OPTIONS:[R,l.host.NODE_OPTIONS].join(" ").trim()}}F=await r.writeRuntimeInput(i,y);const{file:V,sha256:S,sizeBytes:A}=F,k=t.authoringEntrypoints;await r.writeWorkspace({configFile:N,inputBootstrapFile:T,modules:{...G(t),vitest:g.index},runtimeInput:{expectedFile:V,expectedInvocationId:e.invocationId,expectedProfileId:c,expectedSha256:S,expectedSizeBytes:A},setupFile:E});const U=c==="node-vitest-data",re=[k.config,k.data,...U?[Z]:[]],$={cacheDirectory:I.join(i,"cache"),invocationId:e.invocationId,runReportFile:_,setupFile:E,vitest:{entrypoint:g.entrypoint,name:"vitest",version:g.version}};O=l===null?{...$,aliases:G(t),config:!1,managed:{externalModules:re.map(P=>P.replaceAll(I.sep,"/"))},project:null,test:{...U?{runner:Z}:{},disableConsoleIntercept:!0,environment:"node",fileParallelism:!1,isolate:!0,maxWorkers:1,pool:"forks"}}:{...$,aliases:{},config:l.config,managed:null,project:l.project,test:{}}}catch(n){const u=te(n);d=d.map(l=>l.prepared===null?l:{...l,preparationFailure:u,prepared:null})}return Object.freeze({driverRequest:O,driverRequestFile:D,installation:t,processEnvironment:C,profileId:c,rootDirectory:o,runReportFile:_,runtimeInput:F,tasks:Object.freeze(d),vitest:g})}async function Fe(e,t,r,f,c){const o=n=>r.map(({task:u})=>j(u.id,"failed",f,L(),n(u.timeoutMs)));try{if(t.runtimeInput===null||t.driverRequest===null)throw new Error("Node/Vitest run was not prepared");await we(t.runtimeInput)}catch(n){return o(()=>({...x(n,"NODE_VITEST_INPUT_INVALID"),classification:"infra"}))}const s=await Ce(e,t,t.runtimeInput,r[0]),p=Math.min(...r.map(({task:n})=>n.deadlineMs))-Date.now();if(p<=0)return o(n=>de(n,w));const i=t.driverRequest.managed===null?{}:{hookTimeout:p,teardownTimeout:p,testTimeout:p},v=r.map(({prepared:n})=>n.module),m={...t.driverRequest,modules:v,test:{...t.driverRequest.test,...i}};await h.writeFile(t.driverRequestFile,JSON.stringify(m),{flag:"wx",mode:384});const d=await Ee({args:[_e,t.driverRequestFile],cwd:t.rootDirectory,displayLabel:"Node/Vitest",env:s,executable:process.execPath,signal:e.signal,timeoutMs:p}),a=await ye(e.invocationId,t.runReportFile),E=a instanceof Error?[]:a.unhandledErrors.filter(({type:n})=>n!==q),T=[];for(const{artifactDirectory:n,prepared:u}of r)T.push(await Ie({identity:Re(e.invocationId,u.module).identity,artifactDirectory:n,dataDirectory:u.dataDirectory,reportFile:u.module.reportFile,rootDirectory:t.rootDirectory,stderr:d.stderr,stdout:d.stdout,unhandledErrors:E.filter(({testPath:l})=>l===void 0||I.resolve(l)===I.resolve(u.module.file))}).catch(l=>nodeVitestEvidenceCollectionFailure(d,l)));const D=T.map(n=>"reportSummary"in n?n.reportSummary:null),_=pe(e.signal.reason),O=(d.cancelled||d.timedOut||_)&&a instanceof Error&&D.includes(null),g=E.length>0||D.some(n=>n?.success===!1||n?.numTotalTests===0),R=a instanceof Error?0:d.exitCode??a.exitCode,C=a instanceof Error?O?{exitCode:0,unhandledErrors:[]}:a:{...a,exitCode:R===1&&(g||a.afterTests!==void 0)?0:R};return!(a instanceof Error)&&a.afterTests!==void 0&&c.push(`Vitest failed the run after its tests passed: ${a.afterTests.join("; ")}`),r.map(({task:n},u)=>{const l=T[u];if(!("reportSummary"in l))return j(n.id,"failed",f,L(),l);const{failure:N,status:y}=classifyNodeVitestTaskResult(d,C,l,n.timeoutMs,_,O);return j(n.id,y,f,l.evidence,N)})}export function classifyNodeVitestTaskResult(e,t,r,f,c,o=!1){const s=E=>({failure:E,status:"failed"}),p=H(e,w);if(p!==null)return s(p);const i=r.reportSummary,v=i===null||!o?oe(e,f,c,w):null;if(v!==null)return v;const m=t instanceof Error?void 0:t.unhandledErrors.find(({type:E})=>E===q),d=t instanceof Error?void 0:t.failure??(m&&{...m,phase:"reporter"});if(d!==void 0){const{message:E,phase:T,stack:D}=d;return{failure:{classification:"infra",code:"NODE_VITEST_RUN_FAILED",details:{phase:T},message:`Vitest ${T} failed: ${E}`,...D===void 0?{}:{stack:D}},status:T==="config"?"not_run":"failed"}}if(r.environmentFailure!==null)return s(r.environmentFailure);if(i===null||t instanceof Error){const E=W(e.stderr)??W(e.stdout),T=e.exitCode===0?null:z(e,w,E,"Vitest").failure;return s({...x(r.reportError??t,"NODE_VITEST_REPORT_INVALID"),...T===null?{}:{details:T.details,message:T.message},classification:"infra"})}const a=o?null:e.exitSignal;if(t.exitCode!==0||a!==null){const E=a===null?`exited with code ${t.exitCode.toString()}`:`was terminated by ${a}`;return s({classification:"infra",code:"NODE_VITEST_EXIT_CODE",details:ae(e),message:`Vitest ${E}, which its test results do not explain`})}return i.numTotalTests===0&&r.reportErrorCount===0?s({code:"NODE_VITEST_NO_TESTS",message:"Vitest did not discover any tests for the task file"}):!i.success||i.numFailedTests>0||r.reportErrorCount>0?z(e,w,r.reportFailureMessage,"Vitest"):i.numPassedTests===0&&(i.numPendingTests>0||i.numTodoTests>0)?{failure:null,status:"skipped"}:r.dataEvidenceError!==null?s(x(r.dataEvidenceError,"NODE_VITEST_DATA_EVIDENCE_INVALID")):i.numPassedTests===0?s({code:"NODE_VITEST_REPORT_FAILED",message:"Vitest report did not contain a completed passing test"}):{failure:null,status:"passed"}}export function nodeVitestEvidenceCollectionFailure(e,t){const r=K(t);return H(e,w,r)??{...x(r,"NODE_VITEST_EVIDENCE_FAILED"),classification:"infra"}}async function Ce(e,t,r,{inputs:f,task:c}){const o=e.target.baseUrl,s={...t.processEnvironment,...o===null?{}:{BASE_URL:o},TESTKIT_ACTIVE:"1",[De]:r.file,[ge]:r.sha256,TESTKIT_INVOCATION_ID:e.invocationId,TESTKIT_LEASE_DIR:c.orchestration.lease.directory,TESTKIT_LEASE_ID:c.orchestration.lease.id,TESTKIT_MODE:c.orchestration.mode,...c.orchestration.runtimeId===void 0?{}:{TESTKIT_RUNTIME_ID:c.orchestration.runtimeId}},p=t.driverRequest?.managed!==null;p&&Q(s);const i={...t.processEnvironment,...f.environment};Object.assign(s,await Se(e.workspace.cacheDirectory,i));try{p&&Q(s)}catch{delete s.NODE_COMPILE_CACHE}return s}function ke(e){const t=({prepared:o})=>o.module.file,r=e.find((o,s)=>e.findIndex(p=>t(p)===t(o))!==s);if(r!==void 0)throw new Error(`Node/Vitest task ${r.task.id} selects a file that another task in the request selects`);const f=({inputs:o,task:s})=>[o.environment,o.supportModules,s.orchestration,s.timeoutMs],c=e.find(o=>!ie(f(o),f(e[0])));if(c!==void 0)throw new Error(`Node/Vitest task ${c.task.id} needs a different environment, support modules, orchestration or timeout than ${e[0].task.id}`)}function Pe(e,t,r,f){const{baseUrl:c,databases:o,endpoints:s,handles:p}=e.target;return{...f===null?{}:{host:f},baseUrl:c,databases:o,endpoints:s,engineId:"node-vitest",environment:he(r[0].inputs.environment),handles:p,invocationId:e.invocationId,profileId:t,tasks:r.map(({inputs:i,prepared:v,task:m})=>({context:{baseUrl:c,engineId:"node-vitest",invocationId:e.invocationId,profileId:t,serviceName:m.serviceName,task:{file:m.file,id:m.id,suiteName:m.suiteName,...m.testType===void 0?{}:{testType:m.testType}}},dataDirectory:v.dataDirectory,file:v.module.file,fixtures:i.fixtures,...i.setupData===void 0?{}:{setupData:i.setupData},taskId:m.id})),version:1}}async function be(e,{supportModules:t}){if(!Object.hasOwn(t,"testkitConfig"))return null;if(!I.isAbsolute(t.testkitConfig))throw new Error("supportModules.testkitConfig must be an absolute path");return X(e,t.testkitConfig,"supportModules.testkitConfig")}function je(e,t){return{...Ve({engineId:"node-vitest",installationKind:t.driverRequest?.managed===null?"repository-package":"root-direct-packages",profile:e.profile}),directPackages:{vitest:t.vitest.version}}}function te(e){return{...x(e,"NODE_VITEST_PREPARE_FAILED"),classification:e instanceof ee?"product":"infra"}}async function M(e){try{return await e()}catch(t){throw new ee(t)}}
@@ -0,0 +1,2 @@
1
+ import{realpathSync as d}from"node:fs";import S from"node:fs/promises";import w from"node:path";import{inspect as R}from"node:util";import{toError as m}from"../../../kernel/error-serialization.js";import{isUnknownRecord as j}from"../../../kernel/unknown-values.js";import{writeNativeReport as x}from"../../adapters/native-report.js";import{importResolvedPackageEntrypoint as k}from"../../installations/package-resolution.js";import{nodeVitestReportOptions as V,reportedError as p,TestkitVitestReporter as F}from"./reporter.js";const o=JSON.parse(await S.readFile(process.argv[2]??"","utf8")),E=new Map(o.modules.map(e=>[d(e.file),e])),N=V(o.invocationId,{reportFile:o.runReportFile,sourceFile:".",taskId:"run"}),a={unhandledErrors:[]},O=16*1024*1024;let g;process.env.TEST="true",process.env.VITEST="true",process.env.NODE_ENV??="test";try{const{createVitest:e}=await k(o.vitest),s={cacheDir:o.cacheDirectory,resolve:{alias:Object.entries(o.aliases).map(([i,u])=>({find:y(i),replacement:u})),...o.managed===null?{}:{tsconfigPaths:!0}},test:{...o.test,...o.managed===null?{}:{server:{deps:{external:o.managed.externalModules.map(y)}}}}},t=await e("test",{...{allowOnly:!1,includeTaskLocation:!0,passWithNoTests:!1,update:"none"},config:o.config??void 0,watch:!1},s);g=t,t.config.snapshotOptions.updateSnapshot="none",t.snapshot.options.updateSnapshot="none";for(const i of t.projects)i.config.setupFiles.push(o.setupFile);const n=await P(t),c=n.map(({moduleId:i,project:u})=>({...T(i),project:u.name})),{reporters:l}=t;o.managed!==null&&(l.length=0),l.unshift(new F(o.invocationId,c));const v=$(t,l),f=t;await(f.standalone===void 0?f.init():f.standalone()),a.unhandledErrors=(await t.runTestSpecifications(n,!1)).unhandledErrors.map(C);const h=v();h.length>0&&(a.afterTests=h)}catch(e){a.failure={phase:g===void 0?"config":"run",...p(m(e))},process.stderr.write(`${R(e)}
2
+ `),process.exitCode=1}finally{await g?.close().catch(e=>{a.failure??={phase:"close",...p(m(e))}})}await x(N,{...a,exitCode:process.exitCode??0},O);async function P(e){if(o.config===!1)return o.modules.map(({file:t})=>{const n=t.split(w.sep).join("/");return e.getProjectByName("").createSpecification(n)});const s=(await e.globTestSpecifications()).filter(({moduleId:t,project:n})=>E.has(d(t))&&(o.project===null||n.name===o.project)),r=o.modules.find(({file:t})=>!s.some(({moduleId:n})=>T(n).file===t));if(r!==void 0){const t=r.sourceFile.split(w.sep).join("/");throw new Error(`Vitest's configuration no longer selects ${t}, which Testkit listed earlier`)}return s}function $(e,s){let r;const t=[],n=e.logger.error.bind(e.logger);return e.logger.error=(...c)=>{r!==void 0&&t.push(c.map(String).join(" ")),n(...c)},s.push({onTestRunEnd:()=>{r=process.exitCode??0}}),()=>r===0&&process.exitCode===1?t:[]}function T(e){const s=E.get(d(e));if(s===void 0)throw new Error(`Vitest selected ${e}, which Testkit did not request`);return s}function C(e){if(!j(e)||typeof e.message!="string")return p(m(e));const{name:s,stack:r,type:t,VITEST_TEST_PATH:n}=e;return{...p({message:e.message,...typeof s=="string"?{name:s}:{},...typeof r=="string"?{stack:r}:{}}),...typeof t=="string"?{type:t}:{},...typeof n=="string"?{testPath:n}:{}}}function y(e){return new RegExp(`^${e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}$`,"u")}
@@ -1,2 +1,2 @@
1
- import w from"node:fs/promises";import y from"node:path";import{evidenceFileAccess as B,readStableEvidenceFile as V,writeOwnedEvidenceFile as $}from"../../adapters/evidence-files.js";import{NODE_VITEST_DATA_BUDGET_FAILURE_DETAIL_KIND as b,NODE_VITEST_DATA_FAILURE_DETAILS_ARTIFACT_KIND as _,NODE_VITEST_DATA_FAILURE_DETAILS_ARTIFACT_NAME as F}from"../runtime/runtime-input.js";import{vitestErrorDetails as L,vitestTestFailureDetails as M}from"./failure-details.js";import{readNativeReport as z,requireNativeEvidenceJson as C}from"../../adapters/native-report.js";const J=16*1024*1024,N=1024;export const NODE_VITEST_DATA_ARTIFACT_MAX_BYTES=16*1024*1024,NODE_VITEST_DATA_EVIDENCE_MAX_BYTES=64*1024*1024;const U=".testkit-owned-evidence";export async function collectNodeVitestEvidence(t,e=B){await w.mkdir(t.artifactDirectory,{recursive:!0});const r=await w.realpath(t.artifactDirectory),s=y.join(r,U);await w.mkdir(s,{mode:448,recursive:!1});const n=[],a=[];t.stdout.length>0&&(a.push({stream:"stdout",text:t.stdout}),n.push(await I(r,"stdout.log","node-vitest-stdout",t.stdout))),t.stderr.length>0&&(a.push({stream:"stderr",text:t.stderr}),n.push(await I(r,"stderr.log","node-vitest-stderr",t.stderr)));const i=await X(t.reportFile,t.identity,t.rootDirectory,s,e);n.push(...i.artifacts);const f=t.profileId==="node-vitest-data"?await K(r,s,t.dataManifestFile,e):{artifacts:[],error:null};return n.push(...f.artifacts),{dataEvidenceError:f.error,evidence:{artifacts:n,logs:a,metrics:[],...i.summary===null?{}:{native:{vitest:i.summary}}},reportError:i.error,reportFailureMessage:i.failureMessage,reportSummary:i.summary}}async function X(t,e,r,s,n){try{const a=await v(t,n);if(!a.exists||a.contents===null)throw new Error("Vitest did not produce its Testkit native report");const i=z(a.value,e).result;if(!T(i)||!T(i.summary))throw new Error("Vitest native report must contain result and summary objects");const f=Q(i.summary),c=M(i.failures,r);if(f.numFailedTests!==c.length)throw new Error("Vitest native report failure count does not match its summary");if(!Array.isArray(i.errors)||!i.errors.every(m=>typeof m=="string"))throw new Error("Vitest native report errors must contain strings");if(f.success&&i.errors.length>0)throw new Error("Vitest native report success conflicts with runtime errors");const u=await $(s,"testkit-vitest-report.json",a.contents),o=await S(u,"application/json","engine.testkit-vitest-report","testkit-vitest-report","Testkit native Vitest report"),d=await Y(s,c,L(i.errors));return{artifacts:[o,...d===null?[]:[d]],error:null,failureMessage:typeof c[0]?.message=="string"?c[0].message:i.errors.find(m=>m.trim().length>0)??null,summary:f}}catch(a){return{artifacts:[],error:D(a),failureMessage:null,summary:null}}}async function Y(t,e,r){if(e.length+r.length===0)return null;const s={failures:[...e,...r],phase:"exec"},n=await $(t,"vitest-failure-details.json",Buffer.from(`${JSON.stringify(s,null,2)}
2
- `,"utf8"));return{...await S(n,"application/json","testkit.failure-details","vitest-failure-details",[...e.length===0?[]:[k(e.length,"failed Vitest test")],...r.length===0?[]:[`${k(r.length,"Vitest error")} outside a test`]].join(" and ")),data:s}}function k(t,e){return`${t.toString()} ${e}${t===1?"":"s"}`}async function K(t,e,r,s){let n;try{n=await v(r,s)}catch(c){return{artifacts:[],error:D(c)}}if(!n.exists)return{artifacts:[],error:new Error("Data profile did not produce an artifact manifest")};let a;try{a=W(n.value)}catch(c){return{artifacts:[],error:D(c)}}const i=[],f=new Set;try{if(n.contents===null)throw new Error("Data artifact manifest bytes are unavailable");let c=n.contents.byteLength;if(c>NODE_VITEST_DATA_EVIDENCE_MAX_BYTES)throw new Error(`Data evidence exceeds its ${NODE_VITEST_DATA_EVIDENCE_MAX_BYTES.toString()} byte aggregate limit`);for(const[o,d]of a.artifacts.entries()){const m=await G(t,e,d,o,NODE_VITEST_DATA_EVIDENCE_MAX_BYTES-c,s),{artifact:l}=m,p=`${l.kind}\0${l.name}\0${m.sourcePath}`;if(f.has(p))throw new Error(`Data artifact manifest contains duplicate artifact ${l.name}`);f.add(p);const E=et(l.metadata?.sizeBytes,`Data artifact manifest artifacts[${o.toString()}]`);c+=E,i.push(l)}const u=await $(e,"manifest.json",n.contents);i.push(await S(u,"application/json","engine.data-manifest","data-artifact-manifest",`${i.length.toString()} data artifact(s)`))}catch(c){return{artifacts:i,error:D(c)}}return{artifacts:i,error:null}}function W(t){if(!T(t))throw new Error("Data artifact manifest must contain an object");if(t.schemaVersion!==1)throw new Error("Data artifact manifest schemaVersion must be 1");if(!Array.isArray(t.artifacts))throw new Error("Data artifact manifest artifacts must be an array");if(t.artifacts.length===0)throw new Error("Data artifact manifest must contain at least one artifact");if(t.artifacts.length>N)throw new Error(`Data artifact manifest exceeds the ${N.toString()} artifact limit`);return{artifacts:t.artifacts,schemaVersion:t.schemaVersion}}async function G(t,e,r,s,n,a){const i=`Data artifact manifest artifacts[${s.toString()}]`;if(!T(r))throw new Error(`${i} must contain an object`);const f=g(r.kind,`${i}.kind`),c=g(r.name,`${i}.name`),u=g(r.path,`${i}.path`),o=await Z(t,u,`${i}.path`),d=O(r.contentType,`${i}.contentType`),m=O(r.summary,`${i}.summary`),l=r.metadata===void 0?void 0:A(r.metadata,`${i}.metadata`),{contents:p}=await V(o,NODE_VITEST_DATA_ARTIFACT_MAX_BYTES,i,a);if(p.byteLength>n)throw new Error(`Data evidence exceeds its ${NODE_VITEST_DATA_EVIDENCE_MAX_BYTES.toString()} byte aggregate limit`);const E=H(f,c,d,p,i),R=await $(e,`${s.toString().padStart(4,"0")}-${q(c)}${tt(o)}`,p);return{artifact:{kind:f,name:c,path:R,...d===void 0?{}:{contentType:d},...E===void 0?{}:{data:E},...m===void 0?{}:{summary:m},metadata:{...l??{},sizeBytes:p.byteLength}},sourcePath:o}}function H(t,e,r,s,n){if(t!==_)return;if(e!==F)throw new Error(`${n}.name must be ${JSON.stringify(F)} for ${_}`);if(r!=="application/json")throw new Error(`${n}.contentType must be "application/json" for ${_}`);const a=x(s,n),i=A(a,n);if(P(i,["failures","phase"],n),i.phase!=="exec")throw new Error(`${n}.phase must be "exec"`);if(!Array.isArray(i.failures)||i.failures.length===0)throw new Error(`${n}.failures must be a non-empty array`);for(const[f,c]of i.failures.entries()){const u=`${n}.failures[${f.toString()}]`,o=A(c,u);if(P(o,["actual","checkName","count","expected","groupPath","key","kind","message","title"],u),o.kind!==b)throw new Error(`${u}.kind must be ${JSON.stringify(b)}`);if(o.count!==1)throw new Error(`${u}.count must be 1`);const d=g(o.checkName,`${u}.checkName`),m=g(o.key,`${u}.key`),l=g(o.title,`${u}.title`);if(g(o.message,`${u}.message`),!Array.isArray(o.groupPath)||o.groupPath.length!==1||typeof o.groupPath[0]!="string"||o.groupPath[0].trim().length===0)throw new Error(`${u}.groupPath must contain one scenario name`);if(m!==`${o.groupPath[0]} > ${l}`)throw new Error(`${u}.key does not match its scenario and title`);if(!l.includes(`"${d}"`))throw new Error(`${u}.title does not identify its checkName`)}return i}async function I(t,e,r,s){const n=y.join(t,e);return await w.writeFile(n,s,"utf8"),S(n,"text/plain; charset=utf-8","engine.output",r,nt(s)??"captured output")}async function S(t,e,r,s,n){const a=await w.stat(t);if(!a.isFile())throw new Error(`${s} artifact is not a regular file`);return{contentType:e,kind:r,metadata:{sizeBytes:a.size},name:s,path:t,summary:n}}async function v(t,e){let r;try{({contents:r}=await V(t,J,t,e))}catch(n){if(st(n)&&n.code==="ENOENT")return{contents:null,exists:!1,value:null};throw n}const s=x(r,t);return{contents:r,exists:!0,value:s}}function x(t,e){const r=JSON.parse(t.toString("utf8"));return C(r,e),r}function Q(t){const e={numFailedTests:h(t.numFailedTests,"Vitest native report.summary.numFailedTests"),numPassedTests:h(t.numPassedTests,"Vitest native report.summary.numPassedTests"),numPendingTests:h(t.numPendingTests,"Vitest native report.summary.numPendingTests"),numTodoTests:h(t.numTodoTests,"Vitest native report.summary.numTodoTests"),numTotalTests:h(t.numTotalTests,"Vitest native report.summary.numTotalTests"),numFailedTestSuites:h(t.numFailedTestSuites,"Vitest native report.summary.numFailedTestSuites"),numPassedTestSuites:h(t.numPassedTestSuites,"Vitest native report.summary.numPassedTestSuites"),numPendingTestSuites:h(t.numPendingTestSuites,"Vitest native report.summary.numPendingTestSuites"),numTotalTestSuites:h(t.numTotalTestSuites,"Vitest native report.summary.numTotalTestSuites"),success:rt(t.success,"Vitest native report.summary.success")};if(e.numTotalTests!==e.numFailedTests+e.numPassedTests+e.numPendingTests+e.numTodoTests||e.numTotalTestSuites!==e.numFailedTestSuites+e.numPassedTestSuites+e.numPendingTestSuites||e.success&&(e.numFailedTests>0||e.numFailedTestSuites>0||e.numTotalTestSuites===0))throw new Error("Vitest native report summary contains inconsistent counts or success");return e}async function Z(t,e,r){const s=y.isAbsolute(e)?e:y.resolve(t,e),n=await w.lstat(s);if(!n.isFile()||n.isSymbolicLink())throw new Error(`${r} must be a regular non-symbolic-link file`);const a=await w.realpath(s);if(!it(t,a))throw new Error(`${r} must stay within the task artifact directory`);return a}function q(t){const e=t.trim().toLowerCase().replace(/[^a-z0-9._-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,80);return e.length===0?"artifact":e}function tt(t){const e=y.extname(t).toLowerCase();return/^\.[a-z0-9]{1,12}$/u.test(e)?e:".bin"}function et(t,e){if(typeof t!="number"||!Number.isSafeInteger(t)||t<0)throw new Error(`${e} did not produce a valid sizeBytes identity`);return t}function A(t,e){if(!T(t))throw new Error(`${e} must contain an object`);const r={};for(const[s,n]of Object.entries(t))r[s]=j(n,`${e}.${s}`);return r}function P(t,e,r){const s=Object.keys(t).sort(),n=[...e].sort();if(s.length!==n.length||s.some((a,i)=>a!==n[i]))throw new Error(`${r} must contain exactly ${n.join(", ")}`)}function j(t,e){if(t===null||typeof t=="boolean"||typeof t=="string")return t;if(typeof t=="number"){if(!Number.isFinite(t))throw new Error(`${e} must be finite`);return t}return Array.isArray(t)?t.map((r,s)=>j(r,`${e}[${s.toString()}]`)):A(t,e)}function O(t,e){if(t!==void 0){if(typeof t!="string")throw new Error(`${e} must be a string`);return t}}function g(t,e){if(typeof t!="string"||t.trim().length===0)throw new Error(`${e} must be a non-empty string`);return t}function h(t,e){if(typeof t!="number"||!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative safe integer`);return t}function rt(t,e){if(typeof t!="boolean")throw new Error(`${e} must be boolean`);return t}function nt(t){return t.split(/\r?\n/u).map(e=>e.trim()).find(Boolean)??null}function it(t,e){const r=y.relative(t,e);return r===""||!r.startsWith("..")&&!y.isAbsolute(r)}function T(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function st(t){return t instanceof Error}function D(t){return t instanceof Error?t:new Error(String(t))}
1
+ import y from"node:fs/promises";import w from"node:path";import{evidenceFileAccess as _,readStableEvidenceFile as O,writeOwnedEvidenceFile as $}from"../../adapters/evidence-files.js";import{NODE_VITEST_DATA_FAILURE_DETAILS_ARTIFACT_KIND as W,nodeVitestDataScenarioFile as X}from"../runtime/runtime-input.js";import{dataFlowArtifacts as Y}from"../runtime/data/report.js";import{readVitestReportCases as z,sharedVitestTitles as U,vitestErrorDetails as K,vitestReportErrors as x,vitestTestFailureDetails as q}from"./failure-details.js";import{parseEnvironmentValueMissingFailure as G}from"../../contracts/environment-values.js";import{readNativeReport as D,requireNativeEvidenceJson as H}from"../../adapters/native-report.js";import{isUnknownRecord as g}from"../../../kernel/unknown-values.js";import{toError as N}from"../../../kernel/error-serialization.js";import{isPathWithin as Q}from"../../../process/files/paths.js";import{firstOutputLine as Z}from"../../adapters/execution.js";import{nodeVitestReportOptions as tt}from"./reporter.js";const et=16*1024*1024,k=1024;export const NODE_VITEST_DATA_ARTIFACT_MAX_BYTES=16*1024*1024,NODE_VITEST_DATA_EVIDENCE_MAX_BYTES=64*1024*1024;const rt=".testkit-owned-evidence";export async function collectNodeVitestEvidence(t,e=_){await y.mkdir(t.artifactDirectory,{recursive:!0});const r=await y.realpath(t.artifactDirectory),s=w.join(r,rt);await y.mkdir(s,{mode:448,recursive:!1});const n=[],a=[];t.stdout.length>0&&(a.push({stream:"stdout",text:t.stdout}),n.push(await I(r,"stdout.log","node-vitest-stdout",t.stdout))),t.stderr.length>0&&(a.push({stream:"stderr",text:t.stderr}),n.push(await I(r,"stderr.log","node-vitest-stderr",t.stderr)));const o=await nt(t,s,e);n.push(...o.artifacts);const u=await ot(t,r,s,o.cases,e);return n.push(...u.artifacts),{dataEvidenceError:u.error,environmentFailure:o.environmentFailure,evidence:{artifacts:n,logs:a,metrics:[],...o.summary===null?{}:{native:{vitest:o.summary}}},reportError:o.error,reportErrorCount:o.errorCount,reportFailureMessage:o.failureMessage,reportSummary:o.summary}}async function nt({identity:t,reportFile:e,rootDirectory:r,unhandledErrors:s=[]},n,a){try{const o=await R(e,a);if(!o.exists||o.contents===null)throw new Error("Vitest did not produce its Testkit native report");const u=D(o.value,t).result;if(!g(u)||!g(u.summary))throw new Error("Vitest native report must contain result and summary objects");const f=ut(u.summary),c=z(u.cases,f),l=q(u.failures,r,U(c));if(f.numFailedTests!==l.length)throw new Error("Vitest native report failure count does not match its summary");const h=x(u.errors);if(f.success&&h.length>0)throw new Error("Vitest native report success conflicts with runtime errors");const V=[...h,...s],E=G(u.environmentFailure,"Vitest native report environment failure"),i=await $(n,"testkit-vitest-report.json",E===null?o.contents:Buffer.from(st(o.value))),m=await A(i,"application/json","engine.testkit-vitest-report","testkit-vitest-report","Testkit native Vitest report"),T=await it(n,l,K(V)),p=[m,...T===null?[]:[T]];if(u.pending!==void 0){const v=new Error("Vitest did not finish the file in every project that selects it");return{artifacts:p,cases:c,environmentFailure:null,error:v,errorCount:0,failureMessage:null,summary:null}}return{artifacts:p,cases:c,environmentFailure:E,error:null,errorCount:V.length,failureMessage:typeof l[0]?.message=="string"?l[0].message:V.find(v=>v.message.trim().length>0)?.message??null,summary:f}}catch(o){return{artifacts:[],cases:[],environmentFailure:null,error:N(o),errorCount:0,failureMessage:null,summary:null}}}function st(t){if(!g(t)||!g(t.result))throw new Error("Vitest native report must contain result and summary objects");const e=Object.fromEntries(Object.entries(t.result).filter(([r])=>r!=="environmentFailure"));return JSON.stringify({...t,result:e})}async function it(t,e,r){if(e.length+r.length===0)return null;const s={failures:[...e,...r],phase:"exec"},n=await $(t,"vitest-failure-details.json",Buffer.from(`${JSON.stringify(s,null,2)}
2
+ `,"utf8"));return{...await A(n,"application/json","testkit.failure-details","vitest-failure-details",[...e.length===0?[]:[j(e.length,"failed Vitest test")],...r.length===0?[]:[`${j(r.length,"Vitest error")} outside a test`]].join(" and ")),data:s}}function j(t,e){return`${t.toString()} ${e}${t===1?"":"s"}`}async function ot({dataDirectory:t,identity:e},r,s,n,a){const o=w.dirname(X(t,"")),u=[];try{const c=(await y.readdir(o).catch(i=>{if(M(i)&&i.code==="ENOENT")return[];throw i})).filter(i=>i.endsWith(".json")).sort();if(c.length>k)throw new Error(`Data evidence exceeds its ${k.toString()} test limit`);let l=0;const h=[];for(const i of c){const m=`Data scenario ${i}`,T=await ct(r,w.join(o,i),m),{contents:p}=await O(T,NODE_VITEST_DATA_ARTIFACT_MAX_BYTES,m,a);if(l+=p.byteLength,l>NODE_VITEST_DATA_EVIDENCE_MAX_BYTES)throw new Error(`Data evidence exceeds its ${NODE_VITEST_DATA_EVIDENCE_MAX_BYTES.toString()} byte aggregate limit`);h.push({contents:p,label:m,name:i})}const E=h.flatMap(({contents:i,label:m,name:T})=>{const p=F(b(i,m),m),v=d(p.attempt,`${m}.attempt`),J=d(p.repeat,`${m}.repeat`),B=at(p.scenario,`${m}.scenario`),S=n.find(({id:L})=>L===decodeURIComponent(T.slice(0,-5)));return S!==void 0&&S.state!=="skipped"&&S.attempts===v&&S.repeat===J?[{index:n.indexOf(S),scenario:B}]:[]}).sort((i,m)=>i.index-m.index).map(({scenario:i})=>i);for(const i of E.length===0?[]:Y(E,e.sourceFile,e.taskId)){const m=i.contentType==="text/markdown"?".md":".json",T=await $(s,`${i.name}${m}`,Buffer.from(i.contents,"utf8"));u.push({...await A(T,i.contentType,i.kind,i.name,i.summary),...i.kind===W?{data:F(JSON.parse(i.contents),i.name)}:{}})}}catch(f){return{artifacts:u,error:N(f)}}return{artifacts:u,error:null}}function at(t,e){const r=F(t,e);if(P(r.name,`${e}.name`),P(F(r.location,`${e}.location`).path,`${e}.location.path`),r.status!=="failed"&&r.status!=="passed")throw new Error(`${e}.status must be failed or passed`);const n=["budgetFailures","budgets","events","evidence","findings","metrics","sequences"].find(a=>!Array.isArray(r[a]));if(n!==void 0)throw new Error(`${e}.${n} must be an array`);return r}async function I(t,e,r,s){const n=w.join(t,e);return await y.writeFile(n,s,"utf8"),A(n,"text/plain; charset=utf-8","engine.output",r,Z(s)??"captured output")}async function A(t,e,r,s,n){const a=await y.stat(t);if(!a.isFile())throw new Error(`${s} artifact is not a regular file`);return{contentType:e,kind:r,metadata:{sizeBytes:a.size},name:s,path:t,summary:n}}async function R(t,e){let r;try{({contents:r}=await O(t,et,t,e))}catch(n){if(M(n)&&n.code==="ENOENT")return{contents:null,exists:!1,value:null};throw n}const s=b(r,t);return{contents:r,exists:!0,value:s}}function b(t,e){const r=JSON.parse(t.toString("utf8"));return H(r,e),r}function ut(t){const e={numFailedTests:d(t.numFailedTests,"Vitest native report.summary.numFailedTests"),numPassedTests:d(t.numPassedTests,"Vitest native report.summary.numPassedTests"),numPendingTests:d(t.numPendingTests,"Vitest native report.summary.numPendingTests"),numTodoTests:d(t.numTodoTests,"Vitest native report.summary.numTodoTests"),numTotalTests:d(t.numTotalTests,"Vitest native report.summary.numTotalTests"),numFailedTestSuites:d(t.numFailedTestSuites,"Vitest native report.summary.numFailedTestSuites"),numPassedTestSuites:d(t.numPassedTestSuites,"Vitest native report.summary.numPassedTestSuites"),numPendingTestSuites:d(t.numPendingTestSuites,"Vitest native report.summary.numPendingTestSuites"),numTotalTestSuites:d(t.numTotalTestSuites,"Vitest native report.summary.numTotalTestSuites"),success:mt(t.success,"Vitest native report.summary.success")};if(e.numTotalTests!==e.numFailedTests+e.numPassedTests+e.numPendingTests+e.numTodoTests||e.numTotalTestSuites!==e.numFailedTestSuites+e.numPassedTestSuites+e.numPendingTestSuites||e.success&&(e.numFailedTests>0||e.numFailedTestSuites>0||e.numTotalTestSuites===0))throw new Error("Vitest native report summary contains inconsistent counts or success");return e}async function ct(t,e,r){const s=w.isAbsolute(e)?e:w.resolve(t,e),n=await y.lstat(s);if(!n.isFile()||n.isSymbolicLink())throw new Error(`${r} must be a regular non-symbolic-link file`);const a=await y.realpath(s);if(!Q(t,a))throw new Error(`${r} must stay within the task artifact directory`);return a}function F(t,e){if(!g(t))throw new Error(`${e} must contain an object`);const r={};for(const[s,n]of Object.entries(t))r[s]=C(n,`${e}.${s}`);return r}function C(t,e){if(t===null||typeof t=="boolean"||typeof t=="string")return t;if(typeof t=="number"){if(!Number.isFinite(t))throw new Error(`${e} must be finite`);return t}return Array.isArray(t)?t.map((r,s)=>C(r,`${e}[${s.toString()}]`)):F(t,e)}function P(t,e){if(typeof t!="string"||t.trim().length===0)throw new Error(`${e} must be a non-empty string`);return t}function d(t,e){if(typeof t!="number"||!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative safe integer`);return t}function mt(t,e){if(typeof t!="boolean")throw new Error(`${e} must be boolean`);return t}function M(t){return t instanceof Error}export async function readNodeVitestRunReport(t,e,r=_){try{const{identity:s}=tt(t,{reportFile:e,sourceFile:".",taskId:"run"}),{result:n}=D((await R(e,r)).value,s);if(!g(n)||!Number.isSafeInteger(n.exitCode)||!Array.isArray(n.unhandledErrors))throw new Error("Vitest run report must contain an exit code and unhandled errors");const a=n.unhandledErrors,o=n.failure===void 0?[]:[n.failure];x([...a,...o],"Vitest run report errors");const u=c=>g(c)&&[c.testPath,c.type].every(l=>l===void 0||typeof l=="string"),f=n.afterTests===void 0?[]:n.afterTests;if(!Array.isArray(f)||!f.every(c=>typeof c=="string")||!a.every(u)||!o.every(c=>g(c)&&["close","config","run"].includes(c.phase)))throw new Error("Vitest run report errors are malformed");return n}catch(s){return N(s)}}