@cnc-tools/storm 0.9.0 → 0.9.1
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/storm.js +3 -14
- package/dist/application.d.ts +18 -10
- package/dist/application.js +10 -11
- package/dist/bin/storm.js +97 -41
- package/dist/build-info.js +1 -1
- package/dist/chunks/chunk-5CQCRX2L.js +5768 -0
- package/dist/chunks/chunk-5U5Q6VZR.js +556 -0
- package/dist/chunks/chunk-7O6UN63H.js +63 -0
- package/dist/chunks/chunk-I5GZLOLQ.js +38 -0
- package/dist/chunks/chunk-NX55IJ5S.js +1842 -0
- package/dist/chunks/chunk-OCZJE5XV.js +910 -0
- package/dist/chunks/chunk-RRQ2ZGSE.js +1512 -0
- package/dist/chunks/chunk-S5NAIZYS.js +13 -0
- package/dist/chunks/chunk-UHO5OCEX.js +360 -0
- package/dist/chunks/chunk-WBIHJM7D.js +188 -0
- package/dist/chunks/chunk-WV6WQFC6.js +436 -0
- package/dist/chunks/live-app-X3PW2W42.js +89 -0
- package/dist/chunks/version-X7RMSKZI.js +12 -0
- package/dist/commands/exec/command.js +35 -21
- package/dist/commands/exec/metadata.js +66 -58
- package/dist/commands/exec/redaction.js +1 -1
- package/dist/commands/exec/run-collector.d.ts +1 -1
- package/dist/commands/exec/run-collector.js +1 -1
- package/dist/commands/exec/run-record.d.ts +1 -1
- package/dist/commands/exec/tests-summary.d.ts +1 -1
- package/dist/commands/exec/worker-chart.d.ts +1 -1
- package/dist/commands/runs/list/command.js +136 -33
- package/dist/commands/runs/list/metadata.js +22 -18
- package/dist/commands/runs/logs/command.js +131 -48
- package/dist/commands/runs/logs/metadata.js +24 -20
- package/dist/commands/runs/metadata.js +6 -2
- package/dist/commands/runs/past-run.d.ts +1 -1
- package/dist/commands/runs/past-run.js +1 -1
- package/dist/commands/runs/show/command.js +396 -74
- package/dist/commands/runs/show/metadata.js +24 -20
- package/dist/commands/vitest/command.js +195 -128
- package/dist/commands/vitest/metadata.js +45 -37
- package/dist/context.d.ts +1 -1
- package/dist/core/events.d.ts +1 -1
- package/dist/core/payload.d.ts +1 -1
- package/dist/core/payload.js +1 -1
- package/dist/core/provider.d.ts +12 -2
- package/dist/core/run.js +1 -1
- package/dist/live-app.d.ts +9 -0
- package/dist/live-app.js +21 -0
- package/dist/resource-commands.d.ts +13 -0
- package/dist/resource-commands.js +22 -0
- package/dist/resources/github/provider.d.ts +1 -1
- package/dist/resources/testserver/command-tree.d.ts +4 -0
- package/dist/resources/testserver/command-tree.js +12 -0
- package/dist/resources/testserver/commands/create/command.js +373 -194
- package/dist/resources/testserver/commands/create/metadata.js +52 -48
- package/dist/resources/testserver/commands/list/command.js +195 -50
- package/dist/resources/testserver/commands/list/metadata.js +12 -8
- package/dist/resources/testserver/provider.d.ts +1 -1
- package/dist/resources/testserver/resource-provider.js +2 -8
- package/dist/resources.d.ts +0 -3
- package/dist/resources.js +5 -10
- package/dist/runner/recipe.js +1 -1
- package/dist/runner/remote-command.js +1 -1
- package/dist/sdk/host.d.ts +2 -0
- package/dist/sdk/host.js +7 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +10 -11
- package/dist/vitest/config.d.ts +4 -8
- package/dist/vitest/config.js +5 -9
- package/dist/vitest/container-scope.d.ts +12 -5
- package/dist/vitest/container-scope.js +27 -4
- package/dist/vitest/diagnostics.d.ts +8 -2
- package/dist/vitest/diagnostics.js +7 -4
- package/dist/vitest/fixtures.d.ts +4 -1
- package/dist/vitest/fixtures.js +17 -6
- package/dist/vitest/plan.d.ts +1 -1
- package/dist/vitest/plan.js +2 -2
- package/dist/vitest/sandbox.d.ts +6 -0
- package/dist/vitest/sandbox.js +6 -0
- package/package.json +4 -3
- package/bin/node-version.js +0 -24
- package/dist/closed-terminal.d.ts +0 -7
- package/dist/closed-terminal.js +0 -18
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Container, ServiceWarmup, TestserverServiceId } from "../sdk/index.ts";
|
|
2
2
|
/**
|
|
3
3
|
* How long the Vitest adapter's container lives: `'file'`, one container shared by a test file's tests and replaced
|
|
4
|
-
* after a
|
|
4
|
+
* after a test that failed because of a Testserver failure (`endsSharedContainer`) or for a test with different
|
|
5
|
+
* feature flags, or `'test'`, one per test.
|
|
5
6
|
*/
|
|
6
7
|
export type ContainerScope = "file" | "test";
|
|
7
8
|
/** The default container scope: a test file's tests share one container. */
|
|
@@ -64,6 +65,11 @@ export interface ContainerRequest<C extends SharedContainer> {
|
|
|
64
65
|
readonly isConcurrent: boolean;
|
|
65
66
|
/** Whether the test has failed so far: its body or `afterEach`, when asked in the fixture's cleanup. */
|
|
66
67
|
readonly failed: () => boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Whether a fixture saw Testserver fail the test in a way the container's own records don't hold, such as a
|
|
70
|
+
* request a fault rule on the test's proxy forwarded, asked in the failure handler.
|
|
71
|
+
*/
|
|
72
|
+
readonly testserverFailed: () => boolean;
|
|
67
73
|
/** The canonical key of the test's feature flags (`featureFlagsKey`), which the file's container must match. */
|
|
68
74
|
readonly featureFlagsKey: string;
|
|
69
75
|
/** Starts the file's container, in `'file'` scope, saying whether it replaces one with other feature flags. */
|
|
@@ -84,10 +90,11 @@ export interface ContainerRequest<C extends SharedContainer> {
|
|
|
84
90
|
* flags differ from the test's. A test that aborts while it is starting never gets it, but the container stays the
|
|
85
91
|
* file's, for its next test. A test handed a container an
|
|
86
92
|
* 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
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
93
|
+
* After a failed test, the test's failure handler, which Vitest awaits even when a fixture's cleanup throws, reads
|
|
94
|
+
* the container log, then ends the container when the failure may come from it (`endsSharedContainer`), so the next
|
|
95
|
+
* test that asks starts a new one, and otherwise keeps it for the next test. The failure report covers only this
|
|
96
|
+
* test's factory calls, API requests and container log, and says whether the container was kept, ended, or failed to
|
|
97
|
+
* end. A concurrent test can't share the file's container, and fails before anything starts.
|
|
91
98
|
*/
|
|
92
99
|
export declare function provideContainer<C extends SharedContainer>(request: ContainerRequest<C>): Promise<C>;
|
|
93
100
|
/**
|
|
@@ -96,10 +96,11 @@ export class FileContainer {
|
|
|
96
96
|
* flags differ from the test's. A test that aborts while it is starting never gets it, but the container stays the
|
|
97
97
|
* file's, for its next test. A test handed a container an
|
|
98
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
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
99
|
+
* After a failed test, the test's failure handler, which Vitest awaits even when a fixture's cleanup throws, reads
|
|
100
|
+
* the container log, then ends the container when the failure may come from it (`endsSharedContainer`), so the next
|
|
101
|
+
* test that asks starts a new one, and otherwise keeps it for the next test. The failure report covers only this
|
|
102
|
+
* test's factory calls, API requests and container log, and says whether the container was kept, ended, or failed to
|
|
103
|
+
* end. A concurrent test can't share the file's container, and fails before anything starts.
|
|
103
104
|
*/
|
|
104
105
|
export async function provideContainer(request) {
|
|
105
106
|
const { signal, onCleanup, onTestFailed, report } = request;
|
|
@@ -130,6 +131,11 @@ export async function provideContainer(request) {
|
|
|
130
131
|
const before = { factoryCalls: container.factoryCalls.length, apiRequests: container.apiRequests.length };
|
|
131
132
|
onTestFailed(async () => {
|
|
132
133
|
const log = await readLog(container, (records) => sliceAfter(records, note));
|
|
134
|
+
const testserverFailed = request.testserverFailed();
|
|
135
|
+
if (!endsSharedContainer({ container, before, log, aborted: signal.aborted, testserverFailed })) {
|
|
136
|
+
report(sharedContainerFailureReport(reportOf(container), before, log, { kind: "kept" }));
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
133
139
|
try {
|
|
134
140
|
await fileContainer.discard(container);
|
|
135
141
|
}
|
|
@@ -141,6 +147,23 @@ export async function provideContainer(request) {
|
|
|
141
147
|
});
|
|
142
148
|
return container;
|
|
143
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Whether a failed test's failure may come from the file's container, so `'file'` scope ends the container rather
|
|
152
|
+
* than hand it to the file's next test. It reads what the adapter recorded of the test, never the test's errors: the
|
|
153
|
+
* test was aborted (a timeout aborts it); one of the factory calls or API requests it made, those after the counts in
|
|
154
|
+
* `before`, failed, whether the test caught the error or not; a fixture saw Testserver fail the test
|
|
155
|
+
* (`testserverFailed`, `ContainerRequest.testserverFailed`), as `proxy` does when a fault rule forwarded a request and
|
|
156
|
+
* Testserver failed; or the failure handler couldn't read the container log. Any other failure, such as a failed
|
|
157
|
+
* assertion or an error the test threw, says nothing about the container.
|
|
158
|
+
*/
|
|
159
|
+
function endsSharedContainer(test) {
|
|
160
|
+
const { container, before } = test;
|
|
161
|
+
return (test.aborted ||
|
|
162
|
+
test.testserverFailed ||
|
|
163
|
+
test.log.kind === "unreadable" ||
|
|
164
|
+
container.factoryCalls.slice(before.factoryCalls).some((call) => !call.outcome.ok) ||
|
|
165
|
+
container.apiRequests.slice(before.apiRequests).some((request) => request.error !== undefined));
|
|
166
|
+
}
|
|
144
167
|
/** Notes the last record of a reused container's log. A read that fails is noted, not thrown: the test runs on. */
|
|
145
168
|
async function noteLog(container) {
|
|
146
169
|
try {
|
|
@@ -86,8 +86,13 @@ export declare function containerFailureReport(report: ContainerReport): string;
|
|
|
86
86
|
* `all: env-var-config-secret-ui=true; team: x="y"`; `undefined` for none.
|
|
87
87
|
*/
|
|
88
88
|
export declare function describeFeatureFlags(flags: FeatureFlags): string | undefined;
|
|
89
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* What became of a shared container after a failed test: `kept` for the file's next test, since the failure said
|
|
91
|
+
* nothing about the container, `ended`, or `failed` to end, with why.
|
|
92
|
+
*/
|
|
90
93
|
export type SharedContainerEnding = {
|
|
94
|
+
readonly kind: "kept";
|
|
95
|
+
} | {
|
|
91
96
|
readonly kind: "ended";
|
|
92
97
|
} | {
|
|
93
98
|
readonly kind: "failed";
|
|
@@ -96,7 +101,8 @@ export type SharedContainerEnding = {
|
|
|
96
101
|
/**
|
|
97
102
|
* What a failed test prints about the container its file's tests share: `containerFailureReport` over only the
|
|
98
103
|
* 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
|
|
104
|
+
* container is shared, how many of each earlier tests made, and whether it was kept for the file's next test, or
|
|
105
|
+
* ended after this failure, or failed to end.
|
|
100
106
|
*/
|
|
101
107
|
export declare function sharedContainerFailureReport(container: Omit<ContainerReport, "log">, before: {
|
|
102
108
|
readonly factoryCalls: number;
|
|
@@ -193,7 +193,8 @@ function countFeatureFlags(flags) {
|
|
|
193
193
|
/**
|
|
194
194
|
* What a failed test prints about the container its file's tests share: `containerFailureReport` over only the
|
|
195
195
|
* factory calls and API requests the test made, those after the counts in `before`, and a line saying the
|
|
196
|
-
* container is shared, how many of each earlier tests made, and whether
|
|
196
|
+
* container is shared, how many of each earlier tests made, and whether it was kept for the file's next test, or
|
|
197
|
+
* ended after this failure, or failed to end.
|
|
197
198
|
*/
|
|
198
199
|
export function sharedContainerFailureReport(container, before, log, ending) {
|
|
199
200
|
const own = containerFailureReport({
|
|
@@ -211,9 +212,11 @@ export function sharedContainerFailureReport(container, before, log, ending) {
|
|
|
211
212
|
: [`${before.apiRequests} API ${before.apiRequests === 1 ? "request" : "requests"}`]),
|
|
212
213
|
];
|
|
213
214
|
const earlier = counts.length === 0 ? "" : `, after ${counts.join(" and ")} by earlier tests`;
|
|
214
|
-
const end = ending.kind === "
|
|
215
|
-
? "
|
|
216
|
-
:
|
|
215
|
+
const end = ending.kind === "kept"
|
|
216
|
+
? "kept for the file's next test (not a Testserver failure)"
|
|
217
|
+
: ending.kind === "ended"
|
|
218
|
+
? "ended after this failure"
|
|
219
|
+
: `ending it after this failure failed: ${container.redact(ending.message)}`;
|
|
217
220
|
return `${own}\n(container shared by this file's tests${earlier}; ${end})`;
|
|
218
221
|
}
|
|
219
222
|
/**
|
|
@@ -42,7 +42,10 @@ declare module "vitest" {
|
|
|
42
42
|
* or `describe` with `test.override({ featureFlags })`; a value replaces the whole object. In `'file'` scope, a
|
|
43
43
|
* test whose feature flags differ from those of the file's container ends it and starts a new one.
|
|
44
44
|
* - `container`: in `'file'` scope, the file's container, labeled with the file's path, started by the file's first
|
|
45
|
-
* test that asks for it
|
|
45
|
+
* test that asks for it. A failed test that used it ends it when its failure may come from the container, such as
|
|
46
|
+
* a failed factory call or API request, a fault rule's forwarded request Testserver failed, or a timeout, so the
|
|
47
|
+
* next test that asks starts a new one, and leaves it for the next test otherwise, such as after a failed
|
|
48
|
+
* assertion.
|
|
46
49
|
* A concurrent test fails instead. In `'test'` scope, a container started for the test, labeled with the test's
|
|
47
50
|
* name, and ended after it. The test's `task.meta.storm` records the Testserver URL and, once the test has the
|
|
48
51
|
* container, its test id.
|
package/dist/vitest/fixtures.js
CHANGED
|
@@ -56,10 +56,14 @@ const fixtures = vitestTest
|
|
|
56
56
|
onCleanup(() => closeFile(file.container, file.acquisitions));
|
|
57
57
|
return file;
|
|
58
58
|
})
|
|
59
|
+
// Per test: whether a fixture saw Testserver fail the test in a way the container's own records don't hold, which
|
|
60
|
+
// the container's failure handler reads. `proxy` sets it; vitest sets it up again for each attempt.
|
|
61
|
+
// oxlint-disable-next-line no-empty-pattern -- vitest requires a fixture to destructure its first argument
|
|
62
|
+
.extend("stormTestserverFailure", ({}) => ({ failed: false }))
|
|
59
63
|
.extend("containerScope", CONTAINER_SCOPE)
|
|
60
64
|
.extend("warmServices", NO_SERVICES)
|
|
61
65
|
.extend("featureFlags", NO_FEATURE_FLAGS)
|
|
62
|
-
.extend("container", async ({ containerScope, warmServices, featureFlags, stormFile, stormEvents, testserverUrl, verbose, task, signal, onTestFailed, }, { onCleanup }) => {
|
|
66
|
+
.extend("container", async ({ containerScope, warmServices, featureFlags, stormFile, stormTestserverFailure, stormEvents, testserverUrl, verbose, task, signal, onTestFailed, }, { onCleanup }) => {
|
|
63
67
|
// Starts a container labeled `name` with `featureFlags`, then warms `warmServices`, both the start's test's, in
|
|
64
68
|
// it, reporting both as one container start. Under a verbose run, each container start prints as it ends, for
|
|
65
69
|
// passing tests too, saying when it replaced the file's container because the feature flags differ.
|
|
@@ -88,6 +92,7 @@ const fixtures = vitestTest
|
|
|
88
92
|
onTestFailed,
|
|
89
93
|
isConcurrent: task.concurrent === true,
|
|
90
94
|
failed: () => task.result?.state === "fail",
|
|
95
|
+
testserverFailed: () => stormTestserverFailure.failed,
|
|
91
96
|
featureFlagsKey: featureFlagsKey(featureFlags),
|
|
92
97
|
startShared: (replacing) => startWarmed("file", task.file.name, replacing),
|
|
93
98
|
startOwn: () => startWarmed("test", task.name),
|
|
@@ -97,19 +102,22 @@ const fixtures = vitestTest
|
|
|
97
102
|
return container;
|
|
98
103
|
})
|
|
99
104
|
.extend("seed", ({ container }) => seeder(container))
|
|
100
|
-
.extend("proxy", async ({ container, stormFile, verbose, signal, onTestFailed }, { onCleanup }) => {
|
|
105
|
+
.extend("proxy", async ({ container, stormFile, stormTestserverFailure, verbose, signal, onTestFailed }, { onCleanup }) => {
|
|
101
106
|
// Under a verbose run, each request prints as the proxy records it, for passing tests too.
|
|
102
107
|
const onRequest = verbose
|
|
103
108
|
? (record) => console.error(proxyRequestReport(container.testId, record, (text) => container.redact(text)))
|
|
104
109
|
: undefined;
|
|
105
110
|
const proxy = await stormFile.acquisitions.track(signal, acquireOwned(signal, onCleanup, () => startProxy({ container, ...(onRequest === undefined ? {} : { onRequest }) }),
|
|
106
111
|
// Checked once closed, when every record has ended: a test whose fault rule forwarded a request Testserver
|
|
107
|
-
// failed fails, since its premise, what Testserver answered, never held
|
|
112
|
+
// failed fails, since its premise, what Testserver answered, never held, and in `'file'` scope ends the
|
|
113
|
+
// file's container.
|
|
108
114
|
async (owned) => {
|
|
109
115
|
await owned.close();
|
|
110
116
|
const failure = faultUpstreamFailure(owned.requests, (text) => owned.redact(text));
|
|
111
|
-
if (failure
|
|
112
|
-
|
|
117
|
+
if (failure === undefined)
|
|
118
|
+
return;
|
|
119
|
+
stormTestserverFailure.failed = true;
|
|
120
|
+
throw new Error(failure);
|
|
113
121
|
}));
|
|
114
122
|
onTestFailed(() => {
|
|
115
123
|
console.error(proxyFailureReport(container.testId, proxy.requests, (text) => proxy.redact(text), proxy.faults));
|
|
@@ -147,7 +155,10 @@ const fixtures = vitestTest
|
|
|
147
155
|
* or `describe` with `test.override({ featureFlags })`; a value replaces the whole object. In `'file'` scope, a
|
|
148
156
|
* test whose feature flags differ from those of the file's container ends it and starts a new one.
|
|
149
157
|
* - `container`: in `'file'` scope, the file's container, labeled with the file's path, started by the file's first
|
|
150
|
-
* test that asks for it
|
|
158
|
+
* test that asks for it. A failed test that used it ends it when its failure may come from the container, such as
|
|
159
|
+
* a failed factory call or API request, a fault rule's forwarded request Testserver failed, or a timeout, so the
|
|
160
|
+
* next test that asks starts a new one, and leaves it for the next test otherwise, such as after a failed
|
|
161
|
+
* assertion.
|
|
151
162
|
* A concurrent test fails instead. In `'test'` scope, a container started for the test, labeled with the test's
|
|
152
163
|
* name, and ended after it. The test's `task.meta.storm` records the Testserver URL and, once the test has the
|
|
153
164
|
* container, its test id.
|
package/dist/vitest/plan.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { VitestListFailure, VitestListGateway } from "./gateways.ts";
|
|
|
2
2
|
export { VITEST_BIN, vitestSearchDirectories } from "./find-vitest.ts";
|
|
3
3
|
export type { FindVitestRequest, FindVitestResult, ListedTest, VitestListFailure, VitestListGateway, VitestListRequest, VitestListResult, } from "./gateways.ts";
|
|
4
4
|
export { liveVitestListGateway } from "./live/list-gateway.ts";
|
|
5
|
-
export { WORKERS_PER_SANDBOX } from "./
|
|
5
|
+
export { WORKERS_PER_SANDBOX } from "./sandbox.ts";
|
|
6
6
|
/** How long `listVitestTests` lets `vitest list` run by default. */
|
|
7
7
|
export declare const LIST_TIMEOUT_MS = 60000;
|
|
8
8
|
/** How many tests a Vitest run would run, and in how many files. */
|
package/dist/vitest/plan.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
// for them, and the `vitest run` argv. It is the adapter's one entry point for the CLI: `storm vitest` imports it
|
|
4
4
|
// and nothing else of the adapter. Like `config.ts`, it imports neither `./fixtures.ts` nor vitest: the CLI and a
|
|
5
5
|
// launcher script run outside a Vitest run, where the adapter's `test` throws.
|
|
6
|
-
import { WORKERS_PER_SANDBOX } from "./
|
|
6
|
+
import { WORKERS_PER_SANDBOX } from "./sandbox.js";
|
|
7
7
|
import { readVitestList } from "./list-output.js";
|
|
8
8
|
import { liveVitestListGateway } from "./live/list-gateway.js";
|
|
9
9
|
export { VITEST_BIN, vitestSearchDirectories } from "./find-vitest.js";
|
|
10
10
|
export { liveVitestListGateway } from "./live/list-gateway.js";
|
|
11
|
-
export { WORKERS_PER_SANDBOX } from "./
|
|
11
|
+
export { WORKERS_PER_SANDBOX } from "./sandbox.js";
|
|
12
12
|
/** How long `listVitestTests` lets `vitest list` run by default. */
|
|
13
13
|
export const LIST_TIMEOUT_MS = 60_000;
|
|
14
14
|
/**
|
package/dist/vitest/sandbox.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { RunPayload } from "../sdk/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The vitest workers per Testserver sandbox `testserverWorkers` sizes for by default: about the number of
|
|
4
|
+
* concurrent test ids a Testserver sandbox serves before its service boots slow down. It lives here, not in
|
|
5
|
+
* `config.ts`, so `plan.ts`, which the CLI loads, reads it without loading the SDK's run payload reader.
|
|
6
|
+
*/
|
|
7
|
+
export declare const WORKERS_PER_SANDBOX = 4;
|
|
2
8
|
/** What a test that needs a Testserver sandbox fails with in a run that holds none. */
|
|
3
9
|
export declare const NO_TESTSERVER_MESSAGE = "this run has no Testserver; add resources.testserverPool to storm.config.ts or pass --testserver-sandboxes <n>";
|
|
4
10
|
/**
|
package/dist/vitest/sandbox.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
// Which Testserver sandbox a vitest worker uses, and how many Testserver sandboxes a run counts for sizing workers.
|
|
2
2
|
// Pure: no vitest import, so `config.ts`, which a `vitest.config.ts` loads, can use it.
|
|
3
|
+
/**
|
|
4
|
+
* The vitest workers per Testserver sandbox `testserverWorkers` sizes for by default: about the number of
|
|
5
|
+
* concurrent test ids a Testserver sandbox serves before its service boots slow down. It lives here, not in
|
|
6
|
+
* `config.ts`, so `plan.ts`, which the CLI loads, reads it without loading the SDK's run payload reader.
|
|
7
|
+
*/
|
|
8
|
+
export const WORKERS_PER_SANDBOX = 4;
|
|
3
9
|
/** What a test that needs a Testserver sandbox fails with in a run that holds none. */
|
|
4
10
|
export const NO_TESTSERVER_MESSAGE = "this run has no Testserver; add resources.testserverPool to storm.config.ts or pass --testserver-sandboxes <n>";
|
|
5
11
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cnc-tools/storm",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Run a command against Vercel Testserver sandboxes",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -90,13 +90,14 @@
|
|
|
90
90
|
"registry": "https://registry.npmjs.org/"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@vercel/clinkr": "npm:clinkr@^0.10.
|
|
93
|
+
"@vercel/clinkr": "npm:clinkr@^0.10.1",
|
|
94
94
|
"@vercel/sandbox": "3.9.0",
|
|
95
95
|
"zod": "^4.6.5"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@types/node": "^24.19.1",
|
|
99
99
|
"@xterm/headless": "^6.0.0",
|
|
100
|
+
"esbuild": "^0.27.7",
|
|
100
101
|
"typescript": "^7.0.2",
|
|
101
102
|
"typescript-5": "npm:typescript@5.9.3",
|
|
102
103
|
"vitest": "4.1.10"
|
|
@@ -113,7 +114,7 @@
|
|
|
113
114
|
"node": ">=22.19.0"
|
|
114
115
|
},
|
|
115
116
|
"scripts": {
|
|
116
|
-
"build": "tsc -p tsconfig.build.json && node scripts/write-build-info.js",
|
|
117
|
+
"build": "tsc -p tsconfig.build.json && node scripts/bundle.js && node scripts/write-build-info.js",
|
|
117
118
|
"typecheck": "tsc --noEmit && tsc -p tsconfig.sdk.json",
|
|
118
119
|
"test": "pnpm run test:default && pnpm run test:integration",
|
|
119
120
|
"test:default": "vitest run --project default --project sanity",
|
package/bin/node-version.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// The Node version check `storm.js` runs before it loads anything else. Plain JavaScript without
|
|
2
|
-
// syntax newer than Node 12's (no `?.`, no `??`), so an old Node reaches the message instead of a
|
|
3
|
-
// syntax error.
|
|
4
|
-
|
|
5
|
-
const REQUIRED = [22, 19, 0];
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The message to print when `version` (as in `process.versions.node`, such as `22.18.0`) is older
|
|
9
|
-
* than Node 22.19.0, or `undefined` when it is new enough.
|
|
10
|
-
*
|
|
11
|
-
* @param {string} version
|
|
12
|
-
* @returns {string | undefined}
|
|
13
|
-
*/
|
|
14
|
-
export function nodeVersionProblem(version) {
|
|
15
|
-
// A part that isn't a number counts as 0, and so does a missing one.
|
|
16
|
-
const parts = version.split(".").map((part) => Number.parseInt(part, 10) || 0);
|
|
17
|
-
for (let index = 0; index < REQUIRED.length; index++) {
|
|
18
|
-
const part = parts[index] ?? 0;
|
|
19
|
-
const required = REQUIRED[index] ?? 0;
|
|
20
|
-
if (part > required) return undefined;
|
|
21
|
-
if (part < required) return `storm needs Node 22.19 or later (this is Node ${version})`;
|
|
22
|
-
}
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Whether `error` is a write to a terminal that has closed. */
|
|
2
|
-
export declare function isClosedTerminalError(error: unknown): boolean;
|
|
3
|
-
/**
|
|
4
|
-
* The exit status after a closed terminal kept the outcome from being written: the status the command recorded
|
|
5
|
-
* (a run's command's code), else 128 + n for the first signal, as Clinkr would have exited, else 1.
|
|
6
|
-
*/
|
|
7
|
-
export declare function closedTerminalStatus(recorded: number | undefined, signalReason: unknown): number;
|
package/dist/closed-terminal.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// What storm exits with when Clinkr can't write a command's outcome because the terminal has closed. After
|
|
2
|
-
// SIGHUP from a closed terminal, a write to it fails with EIO, which Clinkr's writer rejects with (unlike EPIPE, a
|
|
3
|
-
// closed pipe, which it ignores). By then the command has returned: a run has stopped and deleted its sandboxes and
|
|
4
|
-
// released its leases, and only its outcome went unwritten.
|
|
5
|
-
import { NodeSignalCancellation } from "@vercel/clinkr/node";
|
|
6
|
-
/** Whether `error` is a write to a terminal that has closed. */
|
|
7
|
-
export function isClosedTerminalError(error) {
|
|
8
|
-
return error instanceof Error && Reflect.get(error, "code") === "EIO";
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* The exit status after a closed terminal kept the outcome from being written: the status the command recorded
|
|
12
|
-
* (a run's command's code), else 128 + n for the first signal, as Clinkr would have exited, else 1.
|
|
13
|
-
*/
|
|
14
|
-
export function closedTerminalStatus(recorded, signalReason) {
|
|
15
|
-
if (recorded !== undefined)
|
|
16
|
-
return recorded;
|
|
17
|
-
return signalReason instanceof NodeSignalCancellation ? signalReason.exitStatus : 1;
|
|
18
|
-
}
|