@cnc-tools/storm 0.0.0-stage → 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.
- package/bin/node-version.js +24 -0
- package/bin/storm.js +16 -0
- package/dist/application.d.ts +13 -0
- package/dist/application.js +23 -0
- package/dist/bin/storm.d.ts +1 -0
- package/dist/bin/storm.js +45 -0
- package/dist/build-info.js +3 -0
- package/dist/closed-terminal.d.ts +7 -0
- package/dist/closed-terminal.js +18 -0
- package/dist/combine-errors.d.ts +11 -0
- package/dist/combine-errors.js +19 -0
- package/dist/commands/dashboard.d.ts +11 -0
- package/dist/commands/dashboard.js +18 -0
- package/dist/commands/run/cleanup.d.ts +135 -0
- package/dist/commands/run/cleanup.js +171 -0
- package/dist/commands/run/command.d.ts +327 -0
- package/dist/commands/run/command.js +620 -0
- package/dist/commands/run/job-summary.d.ts +6 -0
- package/dist/commands/run/job-summary.js +31 -0
- package/dist/commands/run/live-view.d.ts +22 -0
- package/dist/commands/run/live-view.js +395 -0
- package/dist/commands/run/metadata.d.ts +47 -0
- package/dist/commands/run/metadata.js +83 -0
- package/dist/commands/run/mint-failed.d.ts +11 -0
- package/dist/commands/run/mint-failed.js +33 -0
- package/dist/commands/run/outcomes.d.ts +307 -0
- package/dist/commands/run/outcomes.js +332 -0
- package/dist/commands/run/progress.d.ts +44 -0
- package/dist/commands/run/progress.js +277 -0
- package/dist/commands/run/redaction.d.ts +15 -0
- package/dist/commands/run/redaction.js +40 -0
- package/dist/commands/run/run-collector.d.ts +30 -0
- package/dist/commands/run/run-collector.js +73 -0
- package/dist/commands/run/run-record.d.ts +144 -0
- package/dist/commands/run/run-record.js +96 -0
- package/dist/commands/run/tests-summary.d.ts +34 -0
- package/dist/commands/run/tests-summary.js +141 -0
- package/dist/commands/run/text.d.ts +22 -0
- package/dist/commands/run/text.js +74 -0
- package/dist/commands/run/view.d.ts +35 -0
- package/dist/commands/run/view.js +163 -0
- package/dist/commands/run/waterfall.d.ts +25 -0
- package/dist/commands/run/waterfall.js +108 -0
- package/dist/commands/run/worker-chart.d.ts +79 -0
- package/dist/commands/run/worker-chart.js +313 -0
- package/dist/commands/runs/facts.d.ts +150 -0
- package/dist/commands/runs/facts.js +292 -0
- package/dist/commands/runs/list/command.d.ts +86 -0
- package/dist/commands/runs/list/command.js +36 -0
- package/dist/commands/runs/list/metadata.d.ts +22 -0
- package/dist/commands/runs/list/metadata.js +19 -0
- package/dist/commands/runs/list/outcomes.d.ts +74 -0
- package/dist/commands/runs/list/outcomes.js +89 -0
- package/dist/commands/runs/logs/command.d.ts +72 -0
- package/dist/commands/runs/logs/command.js +51 -0
- package/dist/commands/runs/logs/metadata.d.ts +22 -0
- package/dist/commands/runs/logs/metadata.js +22 -0
- package/dist/commands/runs/logs/outcomes.d.ts +55 -0
- package/dist/commands/runs/logs/outcomes.js +77 -0
- package/dist/commands/runs/metadata.d.ts +3 -0
- package/dist/commands/runs/metadata.js +3 -0
- package/dist/commands/runs/past-run.d.ts +72 -0
- package/dist/commands/runs/past-run.js +99 -0
- package/dist/commands/runs/show/command.d.ts +176 -0
- package/dist/commands/runs/show/command.js +76 -0
- package/dist/commands/runs/show/metadata.d.ts +25 -0
- package/dist/commands/runs/show/metadata.js +22 -0
- package/dist/commands/runs/show/outcomes.d.ts +164 -0
- package/dist/commands/runs/show/outcomes.js +317 -0
- package/dist/config/by-name.d.ts +24 -0
- package/dist/config/by-name.js +26 -0
- package/dist/config/errors.d.ts +58 -0
- package/dist/config/errors.js +101 -0
- package/dist/config/gateways.d.ts +32 -0
- package/dist/config/gateways.js +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.js +12 -0
- package/dist/config/live/config-gateway.d.ts +6 -0
- package/dist/config/live/config-gateway.js +71 -0
- package/dist/config/load.d.ts +54 -0
- package/dist/config/load.js +175 -0
- package/dist/config/resolve.d.ts +49 -0
- package/dist/config/resolve.js +94 -0
- package/dist/config/resource-config.d.ts +132 -0
- package/dist/config/resource-config.js +19 -0
- package/dist/config/schema.d.ts +64 -0
- package/dist/config/schema.js +57 -0
- package/dist/config/set.d.ts +16 -0
- package/dist/config/set.js +55 -0
- package/dist/config/settings-file.d.ts +41 -0
- package/dist/config/settings-file.js +72 -0
- package/dist/config-file/define.d.ts +37 -0
- package/dist/config-file/define.js +9 -0
- package/dist/config-file/toolchain.d.ts +9 -0
- package/dist/config-file/toolchain.js +41 -0
- package/dist/context.d.ts +86 -0
- package/dist/context.js +43 -0
- package/dist/core/command-provider.d.ts +126 -0
- package/dist/core/command-provider.js +13 -0
- package/dist/core/command-slots.d.ts +67 -0
- package/dist/core/command-slots.js +136 -0
- package/dist/core/events.d.ts +128 -0
- package/dist/core/events.js +15 -0
- package/dist/core/gateways.d.ts +249 -0
- package/dist/core/gateways.js +1 -0
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.js +18 -0
- package/dist/core/keyed.d.ts +12 -0
- package/dist/core/keyed.js +24 -0
- package/dist/core/lane.d.ts +46 -0
- package/dist/core/lane.js +5 -0
- package/dist/core/limit.d.ts +9 -0
- package/dist/core/limit.js +29 -0
- package/dist/core/live/command-gateway.d.ts +11 -0
- package/dist/core/live/command-gateway.js +83 -0
- package/dist/core/live/job-summary-gateway.d.ts +5 -0
- package/dist/core/live/job-summary-gateway.js +20 -0
- package/dist/core/live/progress-terminal.d.ts +20 -0
- package/dist/core/live/progress-terminal.js +173 -0
- package/dist/core/live/run-directory-gateway.d.ts +24 -0
- package/dist/core/live/run-directory-gateway.js +437 -0
- package/dist/core/mint.d.ts +10 -0
- package/dist/core/mint.js +14 -0
- package/dist/core/payload.d.ts +26 -0
- package/dist/core/payload.js +33 -0
- package/dist/core/presentation.d.ts +87 -0
- package/dist/core/presentation.js +5 -0
- package/dist/core/presentations.d.ts +56 -0
- package/dist/core/presentations.js +66 -0
- package/dist/core/provider.d.ts +69 -0
- package/dist/core/provider.js +5 -0
- package/dist/core/resource.d.ts +262 -0
- package/dist/core/resource.js +6 -0
- package/dist/core/resources.d.ts +131 -0
- package/dist/core/resources.js +254 -0
- package/dist/core/run-directory.d.ts +69 -0
- package/dist/core/run-directory.js +94 -0
- package/dist/core/run-state.d.ts +152 -0
- package/dist/core/run-state.js +313 -0
- package/dist/core/run.d.ts +187 -0
- package/dist/core/run.js +321 -0
- package/dist/core/state-directory.d.ts +19 -0
- package/dist/core/state-directory.js +29 -0
- package/dist/core/timeline.d.ts +63 -0
- package/dist/core/timeline.js +97 -0
- package/dist/core/timing.d.ts +22 -0
- package/dist/core/timing.js +26 -0
- package/dist/credential/credential.d.ts +46 -0
- package/dist/credential/credential.js +80 -0
- package/dist/credential/diagnosis.d.ts +18 -0
- package/dist/credential/diagnosis.js +99 -0
- package/dist/credential/gateways.d.ts +109 -0
- package/dist/credential/gateways.js +1 -0
- package/dist/credential/index.d.ts +7 -0
- package/dist/credential/index.js +7 -0
- package/dist/credential/live/github-actions-token-gateway.d.ts +15 -0
- package/dist/credential/live/github-actions-token-gateway.js +43 -0
- package/dist/credential/live/github-actions-token-response.d.ts +19 -0
- package/dist/credential/live/github-actions-token-response.js +49 -0
- package/dist/credential/live/vercel-cli-gateway.d.ts +9 -0
- package/dist/credential/live/vercel-cli-gateway.js +64 -0
- package/dist/credential/live/vercel-output.d.ts +60 -0
- package/dist/credential/live/vercel-output.js +122 -0
- package/dist/credential/live/vercel-process.d.ts +14 -0
- package/dist/credential/live/vercel-process.js +3 -0
- package/dist/credential/settle.d.ts +31 -0
- package/dist/credential/settle.js +49 -0
- package/dist/credential/source.d.ts +110 -0
- package/dist/credential/source.js +114 -0
- package/dist/help-logo.d.ts +11 -0
- package/dist/help-logo.js +56 -0
- package/dist/presentation.d.ts +26 -0
- package/dist/presentation.js +21 -0
- package/dist/resources/github/cleanup.d.ts +23 -0
- package/dist/resources/github/cleanup.js +39 -0
- package/dist/resources/github/command.d.ts +74 -0
- package/dist/resources/github/command.js +117 -0
- package/dist/resources/github/config.d.ts +16 -0
- package/dist/resources/github/config.js +37 -0
- package/dist/resources/github/events.d.ts +26 -0
- package/dist/resources/github/events.js +2 -0
- package/dist/resources/github/fixture-repo.d.ts +69 -0
- package/dist/resources/github/fixture-repo.js +60 -0
- package/dist/resources/github/gateways.d.ts +62 -0
- package/dist/resources/github/gateways.js +1 -0
- package/dist/resources/github/index.d.ts +12 -0
- package/dist/resources/github/index.js +15 -0
- package/dist/resources/github/live/fixture-repo-gateway.d.ts +12 -0
- package/dist/resources/github/live/fixture-repo-gateway.js +92 -0
- package/dist/resources/github/live/gateways.d.ts +6 -0
- package/dist/resources/github/live/gateways.js +13 -0
- package/dist/resources/github/presentation.d.ts +13 -0
- package/dist/resources/github/presentation.js +43 -0
- package/dist/resources/github/provider.d.ts +66 -0
- package/dist/resources/github/provider.js +58 -0
- package/dist/resources/github/resource-provider.d.ts +6 -0
- package/dist/resources/github/resource-provider.js +20 -0
- package/dist/resources/github/resource.d.ts +33 -0
- package/dist/resources/github/resource.js +12 -0
- package/dist/resources/testserver/cleanup.d.ts +14 -0
- package/dist/resources/testserver/cleanup.js +22 -0
- package/dist/resources/testserver/command.d.ts +322 -0
- package/dist/resources/testserver/command.js +245 -0
- package/dist/resources/testserver/commands/app.d.ts +18 -0
- package/dist/resources/testserver/commands/app.js +3 -0
- package/dist/resources/testserver/commands/create/command.d.ts +136 -0
- package/dist/resources/testserver/commands/create/command.js +158 -0
- package/dist/resources/testserver/commands/create/metadata.d.ts +31 -0
- package/dist/resources/testserver/commands/create/metadata.js +45 -0
- package/dist/resources/testserver/commands/create/outcomes.d.ts +111 -0
- package/dist/resources/testserver/commands/create/outcomes.js +172 -0
- package/dist/resources/testserver/commands/list/command.d.ts +60 -0
- package/dist/resources/testserver/commands/list/command.js +56 -0
- package/dist/resources/testserver/commands/list/metadata.d.ts +9 -0
- package/dist/resources/testserver/commands/list/metadata.js +9 -0
- package/dist/resources/testserver/commands/list/outcomes.d.ts +54 -0
- package/dist/resources/testserver/commands/list/outcomes.js +152 -0
- package/dist/resources/testserver/config.d.ts +18 -0
- package/dist/resources/testserver/config.js +77 -0
- package/dist/resources/testserver/credential-facts.d.ts +80 -0
- package/dist/resources/testserver/credential-facts.js +83 -0
- package/dist/resources/testserver/events.d.ts +59 -0
- package/dist/resources/testserver/events.js +4 -0
- package/dist/resources/testserver/index.d.ts +16 -0
- package/dist/resources/testserver/index.js +24 -0
- package/dist/resources/testserver/lane.d.ts +28 -0
- package/dist/resources/testserver/lane.js +139 -0
- package/dist/resources/testserver/live/gateways.d.ts +6 -0
- package/dist/resources/testserver/live/gateways.js +26 -0
- package/dist/resources/testserver/options.d.ts +5 -0
- package/dist/resources/testserver/options.js +5 -0
- package/dist/resources/testserver/pool/channels.d.ts +80 -0
- package/dist/resources/testserver/pool/channels.js +48 -0
- package/dist/resources/testserver/pool/create.d.ts +48 -0
- package/dist/resources/testserver/pool/create.js +45 -0
- package/dist/resources/testserver/pool/directory.d.ts +4 -0
- package/dist/resources/testserver/pool/directory.js +5 -0
- package/dist/resources/testserver/pool/gateways.d.ts +190 -0
- package/dist/resources/testserver/pool/gateways.js +1 -0
- package/dist/resources/testserver/pool/host.d.ts +8 -0
- package/dist/resources/testserver/pool/host.js +21 -0
- package/dist/resources/testserver/pool/index.d.ts +9 -0
- package/dist/resources/testserver/pool/index.js +10 -0
- package/dist/resources/testserver/pool/inspect.d.ts +53 -0
- package/dist/resources/testserver/pool/inspect.js +45 -0
- package/dist/resources/testserver/pool/lease.d.ts +84 -0
- package/dist/resources/testserver/pool/lease.js +125 -0
- package/dist/resources/testserver/pool/live/pool-records.d.ts +17 -0
- package/dist/resources/testserver/pool/live/pool-records.js +70 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +12 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.js +435 -0
- package/dist/resources/testserver/pool/staleness.d.ts +16 -0
- package/dist/resources/testserver/pool/staleness.js +27 -0
- package/dist/resources/testserver/presentation.d.ts +9 -0
- package/dist/resources/testserver/presentation.js +217 -0
- package/dist/resources/testserver/provider.d.ts +177 -0
- package/dist/resources/testserver/provider.js +254 -0
- package/dist/resources/testserver/ran.d.ts +87 -0
- package/dist/resources/testserver/ran.js +140 -0
- package/dist/resources/testserver/resource-provider.d.ts +12 -0
- package/dist/resources/testserver/resource-provider.js +38 -0
- package/dist/resources/testserver/resource.d.ts +32 -0
- package/dist/resources/testserver/resource.js +10 -0
- package/dist/resources/testserver/run-sandbox.d.ts +13 -0
- package/dist/resources/testserver/run-sandbox.js +6 -0
- package/dist/resources/testserver/sandbox/channels.d.ts +12 -0
- package/dist/resources/testserver/sandbox/channels.js +21 -0
- package/dist/resources/testserver/sandbox/create-failure.d.ts +35 -0
- package/dist/resources/testserver/sandbox/create-failure.js +65 -0
- package/dist/resources/testserver/sandbox/create.d.ts +29 -0
- package/dist/resources/testserver/sandbox/create.js +37 -0
- package/dist/resources/testserver/sandbox/gateways.d.ts +150 -0
- package/dist/resources/testserver/sandbox/gateways.js +1 -0
- package/dist/resources/testserver/sandbox/index.d.ts +6 -0
- package/dist/resources/testserver/sandbox/index.js +7 -0
- package/dist/resources/testserver/sandbox/live/builds-response.d.ts +9 -0
- package/dist/resources/testserver/sandbox/live/builds-response.js +27 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.d.ts +17 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.js +133 -0
- package/dist/resources/testserver/sandbox/live/create-response.d.ts +35 -0
- package/dist/resources/testserver/sandbox/live/create-response.js +78 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.d.ts +24 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.js +45 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.d.ts +11 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.js +36 -0
- package/dist/resources/testserver/sandbox/live/sse.d.ts +12 -0
- package/dist/resources/testserver/sandbox/live/sse.js +32 -0
- package/dist/resources.d.ts +452 -0
- package/dist/resources.js +88 -0
- package/dist/runner/base.d.ts +40 -0
- package/dist/runner/base.js +52 -0
- package/dist/runner/context.d.ts +13 -0
- package/dist/runner/context.js +9 -0
- package/dist/runner/events.d.ts +179 -0
- package/dist/runner/events.js +16 -0
- package/dist/runner/gateways.d.ts +351 -0
- package/dist/runner/gateways.js +3 -0
- package/dist/runner/index.d.ts +19 -0
- package/dist/runner/index.js +18 -0
- package/dist/runner/live/checkout-gateway.d.ts +3 -0
- package/dist/runner/live/checkout-gateway.js +206 -0
- package/dist/runner/live/git-output.d.ts +14 -0
- package/dist/runner/live/git-output.js +32 -0
- package/dist/runner/live/sandbox-errors.d.ts +7 -0
- package/dist/runner/live/sandbox-errors.js +21 -0
- package/dist/runner/live/sandbox-gateway.d.ts +7 -0
- package/dist/runner/live/sandbox-gateway.js +427 -0
- package/dist/runner/live/snapshot-cache-gateway.d.ts +12 -0
- package/dist/runner/live/snapshot-cache-gateway.js +104 -0
- package/dist/runner/live/snapshot-records.d.ts +11 -0
- package/dist/runner/live/snapshot-records.js +57 -0
- package/dist/runner/live/terminal.d.ts +16 -0
- package/dist/runner/live/terminal.js +37 -0
- package/dist/runner/live/user.d.ts +2 -0
- package/dist/runner/live/user.js +11 -0
- package/dist/runner/output.d.ts +23 -0
- package/dist/runner/output.js +58 -0
- package/dist/runner/prepare.d.ts +67 -0
- package/dist/runner/prepare.js +59 -0
- package/dist/runner/ready.d.ts +68 -0
- package/dist/runner/ready.js +159 -0
- package/dist/runner/recipe.d.ts +126 -0
- package/dist/runner/recipe.js +302 -0
- package/dist/runner/remote-command.d.ts +77 -0
- package/dist/runner/remote-command.js +127 -0
- package/dist/runner/scope.d.ts +58 -0
- package/dist/runner/scope.js +117 -0
- package/dist/runner/snapshot-build.d.ts +33 -0
- package/dist/runner/snapshot-build.js +112 -0
- package/dist/runner/snapshot-cache.d.ts +84 -0
- package/dist/runner/snapshot-cache.js +126 -0
- package/dist/runner/snapshot-key.d.ts +52 -0
- package/dist/runner/snapshot-key.js +91 -0
- package/dist/runner/steps.d.ts +41 -0
- package/dist/runner/steps.js +49 -0
- package/dist/sdk/container/api-request.d.ts +32 -0
- package/dist/sdk/container/api-request.js +46 -0
- package/dist/sdk/container/container.d.ts +144 -0
- package/dist/sdk/container/container.js +346 -0
- package/dist/sdk/container/feature-flags.d.ts +37 -0
- package/dist/sdk/container/feature-flags.js +118 -0
- package/dist/sdk/container/gateways.d.ts +108 -0
- package/dist/sdk/container/gateways.js +1 -0
- package/dist/sdk/container/index.d.ts +5 -0
- package/dist/sdk/container/index.js +5 -0
- package/dist/sdk/container/live/container-gateway.d.ts +17 -0
- package/dist/sdk/container/live/container-gateway.js +114 -0
- package/dist/sdk/factories/build.d.ts +66 -0
- package/dist/sdk/factories/build.js +98 -0
- package/dist/sdk/factories/definition.d.ts +28 -0
- package/dist/sdk/factories/definition.js +16 -0
- package/dist/sdk/factories/definitions.d.ts +166 -0
- package/dist/sdk/factories/definitions.js +235 -0
- package/dist/sdk/factories/gateways.d.ts +25 -0
- package/dist/sdk/factories/gateways.js +1 -0
- package/dist/sdk/factories/index.d.ts +5 -0
- package/dist/sdk/factories/index.js +5 -0
- package/dist/sdk/factories/live/factory-gateway.d.ts +10 -0
- package/dist/sdk/factories/live/factory-gateway.js +29 -0
- package/dist/sdk/index.d.ts +7 -0
- package/dist/sdk/index.js +15 -0
- package/dist/sdk/payload/index.d.ts +2 -0
- package/dist/sdk/payload/index.js +4 -0
- package/dist/sdk/payload/payload.d.ts +47 -0
- package/dist/sdk/payload/payload.js +74 -0
- package/dist/sdk/payload/test-events.d.ts +102 -0
- package/dist/sdk/payload/test-events.js +59 -0
- package/dist/sdk/proxy/exchange.d.ts +58 -0
- package/dist/sdk/proxy/exchange.js +173 -0
- package/dist/sdk/proxy/faulted-exchange.d.ts +10 -0
- package/dist/sdk/proxy/faulted-exchange.js +106 -0
- package/dist/sdk/proxy/faults.d.ts +133 -0
- package/dist/sdk/proxy/faults.js +147 -0
- package/dist/sdk/proxy/index.d.ts +3 -0
- package/dist/sdk/proxy/index.js +3 -0
- package/dist/sdk/proxy/proxy.d.ts +93 -0
- package/dist/sdk/proxy/proxy.js +99 -0
- package/dist/sdk/proxy/records.d.ts +56 -0
- package/dist/sdk/proxy/records.js +56 -0
- package/dist/sdk/records/body.d.ts +89 -0
- package/dist/sdk/records/body.js +236 -0
- package/dist/sdk/records/index.d.ts +2 -0
- package/dist/sdk/records/index.js +4 -0
- package/dist/sdk/records/records.d.ts +49 -0
- package/dist/sdk/records/records.js +16 -0
- package/dist/sdk/seed/index.d.ts +1 -0
- package/dist/sdk/seed/index.js +3 -0
- package/dist/sdk/seed/seed.d.ts +221 -0
- package/dist/sdk/seed/seed.js +171 -0
- package/dist/sdk/testserver/clock.d.ts +8 -0
- package/dist/sdk/testserver/clock.js +10 -0
- package/dist/sdk/testserver/failure.d.ts +73 -0
- package/dist/sdk/testserver/failure.js +61 -0
- package/dist/sdk/testserver/index.d.ts +5 -0
- package/dist/sdk/testserver/index.js +8 -0
- package/dist/sdk/testserver/live/connect-failure.d.ts +7 -0
- package/dist/sdk/testserver/live/connect-failure.js +30 -0
- package/dist/sdk/testserver/live/request.d.ts +69 -0
- package/dist/sdk/testserver/live/request.js +89 -0
- package/dist/sdk/testserver/service-ids.d.ts +19 -0
- package/dist/sdk/testserver/service-ids.js +77 -0
- package/dist/sdk/testserver/test-id.d.ts +15 -0
- package/dist/sdk/testserver/test-id.js +28 -0
- package/dist/story/align.d.ts +37 -0
- package/dist/story/align.js +39 -0
- package/dist/story/artifact.d.ts +60 -0
- package/dist/story/artifact.js +93 -0
- package/dist/story/definition.d.ts +52 -0
- package/dist/story/definition.js +9 -0
- package/dist/story/diff.d.ts +9 -0
- package/dist/story/diff.js +97 -0
- package/dist/story/errors.d.ts +14 -0
- package/dist/story/errors.js +21 -0
- package/dist/story/gateways.d.ts +74 -0
- package/dist/story/gateways.js +3 -0
- package/dist/story/host.d.ts +27 -0
- package/dist/story/host.js +97 -0
- package/dist/story/index.d.ts +7 -0
- package/dist/story/index.js +9 -0
- package/dist/story/json.d.ts +16 -0
- package/dist/story/json.js +59 -0
- package/dist/story/live/artifact-gateway.d.ts +2 -0
- package/dist/story/live/artifact-gateway.js +82 -0
- package/dist/story/mode.d.ts +17 -0
- package/dist/story/mode.js +21 -0
- package/dist/story/orphans.d.ts +17 -0
- package/dist/story/orphans.js +15 -0
- package/dist/story/report.d.ts +30 -0
- package/dist/story/report.js +118 -0
- package/dist/story/run.d.ts +49 -0
- package/dist/story/run.js +160 -0
- package/dist/story/sequence.d.ts +30 -0
- package/dist/story/sequence.js +74 -0
- package/dist/story/settle.d.ts +94 -0
- package/dist/story/settle.js +70 -0
- package/dist/time/duration.d.ts +19 -0
- package/dist/time/duration.js +37 -0
- package/dist/time/index.d.ts +2 -0
- package/dist/time/index.js +4 -0
- package/dist/time/time.d.ts +15 -0
- package/dist/time/time.js +23 -0
- package/dist/vercel-cli/ansi.d.ts +13 -0
- package/dist/vercel-cli/ansi.js +32 -0
- package/dist/vercel-cli/arguments.d.ts +25 -0
- package/dist/vercel-cli/arguments.js +78 -0
- package/dist/vercel-cli/auth-config.d.ts +43 -0
- package/dist/vercel-cli/auth-config.js +36 -0
- package/dist/vercel-cli/clock.d.ts +9 -0
- package/dist/vercel-cli/clock.js +10 -0
- package/dist/vercel-cli/config-files.d.ts +24 -0
- package/dist/vercel-cli/config-files.js +40 -0
- package/dist/vercel-cli/context.d.ts +12 -0
- package/dist/vercel-cli/context.js +12 -0
- package/dist/vercel-cli/driver.d.ts +218 -0
- package/dist/vercel-cli/driver.js +364 -0
- package/dist/vercel-cli/entry.d.ts +8 -0
- package/dist/vercel-cli/entry.js +13 -0
- package/dist/vercel-cli/environment.d.ts +33 -0
- package/dist/vercel-cli/environment.js +72 -0
- package/dist/vercel-cli/errors.d.ts +8 -0
- package/dist/vercel-cli/errors.js +8 -0
- package/dist/vercel-cli/gateways.d.ts +103 -0
- package/dist/vercel-cli/gateways.js +4 -0
- package/dist/vercel-cli/index.d.ts +10 -0
- package/dist/vercel-cli/index.js +15 -0
- package/dist/vercel-cli/invocation.d.ts +234 -0
- package/dist/vercel-cli/invocation.js +397 -0
- package/dist/vercel-cli/keys.d.ts +14 -0
- package/dist/vercel-cli/keys.js +12 -0
- package/dist/vercel-cli/live/config-files.d.ts +28 -0
- package/dist/vercel-cli/live/config-files.js +66 -0
- package/dist/vercel-cli/live/process-gateway.d.ts +14 -0
- package/dist/vercel-cli/live/process-gateway.js +178 -0
- package/dist/vercel-cli/redaction.d.ts +13 -0
- package/dist/vercel-cli/redaction.js +22 -0
- package/dist/vercel-cli/report.d.ts +22 -0
- package/dist/vercel-cli/report.js +110 -0
- package/dist/vercel-cli/verbose.d.ts +7 -0
- package/dist/vercel-cli/verbose.js +24 -0
- package/dist/version.d.ts +20 -0
- package/dist/version.js +57 -0
- package/dist/vitest/config.d.ts +51 -0
- package/dist/vitest/config.js +61 -0
- package/dist/vitest/container-scope.d.ts +108 -0
- package/dist/vitest/container-scope.js +234 -0
- package/dist/vitest/diagnostics.d.ts +146 -0
- package/dist/vitest/diagnostics.js +306 -0
- package/dist/vitest/fixtures.d.ts +64 -0
- package/dist/vitest/fixtures.js +172 -0
- package/dist/vitest/gateways.d.ts +47 -0
- package/dist/vitest/gateways.js +3 -0
- package/dist/vitest/index.d.ts +3 -0
- package/dist/vitest/index.js +9 -0
- package/dist/vitest/list-output.d.ts +3 -0
- package/dist/vitest/list-output.js +19 -0
- package/dist/vitest/live/list-gateway.d.ts +7 -0
- package/dist/vitest/live/list-gateway.js +60 -0
- package/dist/vitest/ownership.d.ts +29 -0
- package/dist/vitest/ownership.js +68 -0
- package/dist/vitest/plan.d.ts +33 -0
- package/dist/vitest/plan.js +73 -0
- package/dist/vitest/sandbox.d.ts +16 -0
- package/dist/vitest/sandbox.js +35 -0
- package/dist/vitest/test-events.d.ts +41 -0
- package/dist/vitest/test-events.js +92 -0
- package/dist/vitest/test-results.d.ts +84 -0
- package/dist/vitest/test-results.js +160 -0
- package/dist/vitest/types.d.ts +68 -0
- package/dist/vitest/types.js +4 -0
- package/package.json +123 -4
- package/skills/overview.md +32 -0
- package/skills/read-run-output.md +65 -0
- package/README.md +0 -3
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { readVitestList } from "../list-output.js";
|
|
3
|
+
/**
|
|
4
|
+
* The live list gateway: spawns `vitest list --json <args>` from `PATH`, no shell, in `cwd`, with stdin ignored,
|
|
5
|
+
* and kills it after `timeoutMs` (`AbortSignal.timeout`). An `error` before the process exits is a start failure,
|
|
6
|
+
* unless the timeout caused it.
|
|
7
|
+
*/
|
|
8
|
+
export const liveVitestListGateway = {
|
|
9
|
+
listTests(request) {
|
|
10
|
+
return new Promise((resolve) => {
|
|
11
|
+
let settled = false;
|
|
12
|
+
const settle = (result) => {
|
|
13
|
+
if (settled)
|
|
14
|
+
return;
|
|
15
|
+
settled = true;
|
|
16
|
+
resolve(result);
|
|
17
|
+
};
|
|
18
|
+
const child = spawn("vitest", ["list", "--json", ...request.args], {
|
|
19
|
+
...(request.cwd === undefined ? {} : { cwd: request.cwd }),
|
|
20
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
21
|
+
signal: AbortSignal.timeout(request.timeoutMs),
|
|
22
|
+
});
|
|
23
|
+
let stdout = "";
|
|
24
|
+
let stderr = "";
|
|
25
|
+
child.stdout.setEncoding("utf8").on("data", (chunk) => {
|
|
26
|
+
stdout += chunk;
|
|
27
|
+
});
|
|
28
|
+
child.stderr.setEncoding("utf8").on("data", (chunk) => {
|
|
29
|
+
stderr += chunk;
|
|
30
|
+
});
|
|
31
|
+
child.on("error", (error) => {
|
|
32
|
+
settle(error.name === "AbortError"
|
|
33
|
+
? { ok: false, failure: { kind: "timed-out", timeoutMs: request.timeoutMs } }
|
|
34
|
+
: { ok: false, failure: { kind: "start-failed", message: error.message } });
|
|
35
|
+
});
|
|
36
|
+
child.on("close", (exitCode, signal) => {
|
|
37
|
+
if (exitCode !== 0) {
|
|
38
|
+
settle({ ok: false, failure: { kind: "exited", exitCode, signal, lastStderrLine: lastLine(stderr) } });
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
settle({ ok: true, tests: readVitestList(stdout) });
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
settle({ ok: false, failure: { kind: "unreadable-output", message: error.message } });
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The last line of `text` that is neither blank nor a stack frame (`at …`), trimmed, so an error's stack leaves its
|
|
53
|
+
* message; empty when there is none.
|
|
54
|
+
*/
|
|
55
|
+
function lastLine(text) {
|
|
56
|
+
return (text
|
|
57
|
+
.split(/\r?\n/)
|
|
58
|
+
.map((line) => line.trim())
|
|
59
|
+
.findLast((line) => line !== "" && !/^at\s/.test(line)) ?? "");
|
|
60
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Acquires a resource for a fixture and makes sure it is disposed even when the test ends first.
|
|
3
|
+
*
|
|
4
|
+
* Vitest can time a test out and drain its fixture cleanups while an acquisition is still in flight, so a
|
|
5
|
+
* resource that arrives after that would never be disposed. Here, once `acquire` settles: if `signal` has aborted,
|
|
6
|
+
* the resource is disposed at once and never handed out, and this rejects with `signal.reason`; otherwise its
|
|
7
|
+
* disposal is registered with `onCleanup` and the resource returned. The check and the registration run with no
|
|
8
|
+
* await between them, so a cleanup drain can't slip in. When the late disposal fails too, this throws an
|
|
9
|
+
* `AggregateError` holding both, the abort reason first and as its `cause`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function acquireOwned<T>(signal: AbortSignal, onCleanup: (cleanup: () => Promise<void>) => void, acquire: () => Promise<T>, dispose: (resource: T) => Promise<void>): Promise<T>;
|
|
12
|
+
/**
|
|
13
|
+
* The acquisitions a test file has in flight. Vitest ends a file's worker once its tests and cleanups are done, so
|
|
14
|
+
* a resource still starting when its test timed out would be left behind with the worker. A file-scoped fixture
|
|
15
|
+
* calls `settle` in its cleanup, which Vitest awaits before the file finishes.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Acquisitions {
|
|
18
|
+
#private;
|
|
19
|
+
/**
|
|
20
|
+
* Tracks `acquisition`, an `acquireOwned` for the test whose signal is `signal`, and returns it unchanged. If it
|
|
21
|
+
* rejects after the test aborted with anything but the abort reason, `settle` throws that.
|
|
22
|
+
*/
|
|
23
|
+
track<T>(signal: AbortSignal, acquisition: Promise<T>): Promise<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Waits for every tracked acquisition to settle, then throws what any rejected with after its test aborted (one
|
|
26
|
+
* error as is, several in an `AggregateError`), since that may have left a resource behind.
|
|
27
|
+
*/
|
|
28
|
+
settle(): Promise<void>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Acquires a resource for a fixture and makes sure it is disposed even when the test ends first.
|
|
3
|
+
*
|
|
4
|
+
* Vitest can time a test out and drain its fixture cleanups while an acquisition is still in flight, so a
|
|
5
|
+
* resource that arrives after that would never be disposed. Here, once `acquire` settles: if `signal` has aborted,
|
|
6
|
+
* the resource is disposed at once and never handed out, and this rejects with `signal.reason`; otherwise its
|
|
7
|
+
* disposal is registered with `onCleanup` and the resource returned. The check and the registration run with no
|
|
8
|
+
* await between them, so a cleanup drain can't slip in. When the late disposal fails too, this throws an
|
|
9
|
+
* `AggregateError` holding both, the abort reason first and as its `cause`.
|
|
10
|
+
*/
|
|
11
|
+
export async function acquireOwned(signal, onCleanup, acquire, dispose) {
|
|
12
|
+
const resource = await acquire();
|
|
13
|
+
if (signal.aborted) {
|
|
14
|
+
const reason = signal.reason;
|
|
15
|
+
try {
|
|
16
|
+
await dispose(resource);
|
|
17
|
+
}
|
|
18
|
+
catch (disposeError) {
|
|
19
|
+
// oxlint-disable-next-line eslint/preserve-caught-error -- the abort reason is the documented `cause`; `disposeError` is in `errors`.
|
|
20
|
+
throw new AggregateError([reason, disposeError], `${messageOf(reason)}; disposing what the fixture acquired late also failed: ${messageOf(disposeError)}`, { cause: reason });
|
|
21
|
+
}
|
|
22
|
+
throw reason;
|
|
23
|
+
}
|
|
24
|
+
onCleanup(() => dispose(resource));
|
|
25
|
+
return resource;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The acquisitions a test file has in flight. Vitest ends a file's worker once its tests and cleanups are done, so
|
|
29
|
+
* a resource still starting when its test timed out would be left behind with the worker. A file-scoped fixture
|
|
30
|
+
* calls `settle` in its cleanup, which Vitest awaits before the file finishes.
|
|
31
|
+
*/
|
|
32
|
+
export class Acquisitions {
|
|
33
|
+
#inFlight = new Set();
|
|
34
|
+
#lateFailures = [];
|
|
35
|
+
/**
|
|
36
|
+
* Tracks `acquisition`, an `acquireOwned` for the test whose signal is `signal`, and returns it unchanged. If it
|
|
37
|
+
* rejects after the test aborted with anything but the abort reason, `settle` throws that.
|
|
38
|
+
*/
|
|
39
|
+
track(signal, acquisition) {
|
|
40
|
+
const settled = acquisition
|
|
41
|
+
.then(() => { }, (error) => {
|
|
42
|
+
if (signal.aborted && error !== signal.reason)
|
|
43
|
+
this.#lateFailures.push(error);
|
|
44
|
+
})
|
|
45
|
+
.finally(() => {
|
|
46
|
+
this.#inFlight.delete(settled);
|
|
47
|
+
});
|
|
48
|
+
this.#inFlight.add(settled);
|
|
49
|
+
return acquisition;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Waits for every tracked acquisition to settle, then throws what any rejected with after its test aborted (one
|
|
53
|
+
* error as is, several in an `AggregateError`), since that may have left a resource behind.
|
|
54
|
+
*/
|
|
55
|
+
async settle() {
|
|
56
|
+
while (this.#inFlight.size > 0)
|
|
57
|
+
await Promise.all(this.#inFlight);
|
|
58
|
+
const failures = this.#lateFailures.splice(0);
|
|
59
|
+
if (failures.length === 1)
|
|
60
|
+
throw failures[0];
|
|
61
|
+
if (failures.length > 1) {
|
|
62
|
+
throw new AggregateError(failures, `${failures.length} fixtures failed after their tests ended: ${failures.map(messageOf).join("; ")}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function messageOf(error) {
|
|
67
|
+
return error instanceof Error ? error.message : String(error);
|
|
68
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { VitestListGateway } from "./gateways.ts";
|
|
2
|
+
/** How long `listVitestTests` lets `vitest list` run by default. */
|
|
3
|
+
export declare const LIST_TIMEOUT_MS = 60000;
|
|
4
|
+
/** How many tests a Vitest run would run, and in how many files. */
|
|
5
|
+
export interface TestPlan {
|
|
6
|
+
readonly tests: number;
|
|
7
|
+
readonly files: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ListVitestTestsOptions {
|
|
10
|
+
/** Passed after `vitest list --json`, as `vitest run` takes them, such as `["--project", "testserver"]`. */
|
|
11
|
+
readonly args: readonly string[];
|
|
12
|
+
/** Where vitest runs; default the current directory. */
|
|
13
|
+
readonly cwd?: string;
|
|
14
|
+
/** How long `vitest list` may take; default `LIST_TIMEOUT_MS`, 60s. */
|
|
15
|
+
readonly timeoutMs?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Lists the tests `vitest run <args>` would run, with `vitest list --json <args>` from `PATH`, and counts them.
|
|
19
|
+
* Rejects with an `Error` saying why when `vitest` fails to start, doesn't finish within `timeoutMs`, exits other
|
|
20
|
+
* than 0 (with the last line of its stderr that isn't a stack frame), or prints something other than a list of tests.
|
|
21
|
+
*/
|
|
22
|
+
export declare function listVitestTests(options: ListVitestTestsOptions, gateway?: VitestListGateway): Promise<TestPlan>;
|
|
23
|
+
/** The plan `vitest list --json` printed: its tests, and their distinct files. Throws when it isn't a list of tests. */
|
|
24
|
+
export declare function parseVitestList(stdout: string): TestPlan;
|
|
25
|
+
/** A plan as a phrase, such as `65 tests in 19 files` or `1 test in 1 file`. */
|
|
26
|
+
export declare function formatPlan(plan: TestPlan): string;
|
|
27
|
+
/**
|
|
28
|
+
* The Testserver sandboxes to ask `storm run --set resources.testserverPool.sandboxes=<n>` for: one per
|
|
29
|
+
* `workersPerSandbox` files (default `WORKERS_PER_SANDBOX`, 4, as `testserverWorkers` sizes `maxWorkers`), at least
|
|
30
|
+
* 1 and at most `max`. A file's tests run in one worker, so more sandboxes than that would sit idle. Throws a `TypeError` unless `files` is a
|
|
31
|
+
* non-negative integer and `max` and `workersPerSandbox` are positive integers.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sandboxesFor(files: number, max: number, workersPerSandbox?: number): number;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// The test count of a Vitest run, exported as `@cnc-tools/storm/vitest/plan`, for a launcher that sizes
|
|
2
|
+
// `storm run --set resources.testserverPool.sandboxes=<n>` before any Testserver sandbox is leased. Like
|
|
3
|
+
// `config.ts`, it imports neither `./fixtures.ts` nor vitest: a launcher script runs outside a Vitest run, where the
|
|
4
|
+
// adapter's `test` throws.
|
|
5
|
+
import { WORKERS_PER_SANDBOX } from "./config.js";
|
|
6
|
+
import { readVitestList } from "./list-output.js";
|
|
7
|
+
import { liveVitestListGateway } from "./live/list-gateway.js";
|
|
8
|
+
/** How long `listVitestTests` lets `vitest list` run by default. */
|
|
9
|
+
export const LIST_TIMEOUT_MS = 60_000;
|
|
10
|
+
/**
|
|
11
|
+
* Lists the tests `vitest run <args>` would run, with `vitest list --json <args>` from `PATH`, and counts them.
|
|
12
|
+
* Rejects with an `Error` saying why when `vitest` fails to start, doesn't finish within `timeoutMs`, exits other
|
|
13
|
+
* than 0 (with the last line of its stderr that isn't a stack frame), or prints something other than a list of tests.
|
|
14
|
+
*/
|
|
15
|
+
export async function listVitestTests(options, gateway = liveVitestListGateway) {
|
|
16
|
+
const timeoutMs = options.timeoutMs ?? LIST_TIMEOUT_MS;
|
|
17
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
18
|
+
throw new TypeError(`listVitestTests: timeoutMs is ${String(timeoutMs)}, not a positive number`);
|
|
19
|
+
}
|
|
20
|
+
const listed = await gateway.listTests({
|
|
21
|
+
args: options.args,
|
|
22
|
+
...(options.cwd === undefined ? {} : { cwd: options.cwd }),
|
|
23
|
+
timeoutMs,
|
|
24
|
+
});
|
|
25
|
+
if (!listed.ok)
|
|
26
|
+
throw new Error(describeListFailure(listed.failure));
|
|
27
|
+
return planOf(listed.tests);
|
|
28
|
+
}
|
|
29
|
+
/** The plan `vitest list --json` printed: its tests, and their distinct files. Throws when it isn't a list of tests. */
|
|
30
|
+
export function parseVitestList(stdout) {
|
|
31
|
+
return planOf(readVitestList(stdout));
|
|
32
|
+
}
|
|
33
|
+
/** A plan as a phrase, such as `65 tests in 19 files` or `1 test in 1 file`. */
|
|
34
|
+
export function formatPlan(plan) {
|
|
35
|
+
return `${plan.tests} ${plan.tests === 1 ? "test" : "tests"} in ${plan.files} ${plan.files === 1 ? "file" : "files"}`;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The Testserver sandboxes to ask `storm run --set resources.testserverPool.sandboxes=<n>` for: one per
|
|
39
|
+
* `workersPerSandbox` files (default `WORKERS_PER_SANDBOX`, 4, as `testserverWorkers` sizes `maxWorkers`), at least
|
|
40
|
+
* 1 and at most `max`. A file's tests run in one worker, so more sandboxes than that would sit idle. Throws a `TypeError` unless `files` is a
|
|
41
|
+
* non-negative integer and `max` and `workersPerSandbox` are positive integers.
|
|
42
|
+
*/
|
|
43
|
+
export function sandboxesFor(files, max, workersPerSandbox = WORKERS_PER_SANDBOX) {
|
|
44
|
+
if (!Number.isInteger(files) || files < 0) {
|
|
45
|
+
throw new TypeError(`sandboxesFor: files is ${String(files)}, not a non-negative integer`);
|
|
46
|
+
}
|
|
47
|
+
for (const [name, value] of [
|
|
48
|
+
["max", max],
|
|
49
|
+
["workersPerSandbox", workersPerSandbox],
|
|
50
|
+
]) {
|
|
51
|
+
if (!Number.isInteger(value) || value < 1) {
|
|
52
|
+
throw new TypeError(`sandboxesFor: ${name} is ${String(value)}, not a positive integer`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return Math.min(max, Math.max(1, Math.ceil(files / workersPerSandbox)));
|
|
56
|
+
}
|
|
57
|
+
function planOf(tests) {
|
|
58
|
+
return { tests: tests.length, files: new Set(tests.map((test) => test.file)).size };
|
|
59
|
+
}
|
|
60
|
+
function describeListFailure(failure) {
|
|
61
|
+
switch (failure.kind) {
|
|
62
|
+
case "start-failed":
|
|
63
|
+
return `\`vitest list\` failed to start: ${failure.message}`;
|
|
64
|
+
case "timed-out":
|
|
65
|
+
return `\`vitest list\` did not finish in ${failure.timeoutMs / 1000}s`;
|
|
66
|
+
case "exited": {
|
|
67
|
+
const how = failure.exitCode === null ? `was ended by ${failure.signal ?? "a signal"}` : `exited ${failure.exitCode}`;
|
|
68
|
+
return `\`vitest list\` ${how}${failure.lastStderrLine === "" ? "" : `: ${failure.lastStderrLine}`}`;
|
|
69
|
+
}
|
|
70
|
+
case "unreadable-output":
|
|
71
|
+
return failure.message;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RunPayload } from "../sdk/index.ts";
|
|
2
|
+
/** What a test that needs a Testserver sandbox fails with in a run that holds none. */
|
|
3
|
+
export declare const NO_TESTSERVER_MESSAGE = "this run has no Testserver; add resources.testserverPool to storm.config.ts or pass --set resources.testserverPool.sandboxes=<n>";
|
|
4
|
+
/**
|
|
5
|
+
* The Testserver URL of the Testserver sandbox the vitest worker numbered `poolId` uses:
|
|
6
|
+
* `sandboxes[(poolId - 1) % N]` of the run payload's `resources.testserverPool`. `poolId` is the worker's
|
|
7
|
+
* `VITEST_POOL_ID`, which vitest sets to a number from 1 to `maxWorkers`. Throws when `poolId` is missing or not a
|
|
8
|
+
* positive integer, or when the run payload lists no Testserver sandbox (`NO_TESTSERVER_MESSAGE`), as in a run
|
|
9
|
+
* without a Testserver side, which has no `testserverPool`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function sandboxForWorker(payload: RunPayload, poolId: string | undefined): string;
|
|
12
|
+
/**
|
|
13
|
+
* How many Testserver sandboxes `payload` counts for sizing workers: at least one, so a config always loads, a run
|
|
14
|
+
* without a Testserver side's included; its tests that need a Testserver sandbox fail with `NO_TESTSERVER_MESSAGE`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function sandboxCount(payload: RunPayload): number;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Which Testserver sandbox a vitest worker uses, and how many Testserver sandboxes a run counts for sizing workers.
|
|
2
|
+
// Pure: no vitest import, so `config.ts`, which a `vitest.config.ts` loads, can use it.
|
|
3
|
+
/** What a test that needs a Testserver sandbox fails with in a run that holds none. */
|
|
4
|
+
export const NO_TESTSERVER_MESSAGE = "this run has no Testserver; add resources.testserverPool to storm.config.ts or pass --set resources.testserverPool.sandboxes=<n>";
|
|
5
|
+
/**
|
|
6
|
+
* The Testserver URL of the Testserver sandbox the vitest worker numbered `poolId` uses:
|
|
7
|
+
* `sandboxes[(poolId - 1) % N]` of the run payload's `resources.testserverPool`. `poolId` is the worker's
|
|
8
|
+
* `VITEST_POOL_ID`, which vitest sets to a number from 1 to `maxWorkers`. Throws when `poolId` is missing or not a
|
|
9
|
+
* positive integer, or when the run payload lists no Testserver sandbox (`NO_TESTSERVER_MESSAGE`), as in a run
|
|
10
|
+
* without a Testserver side, which has no `testserverPool`.
|
|
11
|
+
*/
|
|
12
|
+
export function sandboxForWorker(payload, poolId) {
|
|
13
|
+
if (poolId === undefined || !/^[1-9][0-9]*$/.test(poolId)) {
|
|
14
|
+
throw new Error(`VITEST_POOL_ID is ${poolId === undefined ? "not set" : JSON.stringify(poolId)}, not a positive integer: ` +
|
|
15
|
+
"the storm Vitest adapter must run inside a vitest worker");
|
|
16
|
+
}
|
|
17
|
+
const sandboxes = payloadSandboxes(payload);
|
|
18
|
+
if (sandboxes.length === 0)
|
|
19
|
+
throw new Error(NO_TESTSERVER_MESSAGE);
|
|
20
|
+
const sandbox = sandboxes[(Number(poolId) - 1) % sandboxes.length];
|
|
21
|
+
if (sandbox === undefined)
|
|
22
|
+
throw new Error(NO_TESTSERVER_MESSAGE);
|
|
23
|
+
return sandbox.url;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* How many Testserver sandboxes `payload` counts for sizing workers: at least one, so a config always loads, a run
|
|
27
|
+
* without a Testserver side's included; its tests that need a Testserver sandbox fail with `NO_TESTSERVER_MESSAGE`.
|
|
28
|
+
*/
|
|
29
|
+
export function sandboxCount(payload) {
|
|
30
|
+
return Math.max(1, payloadSandboxes(payload).length);
|
|
31
|
+
}
|
|
32
|
+
/** The Testserver sandboxes the run payload's `resources.testserverPool` lists; none without it. */
|
|
33
|
+
function payloadSandboxes(payload) {
|
|
34
|
+
return payload.resources.testserverPool?.sandboxes ?? [];
|
|
35
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ServiceWarmup, type WorkerTestEvent } from "../sdk/index.ts";
|
|
2
|
+
/** What a worker's test event reports beside what its reporter knows: the worker and the time. */
|
|
3
|
+
export type ReportedTestEvent = WorkerTestEvent extends infer E ? E extends WorkerTestEvent ? Omit<E, "worker" | "at"> : never : never;
|
|
4
|
+
/** Reports this worker's test events. */
|
|
5
|
+
export type TestEventReporter = (event: ReportedTestEvent) => void;
|
|
6
|
+
/** A reporter that reports nothing. */
|
|
7
|
+
export declare const silentTestEvents: TestEventReporter;
|
|
8
|
+
/**
|
|
9
|
+
* The reporter for this worker: appends each event, with the worker's `VITEST_POOL_ID` and the time, to the run
|
|
10
|
+
* payload's `testEvents` file. Outside `storm run`, when the run payload names no such file, or outside a vitest
|
|
11
|
+
* worker, it reports nothing; and once an append fails it drops every later event: reporting never fails a test.
|
|
12
|
+
*/
|
|
13
|
+
export declare function testEventReporter(env?: Readonly<Record<string, string | undefined>>, append?: (path: string, text: string) => void, now?: () => number): TestEventReporter;
|
|
14
|
+
/**
|
|
15
|
+
* The test events file the run payload in `env` names; undefined outside `storm run`, when the run payload
|
|
16
|
+
* names none, or when it can't be read.
|
|
17
|
+
*/
|
|
18
|
+
export declare function testEventsFile(env: Readonly<Record<string, string | undefined>>): string | undefined;
|
|
19
|
+
/** The tests in a vitest file or suite, counted through its suites. */
|
|
20
|
+
export declare function countTests(task: {
|
|
21
|
+
readonly tasks?: readonly unknown[];
|
|
22
|
+
}): number;
|
|
23
|
+
/** A finished test attempt's state as a test event reports it: passed, failed, or anything else as skipped. */
|
|
24
|
+
export declare function testEventState(state: string | undefined): "pass" | "fail" | "skip";
|
|
25
|
+
/** A container start `reportedStart` reported: what `start` returned, how long it took, and any warmup after it. */
|
|
26
|
+
export interface ReportedStart<T> {
|
|
27
|
+
readonly value: T;
|
|
28
|
+
readonly startMs: number;
|
|
29
|
+
/** The warmup, and how long it took by `reportedStart`'s clock; absent when nothing was warmed. */
|
|
30
|
+
readonly warmup?: {
|
|
31
|
+
readonly ms: number;
|
|
32
|
+
readonly warmup: ServiceWarmup;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `start`, then `warm` on what it returned when given, reporting to `report`, for `file`: `container-starting`,
|
|
37
|
+
* then, once both have ended, `container-started` with the start's `ms` and, when `warm` ran, `warmupMs` and how
|
|
38
|
+
* many services failed (`warmupFailed`). A start that throws reports `ok: false` without warmup fields, and so does a
|
|
39
|
+
* `warm` that throws, which leaves ending the container to `warm`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function reportedStart<T>(report: TestEventReporter, file: string, start: () => Promise<T>, warm?: (value: T) => Promise<ServiceWarmup>, now?: () => number): Promise<ReportedStart<T>>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// The test events a vitest worker appends to the run payload's `testEvents` file, so `storm run` can show which
|
|
2
|
+
// worker runs which file, how long each container start and test attempt takes, and how busy the workers are. A
|
|
3
|
+
// test's final result comes from vitest's main process instead (`test-results.ts`). Pure but for the append, which a
|
|
4
|
+
// reporter does with one write a line: a short `O_APPEND` write lands whole beside other workers'.
|
|
5
|
+
import { appendFileSync } from "node:fs";
|
|
6
|
+
import { readRunPayload, RUN_PAYLOAD_VARIABLE, testEventLine, } from "../sdk/index.js";
|
|
7
|
+
/** A reporter that reports nothing. */
|
|
8
|
+
export const silentTestEvents = () => { };
|
|
9
|
+
/**
|
|
10
|
+
* The reporter for this worker: appends each event, with the worker's `VITEST_POOL_ID` and the time, to the run
|
|
11
|
+
* payload's `testEvents` file. Outside `storm run`, when the run payload names no such file, or outside a vitest
|
|
12
|
+
* worker, it reports nothing; and once an append fails it drops every later event: reporting never fails a test.
|
|
13
|
+
*/
|
|
14
|
+
export function testEventReporter(env = process.env, append = (path, text) => appendFileSync(path, text), now = Date.now) {
|
|
15
|
+
const path = testEventsFile(env);
|
|
16
|
+
const poolId = env["VITEST_POOL_ID"];
|
|
17
|
+
if (path === undefined || poolId === undefined || !/^[1-9][0-9]*$/.test(poolId))
|
|
18
|
+
return silentTestEvents;
|
|
19
|
+
const file = path;
|
|
20
|
+
const worker = Number(poolId);
|
|
21
|
+
let failed = false;
|
|
22
|
+
return (event) => {
|
|
23
|
+
if (failed)
|
|
24
|
+
return;
|
|
25
|
+
try {
|
|
26
|
+
append(file, `${testEventLine({ ...event, worker, at: now() })}\n`);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
failed = true;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The test events file the run payload in `env` names; undefined outside `storm run`, when the run payload
|
|
35
|
+
* names none, or when it can't be read.
|
|
36
|
+
*/
|
|
37
|
+
export function testEventsFile(env) {
|
|
38
|
+
const raw = env[RUN_PAYLOAD_VARIABLE];
|
|
39
|
+
if (raw === undefined || raw === "")
|
|
40
|
+
return undefined;
|
|
41
|
+
try {
|
|
42
|
+
return readRunPayload(env).testEvents;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** The tests in a vitest file or suite, counted through its suites. */
|
|
49
|
+
export function countTests(task) {
|
|
50
|
+
let count = 0;
|
|
51
|
+
for (const child of task.tasks ?? []) {
|
|
52
|
+
const node = child;
|
|
53
|
+
if (node.type === "test")
|
|
54
|
+
count += 1;
|
|
55
|
+
else if (node.type === "suite")
|
|
56
|
+
count += countTests(node);
|
|
57
|
+
}
|
|
58
|
+
return count;
|
|
59
|
+
}
|
|
60
|
+
/** A finished test attempt's state as a test event reports it: passed, failed, or anything else as skipped. */
|
|
61
|
+
export function testEventState(state) {
|
|
62
|
+
return state === "pass" ? "pass" : state === "fail" ? "fail" : "skip";
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* `start`, then `warm` on what it returned when given, reporting to `report`, for `file`: `container-starting`,
|
|
66
|
+
* then, once both have ended, `container-started` with the start's `ms` and, when `warm` ran, `warmupMs` and how
|
|
67
|
+
* many services failed (`warmupFailed`). A start that throws reports `ok: false` without warmup fields, and so does a
|
|
68
|
+
* `warm` that throws, which leaves ending the container to `warm`.
|
|
69
|
+
*/
|
|
70
|
+
export async function reportedStart(report, file, start, warm, now = Date.now) {
|
|
71
|
+
const startedAt = now();
|
|
72
|
+
report({ kind: "container-starting", file });
|
|
73
|
+
let startMs;
|
|
74
|
+
try {
|
|
75
|
+
const value = await start();
|
|
76
|
+
startMs = now() - startedAt;
|
|
77
|
+
if (warm === undefined) {
|
|
78
|
+
report({ kind: "container-started", file, ms: startMs, ok: true });
|
|
79
|
+
return { value, startMs };
|
|
80
|
+
}
|
|
81
|
+
const warmStartedAt = now();
|
|
82
|
+
const warmup = await warm(value);
|
|
83
|
+
const warmupMs = now() - warmStartedAt;
|
|
84
|
+
const warmupFailed = warmup.services.filter((service) => !service.ok).length;
|
|
85
|
+
report({ kind: "container-started", file, ms: startMs, ok: true, warmupMs, warmupFailed });
|
|
86
|
+
return { value, startMs, warmup: { ms: warmupMs, warmup } };
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
report({ kind: "container-started", file, ms: startMs ?? now() - startedAt, ok: false });
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type TestResultOutput } from "../sdk/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The most characters (UTF-16 code units) of a test's test output its final result keeps, the last ones: 8 MiB worth,
|
|
4
|
+
* room for any test's ordinary log output. The limit guards against a test that prints without end, since the reporter
|
|
5
|
+
* holds each running test's output in memory.
|
|
6
|
+
*/
|
|
7
|
+
export declare const OUTPUT_CHARS: number;
|
|
8
|
+
/** The most errors a test's final result keeps: the first ones. */
|
|
9
|
+
export declare const MAX_ERRORS = 5;
|
|
10
|
+
/** The most characters of an error's `message`, and of its `diff`, a final result keeps: the first ones. */
|
|
11
|
+
export declare const ERROR_TEXT_CHARS = 4000;
|
|
12
|
+
/** The most lines of an error's `stack` a final result keeps: the first ones. */
|
|
13
|
+
export declare const STACK_LINES = 30;
|
|
14
|
+
/** The parts of one of vitest's `TestError`s the reporter reads. */
|
|
15
|
+
export interface ReportedTestError {
|
|
16
|
+
readonly name?: string;
|
|
17
|
+
readonly message: string;
|
|
18
|
+
readonly stack?: string;
|
|
19
|
+
readonly diff?: string;
|
|
20
|
+
}
|
|
21
|
+
/** The parts of vitest's `TestCase` the reporter reads. */
|
|
22
|
+
export interface ReportedTestCase {
|
|
23
|
+
/** Vitest's id for the test, unique within a run. */
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly fullName: string;
|
|
26
|
+
readonly module: {
|
|
27
|
+
readonly relativeModuleId: string;
|
|
28
|
+
};
|
|
29
|
+
result(): {
|
|
30
|
+
readonly state: string;
|
|
31
|
+
readonly errors?: ReadonlyArray<ReportedTestError> | undefined;
|
|
32
|
+
};
|
|
33
|
+
diagnostic(): {
|
|
34
|
+
readonly retryCount: number;
|
|
35
|
+
readonly flaky: boolean;
|
|
36
|
+
} | undefined;
|
|
37
|
+
}
|
|
38
|
+
/** The parts of vitest's `TestModule` the reporter reads. */
|
|
39
|
+
export interface ReportedTestModule {
|
|
40
|
+
readonly children: {
|
|
41
|
+
allTests(): Iterable<ReportedTestCase>;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The parts of vitest's `UserConsoleLog` the reporter reads: one console write, and the id of the task that was
|
|
46
|
+
* running when it was made, a test's, or a suite's or file's outside any test.
|
|
47
|
+
*/
|
|
48
|
+
export interface ReportedConsoleLog {
|
|
49
|
+
readonly content: string;
|
|
50
|
+
readonly taskId?: string | undefined;
|
|
51
|
+
}
|
|
52
|
+
/** A vitest reporter that appends each test's final result to the run payload's `testEvents` file. */
|
|
53
|
+
export interface StormReporter {
|
|
54
|
+
onUserConsoleLog(log: ReportedConsoleLog): void;
|
|
55
|
+
onTestCaseResult(testCase: ReportedTestCase): void;
|
|
56
|
+
onTestModuleEnd(testModule: ReportedTestModule): void;
|
|
57
|
+
onTestRunEnd(): void;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The reporter: once for each test, by its vitest id, appends a `test-result` event with its final state, how many
|
|
61
|
+
* times it was retried, whether it was flaky, the time, its errors and its test output. A test vitest ran is reported
|
|
62
|
+
* when its result is final; a test skipped without running, and every test of a file whose tests were all skipped,
|
|
63
|
+
* when its file ends.
|
|
64
|
+
*
|
|
65
|
+
* Test output is each console write vitest hands `onUserConsoleLog`, kept by the id of the task that made it, the
|
|
66
|
+
* last `OUTPUT_CHARS` per test with a count of the characters dropped before them (`keepLast`): the kept text starts
|
|
67
|
+
* at a line's start, unless its first line alone is longer than that. Vitest tags a write with the
|
|
68
|
+
* running test's id from the test's start until after its `onTestFailed` handlers, and sends it before the test's
|
|
69
|
+
* result, so a failure report printed from `onTestFailed` is the end of its test's output. A write tagged with a
|
|
70
|
+
* suite's or file's id, from a `beforeAll` or a file-scoped fixture's cleanup, belongs to no test and is dropped when
|
|
71
|
+
* the run ends. Errors are vitest's, the first `MAX_ERRORS`, each `message` and `diff` cut to `ERROR_TEXT_CHARS` and
|
|
72
|
+
* `stack` to `STACK_LINES` lines.
|
|
73
|
+
*
|
|
74
|
+
* Outside `storm run`, or when the run payload names no test events file, it reports and keeps nothing; a test
|
|
75
|
+
* whose result can't be read is dropped; and once an append fails it drops every later result: reporting never fails
|
|
76
|
+
* a test.
|
|
77
|
+
*/
|
|
78
|
+
export declare function testResultReporter(env: Readonly<Record<string, string | undefined>>, append?: (path: string, text: string) => void, now?: () => number): StormReporter;
|
|
79
|
+
/**
|
|
80
|
+
* `output` with at most its last `limit` characters, cut at a line's start: past the cut, through the next `\n`, unless
|
|
81
|
+
* the cut already falls at a line's start or no `\n` with text after it lies past the cut, when it cuts mid-line.
|
|
82
|
+
* `droppedChars` adds every character cut.
|
|
83
|
+
*/
|
|
84
|
+
export declare function keepLast(output: TestResultOutput, limit: number): TestResultOutput;
|