@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,108 @@
|
|
|
1
|
+
import type { Container, ServiceWarmup, TestserverServiceId } from "../sdk/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* How long the Vitest adapter's container lives: `'file'`, one container shared by a test file's tests and replaced
|
|
4
|
+
* after a failed test or for a test with different feature flags, or `'test'`, one per test.
|
|
5
|
+
*/
|
|
6
|
+
export type ContainerScope = "file" | "test";
|
|
7
|
+
/** The default container scope: a test file's tests share one container. */
|
|
8
|
+
export declare const CONTAINER_SCOPE: ContainerScope;
|
|
9
|
+
/** What the adapter needs of a container to share it: the `Container` fields it reports on, and `end`. */
|
|
10
|
+
export type SharedContainer = Pick<Container, "testId" | "testserverUrl" | "featureFlags" | "factoryCalls" | "apiRequests" | "warmups" | "log" | "redact" | "end">;
|
|
11
|
+
/**
|
|
12
|
+
* Where the container `FileContainer.acquire` hands out came from: `reused`, the file's running container; `new`,
|
|
13
|
+
* one it started, or a start in flight it shared; `replaced`, one it started after ending the file's container,
|
|
14
|
+
* which had different feature flags.
|
|
15
|
+
*/
|
|
16
|
+
export type ContainerOrigin = "new" | "reused" | "replaced";
|
|
17
|
+
/** The container `FileContainer.acquire` hands out, and where it came from. */
|
|
18
|
+
export interface AcquiredContainer<C> {
|
|
19
|
+
readonly container: C;
|
|
20
|
+
readonly origin: ContainerOrigin;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Starts the file's container; `replacing` says whether it replaces the file's container, which had different
|
|
24
|
+
* feature flags.
|
|
25
|
+
*/
|
|
26
|
+
export type StartFileContainer<C> = (replacing: boolean) => Promise<C>;
|
|
27
|
+
/**
|
|
28
|
+
* A test file's container in `'file'` scope. It starts lazily, when the first test asks for it; concurrent
|
|
29
|
+
* `acquire` calls with the same feature flags key share one start, and a failed start leaves nothing behind, so the
|
|
30
|
+
* next `acquire` starts again. The container remembers the feature flags key it started with: a test with a
|
|
31
|
+
* different one gets a new container, which replaces it.
|
|
32
|
+
*/
|
|
33
|
+
export declare class FileContainer<C extends SharedContainer> {
|
|
34
|
+
#private;
|
|
35
|
+
/** The file's running container, if one has started and not been discarded. */
|
|
36
|
+
get current(): C | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The file's container for a test whose feature flags key is `key` (`featureFlagsKey`): the running one, or the
|
|
39
|
+
* one starting, when either has the same key, or one `start` starts. A running container with a different key is
|
|
40
|
+
* forgotten and ended first, and the new one replaces it; when that end fails, rejects saying so, leaving no
|
|
41
|
+
* container. A start in flight with a different key is waited for, its failure ignored, then treated the same way.
|
|
42
|
+
* Throws after `close`.
|
|
43
|
+
*/
|
|
44
|
+
acquire(start: StartFileContainer<C>, key: string): Promise<AcquiredContainer<C>>;
|
|
45
|
+
/** Forgets `container` if it is the file's, then ends it. An end that fails throws, but it is forgotten all the same. */
|
|
46
|
+
discard(container: C): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Closes the file's container: no `acquire` afterwards, and once any start in flight has settled, ends the
|
|
49
|
+
* container if there is one. An end that fails throws. A start that fails is not this method's to report: the
|
|
50
|
+
* `Acquisitions` its test tracked reports it.
|
|
51
|
+
*/
|
|
52
|
+
close(): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
/** What `provideContainer` needs from the test it provides a container for, and from Vitest. */
|
|
55
|
+
export interface ContainerRequest<C extends SharedContainer> {
|
|
56
|
+
readonly scope: ContainerScope;
|
|
57
|
+
readonly fileContainer: FileContainer<C>;
|
|
58
|
+
/** The test's abort signal. */
|
|
59
|
+
readonly signal: AbortSignal;
|
|
60
|
+
/** Registers the fixture's cleanup. Vitest takes one per fixture. */
|
|
61
|
+
readonly onCleanup: (cleanup: () => Promise<void>) => void;
|
|
62
|
+
/** Registers a failure handler. Vitest awaits each one after the test's cleanups, before the next test starts. */
|
|
63
|
+
readonly onTestFailed: (handler: () => void | Promise<void>) => void;
|
|
64
|
+
readonly isConcurrent: boolean;
|
|
65
|
+
/** Whether the test has failed so far: its body or `afterEach`, when asked in the fixture's cleanup. */
|
|
66
|
+
readonly failed: () => boolean;
|
|
67
|
+
/** The canonical key of the test's feature flags (`featureFlagsKey`), which the file's container must match. */
|
|
68
|
+
readonly featureFlagsKey: string;
|
|
69
|
+
/** Starts the file's container, in `'file'` scope, saying whether it replaces one with other feature flags. */
|
|
70
|
+
readonly startShared: StartFileContainer<C>;
|
|
71
|
+
/** Starts the test's own container, in `'test'` scope. */
|
|
72
|
+
readonly startOwn: () => Promise<C>;
|
|
73
|
+
/** Prints a failure report. */
|
|
74
|
+
readonly report: (text: string) => void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The `container` fixture's logic, apart from Vitest.
|
|
78
|
+
*
|
|
79
|
+
* In `'test'` scope, starts the test's own container, ends it after the test (at once, if it arrives after the test
|
|
80
|
+
* aborted; see `acquireOwned`), and reports it when the test fails. A test that has failed by its cleanup gets its
|
|
81
|
+
* container log read there, before the container ends; one that fails later is reported without it.
|
|
82
|
+
*
|
|
83
|
+
* In `'file'` scope, hands the test the file's container, starting it if need be, or replacing it when its feature
|
|
84
|
+
* flags differ from the test's. A test that aborts while it is starting never gets it, but the container stays the
|
|
85
|
+
* file's, for its next test. A test handed a container an
|
|
86
|
+
* earlier test used notes its container log's last record, so its report can print only the records after it.
|
|
87
|
+
* After a failed test, the container log is read and the container ended in the test's failure handler, which
|
|
88
|
+
* Vitest awaits even when a fixture's cleanup throws, so the next test that asks starts a new one; the failure
|
|
89
|
+
* report covers only this test's factory calls, API requests and container log, and says whether ending the
|
|
90
|
+
* container succeeded. A concurrent test can't share the file's container, and fails before anything starts.
|
|
91
|
+
*/
|
|
92
|
+
export declare function provideContainer<C extends SharedContainer>(request: ContainerRequest<C>): Promise<C>;
|
|
93
|
+
/**
|
|
94
|
+
* Warms `serviceIds` in a container just started, before anyone has it: `container.warmup`, which reports a service
|
|
95
|
+
* that fails rather than throwing. When it throws all the same, for a service id it refuses, ends the container, so
|
|
96
|
+
* none is left running, and rethrows; when the end fails too, throws an `AggregateError` holding both, the warmup's
|
|
97
|
+
* error first and as its `cause`.
|
|
98
|
+
*/
|
|
99
|
+
export declare function warmNewContainer(container: Pick<Container, "testId" | "warmup" | "end">, serviceIds: readonly TestserverServiceId[]): Promise<ServiceWarmup>;
|
|
100
|
+
/**
|
|
101
|
+
* Closes a test file's container and settles its acquisitions, each whatever the other does, since Vitest skips a
|
|
102
|
+
* file's remaining cleanups after one throws. Throws what failed: one error as is, both in an `AggregateError`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function closeFile(fileContainer: {
|
|
105
|
+
close(): Promise<void>;
|
|
106
|
+
}, acquisitions: {
|
|
107
|
+
settle(): Promise<void>;
|
|
108
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { containerFailureReport, sharedContainerFailureReport } from "./diagnostics.js";
|
|
2
|
+
import { acquireOwned } from "./ownership.js";
|
|
3
|
+
/** The default container scope: a test file's tests share one container. */
|
|
4
|
+
export const CONTAINER_SCOPE = "file";
|
|
5
|
+
/**
|
|
6
|
+
* A test file's container in `'file'` scope. It starts lazily, when the first test asks for it; concurrent
|
|
7
|
+
* `acquire` calls with the same feature flags key share one start, and a failed start leaves nothing behind, so the
|
|
8
|
+
* next `acquire` starts again. The container remembers the feature flags key it started with: a test with a
|
|
9
|
+
* different one gets a new container, which replaces it.
|
|
10
|
+
*/
|
|
11
|
+
export class FileContainer {
|
|
12
|
+
#current;
|
|
13
|
+
#starting;
|
|
14
|
+
#closed = false;
|
|
15
|
+
/** The file's running container, if one has started and not been discarded. */
|
|
16
|
+
get current() {
|
|
17
|
+
return this.#current?.container;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The file's container for a test whose feature flags key is `key` (`featureFlagsKey`): the running one, or the
|
|
21
|
+
* one starting, when either has the same key, or one `start` starts. A running container with a different key is
|
|
22
|
+
* forgotten and ended first, and the new one replaces it; when that end fails, rejects saying so, leaving no
|
|
23
|
+
* container. A start in flight with a different key is waited for, its failure ignored, then treated the same way.
|
|
24
|
+
* Throws after `close`.
|
|
25
|
+
*/
|
|
26
|
+
acquire(start, key) {
|
|
27
|
+
if (this.#closed)
|
|
28
|
+
return Promise.reject(new Error("the test file's container was already closed"));
|
|
29
|
+
const current = this.#current;
|
|
30
|
+
if (current !== undefined) {
|
|
31
|
+
if (current.key === key)
|
|
32
|
+
return Promise.resolve({ container: current.container, origin: "reused" });
|
|
33
|
+
this.#current = undefined;
|
|
34
|
+
return this.#begin(key, true, async () => {
|
|
35
|
+
try {
|
|
36
|
+
await current.container.end();
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw new Error(`ending the file's container ${current.container.testId} to replace it for a test with different feature flags failed: ${messageOf(error)}`, { cause: error });
|
|
40
|
+
}
|
|
41
|
+
return start(true);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const starting = this.#starting;
|
|
45
|
+
if (starting !== undefined) {
|
|
46
|
+
if (starting.key === key)
|
|
47
|
+
return starting.promise.then((container) => ({ container, origin: "new" }));
|
|
48
|
+
return starting.promise.then(() => this.acquire(start, key), () => this.acquire(start, key));
|
|
49
|
+
}
|
|
50
|
+
return this.#begin(key, false, () => start(false));
|
|
51
|
+
}
|
|
52
|
+
/** Runs `run` as the file's start in flight under `key`, the container it resolves with becoming the file's. */
|
|
53
|
+
#begin(key, replacing, run) {
|
|
54
|
+
const promise = (async () => {
|
|
55
|
+
try {
|
|
56
|
+
const container = await run();
|
|
57
|
+
this.#current = { container, key };
|
|
58
|
+
return container;
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
this.#starting = undefined;
|
|
62
|
+
}
|
|
63
|
+
})();
|
|
64
|
+
this.#starting = { promise, key };
|
|
65
|
+
return promise.then((container) => ({ container, origin: replacing ? "replaced" : "new" }));
|
|
66
|
+
}
|
|
67
|
+
/** Forgets `container` if it is the file's, then ends it. An end that fails throws, but it is forgotten all the same. */
|
|
68
|
+
async discard(container) {
|
|
69
|
+
if (this.#current?.container === container)
|
|
70
|
+
this.#current = undefined;
|
|
71
|
+
await container.end();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Closes the file's container: no `acquire` afterwards, and once any start in flight has settled, ends the
|
|
75
|
+
* container if there is one. An end that fails throws. A start that fails is not this method's to report: the
|
|
76
|
+
* `Acquisitions` its test tracked reports it.
|
|
77
|
+
*/
|
|
78
|
+
async close() {
|
|
79
|
+
this.#closed = true;
|
|
80
|
+
if (this.#starting !== undefined)
|
|
81
|
+
await this.#starting.promise.catch(() => { });
|
|
82
|
+
const container = this.#current?.container;
|
|
83
|
+
this.#current = undefined;
|
|
84
|
+
if (container !== undefined)
|
|
85
|
+
await container.end();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The `container` fixture's logic, apart from Vitest.
|
|
90
|
+
*
|
|
91
|
+
* In `'test'` scope, starts the test's own container, ends it after the test (at once, if it arrives after the test
|
|
92
|
+
* aborted; see `acquireOwned`), and reports it when the test fails. A test that has failed by its cleanup gets its
|
|
93
|
+
* container log read there, before the container ends; one that fails later is reported without it.
|
|
94
|
+
*
|
|
95
|
+
* In `'file'` scope, hands the test the file's container, starting it if need be, or replacing it when its feature
|
|
96
|
+
* flags differ from the test's. A test that aborts while it is starting never gets it, but the container stays the
|
|
97
|
+
* file's, for its next test. A test handed a container an
|
|
98
|
+
* earlier test used notes its container log's last record, so its report can print only the records after it.
|
|
99
|
+
* After a failed test, the container log is read and the container ended in the test's failure handler, which
|
|
100
|
+
* Vitest awaits even when a fixture's cleanup throws, so the next test that asks starts a new one; the failure
|
|
101
|
+
* report covers only this test's factory calls, API requests and container log, and says whether ending the
|
|
102
|
+
* container succeeded. A concurrent test can't share the file's container, and fails before anything starts.
|
|
103
|
+
*/
|
|
104
|
+
export async function provideContainer(request) {
|
|
105
|
+
const { signal, onCleanup, onTestFailed, report } = request;
|
|
106
|
+
if (request.scope === "test") {
|
|
107
|
+
let handed = false;
|
|
108
|
+
let log = { kind: "unread" };
|
|
109
|
+
const container = await acquireOwned(signal, onCleanup, request.startOwn, async (owned) => {
|
|
110
|
+
if (handed && request.failed()) {
|
|
111
|
+
log = await readLog(owned, (records) => ({ kind: "read", origin: "container", records }));
|
|
112
|
+
}
|
|
113
|
+
await owned.end();
|
|
114
|
+
});
|
|
115
|
+
handed = true;
|
|
116
|
+
onTestFailed(() => report(containerFailureReport({ ...reportOf(container), log })));
|
|
117
|
+
return container;
|
|
118
|
+
}
|
|
119
|
+
if (request.isConcurrent) {
|
|
120
|
+
throw new Error("a concurrent test can't share its file's container (container scope 'file'); " +
|
|
121
|
+
'use test.override({ containerScope: "test" }) in the file or describe that runs tests concurrently');
|
|
122
|
+
}
|
|
123
|
+
const { fileContainer } = request;
|
|
124
|
+
const { container, origin } = await fileContainer.acquire(request.startShared, request.featureFlagsKey);
|
|
125
|
+
if (signal.aborted)
|
|
126
|
+
throw signal.reason;
|
|
127
|
+
const note = origin === "reused" ? await noteLog(container) : { kind: "new" };
|
|
128
|
+
if (signal.aborted)
|
|
129
|
+
throw signal.reason;
|
|
130
|
+
const before = { factoryCalls: container.factoryCalls.length, apiRequests: container.apiRequests.length };
|
|
131
|
+
onTestFailed(async () => {
|
|
132
|
+
const log = await readLog(container, (records) => sliceAfter(records, note));
|
|
133
|
+
try {
|
|
134
|
+
await fileContainer.discard(container);
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
report(sharedContainerFailureReport(reportOf(container), before, log, { kind: "failed", message: messageOf(error) }));
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
report(sharedContainerFailureReport(reportOf(container), before, log, { kind: "ended" }));
|
|
141
|
+
});
|
|
142
|
+
return container;
|
|
143
|
+
}
|
|
144
|
+
/** Notes the last record of a reused container's log. A read that fails is noted, not thrown: the test runs on. */
|
|
145
|
+
async function noteLog(container) {
|
|
146
|
+
try {
|
|
147
|
+
return { kind: "noted", after: (await container.log()).at(-1)?.id };
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
return { kind: "failed", message: messageOf(error) };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/** The failed test's records: those after `note`, or every record with why they may include earlier tests'. */
|
|
154
|
+
function sliceAfter(records, note) {
|
|
155
|
+
if (note.kind === "failed") {
|
|
156
|
+
const reason = `noting the container log when this test started failed: ${note.message}`;
|
|
157
|
+
return { kind: "read", origin: "uncertain", records, reason };
|
|
158
|
+
}
|
|
159
|
+
if (note.kind === "new" || note.after === undefined)
|
|
160
|
+
return { kind: "read", origin: "test", records };
|
|
161
|
+
const { after } = note;
|
|
162
|
+
const index = records.findIndex((record) => record.id === after);
|
|
163
|
+
if (index === -1) {
|
|
164
|
+
const reason = `Testserver has dropped ${after}, the record noted when this test started`;
|
|
165
|
+
return { kind: "read", origin: "uncertain", records, reason };
|
|
166
|
+
}
|
|
167
|
+
return { kind: "read", origin: "test", records: records.slice(index + 1) };
|
|
168
|
+
}
|
|
169
|
+
/** Reads `container`'s log and slices it with `slice`; a read that fails is the slice, saying why, not thrown. */
|
|
170
|
+
async function readLog(container, slice) {
|
|
171
|
+
let records;
|
|
172
|
+
try {
|
|
173
|
+
records = await container.log();
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
return { kind: "unreadable", message: messageOf(error) };
|
|
177
|
+
}
|
|
178
|
+
return slice(records);
|
|
179
|
+
}
|
|
180
|
+
/** The container fields a failure report reads, `redact` bound to the container. */
|
|
181
|
+
function reportOf(container) {
|
|
182
|
+
return {
|
|
183
|
+
testId: container.testId,
|
|
184
|
+
testserverUrl: container.testserverUrl,
|
|
185
|
+
featureFlags: container.featureFlags,
|
|
186
|
+
factoryCalls: container.factoryCalls,
|
|
187
|
+
apiRequests: container.apiRequests,
|
|
188
|
+
warmups: container.warmups,
|
|
189
|
+
redact: (text) => container.redact(text),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Warms `serviceIds` in a container just started, before anyone has it: `container.warmup`, which reports a service
|
|
194
|
+
* that fails rather than throwing. When it throws all the same, for a service id it refuses, ends the container, so
|
|
195
|
+
* none is left running, and rethrows; when the end fails too, throws an `AggregateError` holding both, the warmup's
|
|
196
|
+
* error first and as its `cause`.
|
|
197
|
+
*/
|
|
198
|
+
export async function warmNewContainer(container, serviceIds) {
|
|
199
|
+
try {
|
|
200
|
+
return await container.warmup(serviceIds);
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
const ended = await endAfterFailedWarmup(container);
|
|
204
|
+
if (!ended.ok)
|
|
205
|
+
throw new AggregateError([error, ended.error], `${messageOf(error)}; ending container ${container.testId} after the failed warmup also failed: ${messageOf(ended.error)}`, { cause: error });
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/** Ends a container whose warmup threw, catching its failure so the caller throws from the warmup's own catch. */
|
|
210
|
+
async function endAfterFailedWarmup(container) {
|
|
211
|
+
try {
|
|
212
|
+
await container.end();
|
|
213
|
+
return { ok: true };
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
return { ok: false, error };
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Closes a test file's container and settles its acquisitions, each whatever the other does, since Vitest skips a
|
|
221
|
+
* file's remaining cleanups after one throws. Throws what failed: one error as is, both in an `AggregateError`.
|
|
222
|
+
*/
|
|
223
|
+
export async function closeFile(fileContainer, acquisitions) {
|
|
224
|
+
const outcomes = await Promise.allSettled([fileContainer.close(), acquisitions.settle()]);
|
|
225
|
+
const failures = outcomes.flatMap((outcome) => (outcome.status === "rejected" ? [outcome.reason] : []));
|
|
226
|
+
if (failures.length === 1)
|
|
227
|
+
throw failures[0];
|
|
228
|
+
if (failures.length > 1) {
|
|
229
|
+
throw new AggregateError(failures, `closing the test file's container and settling its fixtures both failed: ${failures.map(messageOf).join("; ")}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function messageOf(error) {
|
|
233
|
+
return error instanceof Error ? error.message : String(error);
|
|
234
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { type ApiRequestRecord, type ContainerLogRecord, type FactoryCall, type FeatureFlags, type FaultHandle, type RecordedBody, type ProxyRequestRecord, type ServiceWarmup } from "../sdk/index.ts";
|
|
2
|
+
/** The most characters of one body, input, response or container log line a failure report prints. */
|
|
3
|
+
export declare const BODY_REPORT_CHARS = 1000;
|
|
4
|
+
/** The most container log records a failure report prints, the last ones. */
|
|
5
|
+
export declare const LOG_REPORT_RECORDS = 50;
|
|
6
|
+
/** Replaces every token secret a container has seen; `container.redact`. */
|
|
7
|
+
export type Redact = (text: string) => string;
|
|
8
|
+
/** A request record of either kind, as one line describes it. */
|
|
9
|
+
type RequestLine = ProxyRequestRecord | ApiRequestRecord;
|
|
10
|
+
/**
|
|
11
|
+
* One request record as a line: its method, URL as sent, result, whether it carried `authorization`, duration and
|
|
12
|
+
* any session id, such as `GET /v2/user → 200, authorization sent, 412ms, session 7f3a`. A proxy record whose
|
|
13
|
+
* exchange was still open reads `open`, its duration counted to the read. A proxy record of a request a fault rule
|
|
14
|
+
* matched tags its result with the action and what Testserver answered, such as `500 (fault: replace, Testserver
|
|
15
|
+
* 200)`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function describeRequest(request: RequestLine): string;
|
|
18
|
+
/**
|
|
19
|
+
* A recorded body on one line, cut at `BODY_REPORT_CHARS`: JSON compact, a form as its encoded fields, text
|
|
20
|
+
* quoted, and an omitted body as its note, such as `[binary, 5 bytes, image/png]`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function describeBody(body: RecordedBody, redact: Redact): string;
|
|
23
|
+
/**
|
|
24
|
+
* One factory call as its line, such as `factory users → ok, 182ms`, then its input, its options when it had any,
|
|
25
|
+
* and its response when it succeeded, each on one line with every token field reading `<token>`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function describeFactoryCall(call: FactoryCall, redact: Redact): string[];
|
|
28
|
+
/**
|
|
29
|
+
* A container's activity: its factory calls and API requests merged in the order they started, each with the
|
|
30
|
+
* lines beneath it, or `no container activity`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function describeActivity(factoryCalls: readonly FactoryCall[], apiRequests: readonly ApiRequestRecord[], redact: Redact): string;
|
|
33
|
+
/**
|
|
34
|
+
* The container log a failure report prints:
|
|
35
|
+
*
|
|
36
|
+
* - `read`: the records read, and whose they are. `container` is every record the container kept (`'test'`
|
|
37
|
+
* scope); `test` is the failed test's (`'file'` scope); `uncertain` is every record kept when the test's own
|
|
38
|
+
* couldn't be told apart, which may include earlier tests', with `reason` saying why.
|
|
39
|
+
* - `unreadable`: reading it failed, with why.
|
|
40
|
+
* - `unread`: nothing read it before the container ended.
|
|
41
|
+
*/
|
|
42
|
+
export type ContainerLogSlice = {
|
|
43
|
+
readonly kind: "read";
|
|
44
|
+
readonly records: readonly ContainerLogRecord[];
|
|
45
|
+
readonly origin: "container" | "test";
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: "read";
|
|
48
|
+
readonly records: readonly ContainerLogRecord[];
|
|
49
|
+
readonly origin: "uncertain";
|
|
50
|
+
readonly reason: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly kind: "unreadable";
|
|
53
|
+
readonly message: string;
|
|
54
|
+
} | {
|
|
55
|
+
readonly kind: "unread";
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* One container log record as a line: its timestamp, service, protocol, message and status code, any missing or
|
|
59
|
+
* empty one left out, cut at `BODY_REPORT_CHARS`, then its stack's lines indented beneath it.
|
|
60
|
+
*/
|
|
61
|
+
export declare function describeLogRecord(record: ContainerLogRecord, redact: Redact): string[];
|
|
62
|
+
/** The container log section of a failure report. */
|
|
63
|
+
export declare function describeLog(log: ContainerLogSlice, redact: Redact): string;
|
|
64
|
+
/** Where a container's container output is: the Testserver process's own output for the test id, as text. */
|
|
65
|
+
export declare function containerOutputUrl(testserverUrl: string, testId: string): string;
|
|
66
|
+
/** What a failure report needs of a container, with the activity and log to print. */
|
|
67
|
+
export interface ContainerReport {
|
|
68
|
+
readonly testId: string;
|
|
69
|
+
readonly testserverUrl: string;
|
|
70
|
+
/** The feature flags the container was started with; `{}` for none. */
|
|
71
|
+
readonly featureFlags: FeatureFlags;
|
|
72
|
+
/** The container's warmups: one when the adapter started it with `warmServices`, none without. */
|
|
73
|
+
readonly warmups: readonly ServiceWarmup[];
|
|
74
|
+
readonly factoryCalls: readonly FactoryCall[];
|
|
75
|
+
readonly apiRequests: readonly ApiRequestRecord[];
|
|
76
|
+
readonly log: ContainerLogSlice;
|
|
77
|
+
readonly redact: Redact;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* What a failed test prints about its container: its test id and Testserver URL, its feature flags when it has
|
|
81
|
+
* any, a line for each warmup, its container activity, its container log, and its container output's URL.
|
|
82
|
+
*/
|
|
83
|
+
export declare function containerFailureReport(report: ContainerReport): string;
|
|
84
|
+
/**
|
|
85
|
+
* Feature flags on one line, each client's flags as `name=value`, the value as JSON, clients apart by `; `, such as
|
|
86
|
+
* `all: env-var-config-secret-ui=true; team: x="y"`; `undefined` for none.
|
|
87
|
+
*/
|
|
88
|
+
export declare function describeFeatureFlags(flags: FeatureFlags): string | undefined;
|
|
89
|
+
/** Whether ending a shared container after a failed test succeeded, and why it failed if not. */
|
|
90
|
+
export type SharedContainerEnding = {
|
|
91
|
+
readonly kind: "ended";
|
|
92
|
+
} | {
|
|
93
|
+
readonly kind: "failed";
|
|
94
|
+
readonly message: string;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* What a failed test prints about the container its file's tests share: `containerFailureReport` over only the
|
|
98
|
+
* factory calls and API requests the test made, those after the counts in `before`, and a line saying the
|
|
99
|
+
* container is shared, how many of each earlier tests made, and whether ending it after this failure succeeded.
|
|
100
|
+
*/
|
|
101
|
+
export declare function sharedContainerFailureReport(container: Omit<ContainerReport, "log">, before: {
|
|
102
|
+
readonly factoryCalls: number;
|
|
103
|
+
readonly apiRequests: number;
|
|
104
|
+
}, log: ContainerLogSlice, ending: SharedContainerEnding): string;
|
|
105
|
+
/**
|
|
106
|
+
* What a verbose run prints as the proxy records a request: the request line with its bodies, as a failure report
|
|
107
|
+
* would show it, naming the test id.
|
|
108
|
+
*/
|
|
109
|
+
export declare function proxyRequestReport(testId: string, request: ProxyRequestRecord, redact: Redact): string;
|
|
110
|
+
/**
|
|
111
|
+
* One warmup as a failure report's line: how many services, how long, and each that failed with why, such as
|
|
112
|
+
* `warmup: 3 services in 2140ms, 1 failed (api-projects: HTTP 500: …)`.
|
|
113
|
+
*/
|
|
114
|
+
export declare function describeWarmup(warmup: ServiceWarmup, redact: Redact): string;
|
|
115
|
+
/**
|
|
116
|
+
* What a verbose run prints once a container has started: what it is for, whether it replaced the file's container
|
|
117
|
+
* because the feature flags differ, how long it took, how many feature flags it has, any warmup after it with the
|
|
118
|
+
* services that failed, and its test id, such as `storm: started a container for the file a.test.ts in 812ms, 1
|
|
119
|
+
* feature flag, warmed 3 services in 2140ms (1 failed: api-projects), test id ts-…`.
|
|
120
|
+
*/
|
|
121
|
+
export declare function containerStartReport(start: {
|
|
122
|
+
readonly name: string;
|
|
123
|
+
readonly scope: "file" | "test";
|
|
124
|
+
readonly ms: number;
|
|
125
|
+
readonly testId: string;
|
|
126
|
+
readonly featureFlags?: FeatureFlags;
|
|
127
|
+
readonly replaced?: true;
|
|
128
|
+
readonly warmup?: {
|
|
129
|
+
readonly ms: number;
|
|
130
|
+
readonly warmup: ServiceWarmup;
|
|
131
|
+
};
|
|
132
|
+
}): string;
|
|
133
|
+
/**
|
|
134
|
+
* What a failed test prints about its proxy: each request it received, with its bodies beneath it, then each fault
|
|
135
|
+
* rule with hits left (its method, path template, action, and hits of its times), every line through `redact` (the
|
|
136
|
+
* container's, so a secret the proxy's own redaction can't know of, such as another seeded token, reads `<token>`
|
|
137
|
+
* too).
|
|
138
|
+
*/
|
|
139
|
+
export declare function proxyFailureReport(testId: string, requests: readonly ProxyRequestRecord[], redact: Redact, faults?: readonly FaultHandle[]): string;
|
|
140
|
+
/**
|
|
141
|
+
* Why a test fails when its proxy forwarded a request under a fault rule and Testserver failed, with no answer or
|
|
142
|
+
* one that stopped before its end, naming each such request, through `redact`; `undefined` when none did. A status
|
|
143
|
+
* Testserver answered is never a failure.
|
|
144
|
+
*/
|
|
145
|
+
export declare function faultUpstreamFailure(requests: readonly ProxyRequestRecord[], redact: Redact): string | undefined;
|
|
146
|
+
export {};
|