@cnc-tools/storm 0.12.0 → 0.14.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/dist/application.js +5 -1
- package/dist/bin/storm.js +6 -2
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-FK4RLDEK.js → chunk-27P2QSIM.js} +1 -1
- package/dist/chunks/{chunk-ODQHQJLE.js → chunk-5ED3IDUJ.js} +749 -1121
- package/dist/chunks/{chunk-FSP3SJ35.js → chunk-5TMHYH7G.js} +16 -46
- package/dist/chunks/{chunk-Y3BUNNRG.js → chunk-BFLYGMG3.js} +12 -7
- package/dist/chunks/{chunk-LQKNI3EG.js → chunk-BRUIATTR.js} +6 -6
- package/dist/chunks/{chunk-RYRJNHL7.js → chunk-HOKDKP5A.js} +3 -9
- package/dist/chunks/{chunk-SXW6XN4R.js → chunk-IVRRGGCD.js} +60 -20
- package/dist/chunks/{chunk-TMQQYHUX.js → chunk-QBR5VHJ7.js} +1 -1
- package/dist/chunks/{chunk-YT5OROR7.js → chunk-RA4L2ACU.js} +12 -2
- package/dist/chunks/{chunk-TEEZL3GA.js → chunk-RKONDLPS.js} +17 -71
- package/dist/chunks/{chunk-IYM44FUX.js → chunk-UC6DULWY.js} +2 -2
- package/dist/chunks/{chunk-4XT5RC5T.js → chunk-XPCUINWS.js} +6 -42
- package/dist/chunks/{chunk-U7M3ZB3Z.js → chunk-YBPTMJUM.js} +123 -180
- package/dist/chunks/{chunk-ISGQJIQM.js → chunk-Z5OXOZD3.js} +125 -83
- package/dist/chunks/{chunk-7D6LC5JY.js → chunk-ZH5R7W4A.js} +7 -39
- package/dist/chunks/{live-app-AZ5N5HBD.js → live-app-FBVWUUMT.js} +7 -7
- package/dist/commands/exec/command.d.ts +4 -90
- package/dist/commands/exec/command.js +15 -41
- package/dist/commands/exec/define-run-command.d.ts +19 -100
- package/dist/commands/exec/define-run-command.js +48 -15
- package/dist/commands/exec/driver-plan.d.ts +24 -16
- package/dist/commands/exec/driver-plan.js +34 -15
- package/dist/commands/exec/driver-refusals.js +7 -6
- package/dist/commands/exec/exec-words.d.ts +1 -1
- package/dist/commands/exec/exec-words.js +8 -2
- package/dist/commands/exec/final-results.d.ts +39 -0
- package/dist/commands/exec/final-results.js +29 -0
- package/dist/commands/exec/live-view.js +18 -22
- package/dist/commands/exec/metadata.js +1 -1
- package/dist/commands/exec/outcomes.d.ts +15 -109
- package/dist/commands/exec/outcomes.js +25 -39
- package/dist/commands/exec/plan-run.d.ts +11 -3
- package/dist/commands/exec/plan-run.js +3 -2
- package/dist/commands/exec/progress.d.ts +3 -19
- package/dist/commands/exec/progress.js +16 -60
- package/dist/commands/exec/run-command.d.ts +5 -24
- package/dist/commands/exec/run-command.js +32 -84
- package/dist/commands/exec/run-metadata.d.ts +0 -6
- package/dist/commands/exec/run-metadata.js +2 -8
- package/dist/commands/exec/snapshot-text.d.ts +7 -16
- package/dist/commands/exec/snapshot-text.js +9 -49
- package/dist/commands/exec/test-plan.d.ts +2 -1
- package/dist/commands/exec/test-plan.js +13 -4
- package/dist/commands/exec/tests-summary.d.ts +2 -2
- package/dist/commands/exec/view.js +2 -12
- package/dist/commands/exec/worker-chart.d.ts +1 -1
- package/dist/commands/playwright/command.d.ts +12 -97
- package/dist/commands/playwright/command.js +14 -14
- package/dist/commands/playwright/metadata.js +2 -2
- package/dist/commands/runs/facts.d.ts +1 -37
- package/dist/commands/runs/facts.js +4 -36
- package/dist/commands/runs/list/command.d.ts +0 -72
- package/dist/commands/runs/list/command.js +6 -6
- package/dist/commands/runs/list/outcomes.d.ts +0 -36
- package/dist/commands/runs/logs/command.js +6 -6
- package/dist/commands/runs/show/command.d.ts +2 -74
- package/dist/commands/runs/show/command.js +16 -43
- package/dist/commands/runs/show/metadata.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +1 -37
- package/dist/commands/runs/show/outcomes.js +8 -42
- package/dist/commands/snapshots/build/command.d.ts +14 -411
- package/dist/commands/snapshots/build/command.js +59 -234
- package/dist/commands/snapshots/build/metadata.js +10 -7
- package/dist/commands/snapshots/build/outcomes.d.ts +11 -241
- package/dist/commands/snapshots/build/outcomes.js +29 -196
- package/dist/commands/snapshots/list/command.d.ts +2 -36
- package/dist/commands/snapshots/list/command.js +20 -56
- package/dist/commands/snapshots/list/metadata.js +1 -1
- package/dist/commands/snapshots/list/outcomes.d.ts +2 -37
- package/dist/commands/snapshots/list/outcomes.js +13 -53
- package/dist/commands/vitest/command.d.ts +14 -98
- package/dist/commands/vitest/command.js +14 -14
- package/dist/commands/vitest/metadata.js +2 -2
- package/dist/config/resolve.d.ts +1 -1
- package/dist/config/resolve.js +2 -1
- package/dist/config/schema.d.ts +8 -0
- package/dist/config/schema.js +5 -4
- package/dist/core/events.d.ts +5 -6
- package/dist/core/run-state.d.ts +7 -29
- package/dist/core/run-state.js +3 -26
- package/dist/core/run.d.ts +6 -14
- package/dist/core/run.js +17 -28
- package/dist/extensions/playwright/driver.js +17 -10
- package/dist/extensions/testserver/commands/pool/create/command.js +4 -4
- package/dist/extensions/testserver/commands/pool/list/command.js +2 -2
- package/dist/extensions/testserver/definition.d.ts +1 -1
- package/dist/extensions/testserver/extension.d.ts +1 -1
- package/dist/extensions/testserver/options/rules.d.ts +3 -3
- package/dist/extensions/testserver/options/rules.js +5 -5
- package/dist/extensions/testserver/resource.d.ts +1 -1
- package/dist/extensions/testserver/vercel-cli/index.d.ts +1 -0
- package/dist/extensions/testserver/vercel-cli/index.js +1 -0
- package/dist/extensions/testserver/vercel-cli/report.js +5 -2
- package/dist/extensions/testserver/vercel-cli/session-id.d.ts +8 -0
- package/dist/extensions/testserver/vercel-cli/session-id.js +16 -0
- package/dist/extensions/testserver/vitest/config.d.ts +2 -2
- package/dist/extensions/testserver/vitest/config.js +2 -2
- package/dist/extensions/testserver/vitest/container-scope.d.ts +25 -16
- package/dist/extensions/testserver/vitest/container-scope.js +32 -13
- package/dist/extensions/testserver/vitest/diagnostics.d.ts +5 -4
- package/dist/extensions/testserver/vitest/diagnostics.js +15 -8
- package/dist/extensions/testserver/vitest/fixtures.d.ts +10 -1
- package/dist/extensions/testserver/vitest/fixtures.js +36 -10
- package/dist/extensions/testserver/vitest/types.d.ts +9 -0
- package/dist/extensions/vitest/driver.js +28 -14
- package/dist/extensions/vitest/plan/gateways.d.ts +28 -5
- package/dist/extensions/vitest/plan/gateways.js +2 -2
- package/dist/extensions/vitest/plan/list-output.d.ts +5 -0
- package/dist/extensions/vitest/plan/list-output.js +23 -9
- package/dist/extensions/vitest/plan/live/list-gateway.d.ts +3 -2
- package/dist/extensions/vitest/plan/live/list-gateway.js +77 -64
- package/dist/extensions/vitest/plan/plan-over.d.ts +19 -7
- package/dist/extensions/vitest/plan/plan-over.js +18 -7
- package/dist/extensions/vitest/plan/plan.d.ts +14 -5
- package/dist/extensions/vitest/plan/plan.js +23 -9
- package/dist/extensions.d.ts +2 -2
- package/dist/run-directory/index.d.ts +1 -1
- package/dist/run-directory/index.js +0 -1
- package/dist/run-directory/plan.d.ts +3 -2
- package/dist/run-directory/plan.js +6 -3
- package/dist/run-directory/recording.js +2 -2
- package/dist/run-directory/run-record.d.ts +18 -135
- package/dist/run-directory/run-record.js +8 -68
- package/dist/runner/build-snapshots.d.ts +50 -114
- package/dist/runner/build-snapshots.js +70 -159
- package/dist/runner/events.d.ts +4 -88
- package/dist/runner/gateways.d.ts +5 -23
- package/dist/runner/index.d.ts +5 -6
- package/dist/runner/index.js +1 -1
- package/dist/runner/live/snapshot-records.js +7 -18
- package/dist/runner/prepare.d.ts +11 -22
- package/dist/runner/prepare.js +6 -17
- package/dist/runner/ready.d.ts +16 -45
- package/dist/runner/ready.js +34 -59
- package/dist/runner/recipe.d.ts +5 -45
- package/dist/runner/recipe.js +0 -41
- package/dist/runner/sandboxed-command.d.ts +5 -3
- package/dist/runner/sandboxed-command.js +10 -4
- package/dist/runner/scope.d.ts +8 -25
- package/dist/runner/scope.js +4 -8
- package/dist/runner/session.d.ts +18 -65
- package/dist/runner/session.js +15 -83
- package/dist/runner/snapshot-build.d.ts +2 -2
- package/dist/runner/snapshot-cache.d.ts +22 -74
- package/dist/runner/snapshot-cache.js +15 -107
- package/dist/runner/snapshot-inspect.d.ts +9 -13
- package/dist/runner/snapshot-inspect.js +48 -57
- package/dist/runner/snapshot-key.d.ts +9 -14
- package/dist/runner/snapshot-key.js +15 -22
- package/dist/sdk/extension/driver.d.ts +32 -6
- package/dist/sdk/extension/driver.js +12 -2
- package/dist/sdk/extension/index.d.ts +1 -1
- package/dist/sdk/extension/index.js +2 -1
- package/dist/sdk/extension/resource-definition.d.ts +6 -5
- package/dist/vendor/testserver-sdk/container/api-request.d.ts +2 -3
- package/dist/vendor/testserver-sdk/container/api-request.js +2 -3
- package/dist/vendor/testserver-sdk/container/container.d.ts +12 -2
- package/dist/vendor/testserver-sdk/container/container.js +10 -7
- package/dist/vendor/testserver-sdk/container/recorder.d.ts +29 -7
- package/dist/vendor/testserver-sdk/container/recorder.js +26 -14
- package/dist/vendor/testserver-sdk/index.d.ts +1 -1
- package/dist/vendor/testserver-sdk/index.js +1 -1
- package/dist/vendor/testserver-sdk/proxy/exchange.d.ts +24 -5
- package/dist/vendor/testserver-sdk/proxy/exchange.js +43 -25
- package/dist/vendor/testserver-sdk/proxy/faulted-exchange.js +15 -10
- package/dist/vendor/testserver-sdk/proxy/faults.d.ts +6 -5
- package/dist/vendor/testserver-sdk/proxy/proxy.d.ts +10 -1
- package/dist/vendor/testserver-sdk/proxy/proxy.js +5 -3
- package/dist/vendor/testserver-sdk/proxy/records.d.ts +17 -17
- package/dist/vendor/testserver-sdk/proxy/records.js +18 -17
- package/dist/vendor/testserver-sdk/records/body.d.ts +7 -9
- package/dist/vendor/testserver-sdk/records/body.js +10 -15
- package/dist/vendor/testserver-sdk/records/headers.d.ts +79 -0
- package/dist/vendor/testserver-sdk/records/headers.js +162 -0
- package/dist/vendor/testserver-sdk/records/index.d.ts +2 -1
- package/dist/vendor/testserver-sdk/records/index.js +4 -2
- package/dist/vendor/testserver-sdk/records/records.d.ts +19 -10
- package/package.json +5 -4
- package/skills/overview.md +5 -5
- package/skills/read-run-output.md +8 -9
- package/dist/runner/snapshot-save.d.ts +0 -70
- package/dist/runner/snapshot-save.js +0 -160
- package/dist/runner/snapshot-start.d.ts +0 -25
- package/dist/runner/snapshot-start.js +0 -16
- package/skills/testserver-builds.md +0 -82
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runHelp
|
|
3
|
-
} from "../../chunks/chunk-
|
|
3
|
+
} from "../../chunks/chunk-HOKDKP5A.js";
|
|
4
4
|
import {
|
|
5
|
+
EXEC_HELP,
|
|
6
|
+
EXEC_HINTS,
|
|
5
7
|
RUN_CLI_OPTIONS,
|
|
6
8
|
RUN_REQUEST_FIELDS,
|
|
7
9
|
outcomes,
|
|
8
10
|
runCommand,
|
|
9
11
|
runProblems
|
|
10
|
-
} from "../../chunks/chunk-
|
|
12
|
+
} from "../../chunks/chunk-YBPTMJUM.js";
|
|
11
13
|
import "../../chunks/chunk-I5GZLOLQ.js";
|
|
12
|
-
import "../../chunks/chunk-
|
|
13
|
-
import "../../chunks/chunk-
|
|
14
|
-
import "../../chunks/chunk-
|
|
15
|
-
import "../../chunks/chunk-
|
|
16
|
-
import "../../chunks/chunk-
|
|
17
|
-
import "../../chunks/chunk-
|
|
14
|
+
import "../../chunks/chunk-27P2QSIM.js";
|
|
15
|
+
import "../../chunks/chunk-BFLYGMG3.js";
|
|
16
|
+
import "../../chunks/chunk-XPCUINWS.js";
|
|
17
|
+
import "../../chunks/chunk-Z5OXOZD3.js";
|
|
18
|
+
import "../../chunks/chunk-UC6DULWY.js";
|
|
19
|
+
import "../../chunks/chunk-BRUIATTR.js";
|
|
18
20
|
import "../../chunks/chunk-NMVODY3P.js";
|
|
19
|
-
import "../../chunks/chunk-
|
|
20
|
-
import "../../chunks/chunk-
|
|
21
|
-
import "../../chunks/chunk-
|
|
22
|
-
import "../../chunks/chunk-
|
|
21
|
+
import "../../chunks/chunk-RKONDLPS.js";
|
|
22
|
+
import "../../chunks/chunk-QBR5VHJ7.js";
|
|
23
|
+
import "../../chunks/chunk-5TMHYH7G.js";
|
|
24
|
+
import "../../chunks/chunk-5ED3IDUJ.js";
|
|
23
25
|
import {
|
|
24
26
|
NOT_COUNTED
|
|
25
|
-
} from "../../chunks/chunk-
|
|
27
|
+
} from "../../chunks/chunk-RA4L2ACU.js";
|
|
26
28
|
import "../../chunks/chunk-BW2ADH7U.js";
|
|
27
29
|
import "../../chunks/chunk-GQIL3AHY.js";
|
|
28
30
|
import "../../chunks/chunk-GSC6SRTW.js";
|
|
@@ -33,34 +35,6 @@ import "../../chunks/chunk-YM6TZV4L.js";
|
|
|
33
35
|
|
|
34
36
|
// src/commands/exec/command.ts
|
|
35
37
|
import { z } from "zod";
|
|
36
|
-
|
|
37
|
-
// src/commands/exec/exec-words.ts
|
|
38
|
-
var EXEC_HELP = {
|
|
39
|
-
usage: "-- <command...>",
|
|
40
|
-
args: "The command to run, after --, as an argument list with no shell. Unsandboxed, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN and FORCE_COLOR or NO_COLOR; in a sandboxed run, the runner recipe's cwd, its env, the runner's PATH and STORM_RUN, with paths under the repository's root rewritten.",
|
|
41
|
-
verbose: "which asks the command to print what each test does as it happens, for passing tests too",
|
|
42
|
-
examples: [
|
|
43
|
-
{
|
|
44
|
-
argv: "-- pnpm test",
|
|
45
|
-
description: "Run the package's test script in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts."
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
argv: "--keep-sandbox 2h -- pnpm test",
|
|
49
|
-
description: "Run the tests in a runner sandbox and keep it running 2 hours after the run, to debug in it."
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
argv: "--unsandboxed -- node scripts/smoke.mjs",
|
|
53
|
-
description: "Run a Node.js script on this machine, with the resources storm.config.ts declares, if any."
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
};
|
|
57
|
-
var EXEC_HINTS = {
|
|
58
|
-
// The command's test runner reported no final result. Which one it is the launcher can't tell, so the hint names
|
|
59
|
-
// storm's reporter for each: the Vitest one and the Playwright one, by their published paths.
|
|
60
|
-
noFinalResults: "add storm's reporter to the test runner's config (stormReporter() from @vercel/storm/vitest/config for Vitest, @vercel/storm/playwright/reporter for Playwright)"
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// src/commands/exec/command.ts
|
|
64
38
|
var command_default = stormCommands.define({
|
|
65
39
|
requestSchema: z.object({
|
|
66
40
|
...RUN_REQUEST_FIELDS,
|
|
@@ -5,11 +5,15 @@ import type { Driver } from "../../sdk/extension/index.ts";
|
|
|
5
5
|
* driver's arguments, and runs the driver's command in a run (`runCommand`).
|
|
6
6
|
*
|
|
7
7
|
* It takes any arguments (`args`), which go to the driver's program unchanged, in order, those after `--` among
|
|
8
|
-
* them, which Clinkr reads into the same field
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* them, which Clinkr reads into the same field, and `--count-tests` (`countTests`) for a driver that counts only the
|
|
9
|
+
* test files unless asked (`Driver.countTests`), with the driver's help for it. Its part of planning the run finds the
|
|
10
|
+
* program and, when the config file sets `testPlan` or the run takes `--count-tests`, counts its tests, or their files,
|
|
11
|
+
* before anything is minted, acquired or started (`planDriverCommand`). The count is the run's test plan, which sizes
|
|
12
|
+
* any resource option whose default is a function of it, and which its `ran` carries as `plan`; a run that counts
|
|
13
|
+
* nothing has no plan, as `storm exec`'s has none. Beside every run's
|
|
11
14
|
* errors it ends with the driver's two refusals, `no_matching_tests` and `driver_plan_failed`, in the driver's words
|
|
12
|
-
* (`driverRefusals`).
|
|
15
|
+
* (`driverRefusals`). Its `ran` warns `no_final_test_results` when its program exited 0 and saved no final test
|
|
16
|
+
* result, with the driver's steps that add storm's reporter as its next steps (`ranRenderer`).
|
|
13
17
|
*/
|
|
14
18
|
export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
15
19
|
scope: z.ZodOptional<z.ZodString>;
|
|
@@ -19,12 +23,11 @@ export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr
|
|
|
19
23
|
mint: "mint";
|
|
20
24
|
}>>;
|
|
21
25
|
unsandboxed: z.ZodDefault<z.ZodBoolean>;
|
|
22
|
-
saveDevSnapshot: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
-
noReuseDevSnapshot: z.ZodDefault<z.ZodBoolean>;
|
|
24
26
|
showOutput: z.ZodDefault<z.ZodBoolean>;
|
|
25
27
|
keepSandbox: z.ZodOptional<z.ZodString>;
|
|
26
28
|
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
27
29
|
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
30
|
+
countTests?: z.ZodDefault<z.ZodBoolean>;
|
|
28
31
|
}, z.core.$strip>, import("@vercel/clinkr").Outcomes<{
|
|
29
32
|
ran: z.ZodObject<{
|
|
30
33
|
version: z.ZodString;
|
|
@@ -39,48 +42,13 @@ export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr
|
|
|
39
42
|
runner: z.ZodNullable<z.ZodObject<{
|
|
40
43
|
snapshotId: z.ZodString;
|
|
41
44
|
base: z.ZodString;
|
|
42
|
-
|
|
43
|
-
snapshotHead: z.ZodNullable<z.ZodString>;
|
|
44
|
-
snapshotKind: z.ZodEnum<{
|
|
45
|
-
base: "base";
|
|
46
|
-
dev: "dev";
|
|
47
|
-
}>;
|
|
48
|
-
snapshotBuiltAt: z.ZodString;
|
|
49
|
-
builtBehind: z.ZodNullable<z.ZodNumber>;
|
|
45
|
+
builtBehind: z.ZodNumber;
|
|
50
46
|
uploadBytes: z.ZodNumber;
|
|
51
47
|
built: z.ZodBoolean;
|
|
52
48
|
vcpus: z.ZodNumber;
|
|
53
49
|
region: z.ZodString;
|
|
54
50
|
runtime: z.ZodString;
|
|
55
51
|
buildMs: z.ZodNumber;
|
|
56
|
-
save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
57
|
-
kind: z.ZodLiteral<"saved">;
|
|
58
|
-
snapshotId: z.ZodString;
|
|
59
|
-
base: z.ZodString;
|
|
60
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
61
|
-
head: z.ZodString;
|
|
62
|
-
ms: z.ZodNumber;
|
|
63
|
-
sizeBytes: z.ZodNumber;
|
|
64
|
-
entryWritten: z.ZodBoolean;
|
|
65
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
-
kind: z.ZodLiteral<"failed">;
|
|
67
|
-
step: z.ZodEnum<{
|
|
68
|
-
"save-snapshot": "save-snapshot";
|
|
69
|
-
scrub: "scrub";
|
|
70
|
-
}>;
|
|
71
|
-
message: z.ZodString;
|
|
72
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
73
|
-
kind: z.ZodLiteral<"stopped">;
|
|
74
|
-
}, z.core.$strip>], "kind">>;
|
|
75
|
-
noSaveReason: z.ZodNullable<z.ZodEnum<{
|
|
76
|
-
"already-saved": "already-saved";
|
|
77
|
-
ci: "ci";
|
|
78
|
-
"command-failed": "command-failed";
|
|
79
|
-
"keep-sandbox": "keep-sandbox";
|
|
80
|
-
"no-save-flag": "no-save-flag";
|
|
81
|
-
"not-trusted": "not-trusted";
|
|
82
|
-
recipe: "recipe";
|
|
83
|
-
}>>;
|
|
84
52
|
}, z.core.$strip>>;
|
|
85
53
|
timeline: z.ZodObject<{
|
|
86
54
|
startedAt: z.ZodString;
|
|
@@ -125,8 +93,9 @@ export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr
|
|
|
125
93
|
}, z.core.$strip>>;
|
|
126
94
|
}, z.core.$strip>;
|
|
127
95
|
runId: z.ZodNullable<z.ZodString>;
|
|
128
|
-
|
|
129
|
-
|
|
96
|
+
noFinalTestResults: z.ZodBoolean;
|
|
97
|
+
plan: z.ZodExactOptional<z.ZodObject<{
|
|
98
|
+
tests: z.ZodOptional<z.ZodNumber>;
|
|
130
99
|
files: z.ZodNumber;
|
|
131
100
|
options: z.ZodArray<z.ZodObject<{
|
|
132
101
|
path: z.ZodString;
|
|
@@ -137,7 +106,7 @@ export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr
|
|
|
137
106
|
flag: "flag";
|
|
138
107
|
}>;
|
|
139
108
|
}, z.core.$strip>>;
|
|
140
|
-
}, z.core.$strip
|
|
109
|
+
}, z.core.$strip>>;
|
|
141
110
|
}, z.core.$strip>;
|
|
142
111
|
}, {
|
|
143
112
|
ran: unknown;
|
|
@@ -146,10 +115,6 @@ export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr
|
|
|
146
115
|
flags: string[];
|
|
147
116
|
configFile: string | null;
|
|
148
117
|
}]>;
|
|
149
|
-
devSnapshotsNotTrusted: import("@vercel/clinkr").SharedError<"dev_snapshots_not_trusted", [data: {
|
|
150
|
-
flag: string;
|
|
151
|
-
configFile: string | null;
|
|
152
|
-
}]>;
|
|
153
118
|
driverPlanFailed: import("@vercel/clinkr").SharedError<"driver_plan_failed", [data: {
|
|
154
119
|
driver: string;
|
|
155
120
|
kind: "exited" | "start-failed" | "timed-out" | "unreadable-output";
|
|
@@ -269,10 +234,6 @@ export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr
|
|
|
269
234
|
flags: string[];
|
|
270
235
|
configFile: string | null;
|
|
271
236
|
}]>;
|
|
272
|
-
readonly devSnapshotsNotTrusted: import("@vercel/clinkr").SharedError<"dev_snapshots_not_trusted", [data: {
|
|
273
|
-
flag: string;
|
|
274
|
-
configFile: string | null;
|
|
275
|
-
}]>;
|
|
276
237
|
readonly driverPlanFailed: import("@vercel/clinkr").SharedError<"driver_plan_failed", [data: {
|
|
277
238
|
driver: string;
|
|
278
239
|
kind: "exited" | "start-failed" | "timed-out" | "unreadable-output";
|
|
@@ -401,48 +362,13 @@ export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr
|
|
|
401
362
|
runner: z.ZodNullable<z.ZodObject<{
|
|
402
363
|
snapshotId: z.ZodString;
|
|
403
364
|
base: z.ZodString;
|
|
404
|
-
|
|
405
|
-
snapshotHead: z.ZodNullable<z.ZodString>;
|
|
406
|
-
snapshotKind: z.ZodEnum<{
|
|
407
|
-
base: "base";
|
|
408
|
-
dev: "dev";
|
|
409
|
-
}>;
|
|
410
|
-
snapshotBuiltAt: z.ZodString;
|
|
411
|
-
builtBehind: z.ZodNullable<z.ZodNumber>;
|
|
365
|
+
builtBehind: z.ZodNumber;
|
|
412
366
|
uploadBytes: z.ZodNumber;
|
|
413
367
|
built: z.ZodBoolean;
|
|
414
368
|
vcpus: z.ZodNumber;
|
|
415
369
|
region: z.ZodString;
|
|
416
370
|
runtime: z.ZodString;
|
|
417
371
|
buildMs: z.ZodNumber;
|
|
418
|
-
save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
419
|
-
kind: z.ZodLiteral<"saved">;
|
|
420
|
-
snapshotId: z.ZodString;
|
|
421
|
-
base: z.ZodString;
|
|
422
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
423
|
-
head: z.ZodString;
|
|
424
|
-
ms: z.ZodNumber;
|
|
425
|
-
sizeBytes: z.ZodNumber;
|
|
426
|
-
entryWritten: z.ZodBoolean;
|
|
427
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
428
|
-
kind: z.ZodLiteral<"failed">;
|
|
429
|
-
step: z.ZodEnum<{
|
|
430
|
-
"save-snapshot": "save-snapshot";
|
|
431
|
-
scrub: "scrub";
|
|
432
|
-
}>;
|
|
433
|
-
message: z.ZodString;
|
|
434
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
435
|
-
kind: z.ZodLiteral<"stopped">;
|
|
436
|
-
}, z.core.$strip>], "kind">>;
|
|
437
|
-
noSaveReason: z.ZodNullable<z.ZodEnum<{
|
|
438
|
-
"already-saved": "already-saved";
|
|
439
|
-
ci: "ci";
|
|
440
|
-
"command-failed": "command-failed";
|
|
441
|
-
"keep-sandbox": "keep-sandbox";
|
|
442
|
-
"no-save-flag": "no-save-flag";
|
|
443
|
-
"not-trusted": "not-trusted";
|
|
444
|
-
recipe: "recipe";
|
|
445
|
-
}>>;
|
|
446
372
|
}, z.core.$strip>>;
|
|
447
373
|
timeline: z.ZodObject<{
|
|
448
374
|
startedAt: z.ZodString;
|
|
@@ -487,8 +413,9 @@ export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr
|
|
|
487
413
|
}, z.core.$strip>>;
|
|
488
414
|
}, z.core.$strip>;
|
|
489
415
|
runId: z.ZodNullable<z.ZodString>;
|
|
490
|
-
|
|
491
|
-
|
|
416
|
+
noFinalTestResults: z.ZodBoolean;
|
|
417
|
+
plan: z.ZodExactOptional<z.ZodObject<{
|
|
418
|
+
tests: z.ZodOptional<z.ZodNumber>;
|
|
492
419
|
files: z.ZodNumber;
|
|
493
420
|
options: z.ZodArray<z.ZodObject<{
|
|
494
421
|
path: z.ZodString;
|
|
@@ -499,7 +426,7 @@ export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr
|
|
|
499
426
|
flag: "flag";
|
|
500
427
|
}>;
|
|
501
428
|
}, z.core.$strip>>;
|
|
502
|
-
}, z.core.$strip
|
|
429
|
+
}, z.core.$strip>>;
|
|
503
430
|
}, z.core.$strip>;
|
|
504
431
|
}, {
|
|
505
432
|
ran: unknown;
|
|
@@ -508,10 +435,6 @@ export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr
|
|
|
508
435
|
flags: string[];
|
|
509
436
|
configFile: string | null;
|
|
510
437
|
}]>;
|
|
511
|
-
devSnapshotsNotTrusted: import("@vercel/clinkr").SharedError<"dev_snapshots_not_trusted", [data: {
|
|
512
|
-
flag: string;
|
|
513
|
-
configFile: string | null;
|
|
514
|
-
}]>;
|
|
515
438
|
driverPlanFailed: import("@vercel/clinkr").SharedError<"driver_plan_failed", [data: {
|
|
516
439
|
driver: string;
|
|
517
440
|
kind: "exited" | "start-failed" | "timed-out" | "unreadable-output";
|
|
@@ -631,10 +554,6 @@ export declare function defineRunCommand(driver: Driver): import("@vercel/clinkr
|
|
|
631
554
|
flags: string[];
|
|
632
555
|
configFile: string | null;
|
|
633
556
|
}]>;
|
|
634
|
-
readonly devSnapshotsNotTrusted: import("@vercel/clinkr").SharedError<"dev_snapshots_not_trusted", [data: {
|
|
635
|
-
flag: string;
|
|
636
|
-
configFile: string | null;
|
|
637
|
-
}]>;
|
|
638
557
|
readonly driverPlanFailed: import("@vercel/clinkr").SharedError<"driver_plan_failed", [data: {
|
|
639
558
|
driver: string;
|
|
640
559
|
kind: "exited" | "start-failed" | "timed-out" | "unreadable-output";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// A driver's run command: `defineRunCommand` makes the command that starts a run from a driver (`GLOSSARY.md`,
|
|
2
2
|
// **Driver**), the one an extension brings, which the registry gives by name (`driverNamed`, `src/extensions.ts`), so
|
|
3
3
|
// `storm vitest` and `storm playwright` are one implementation and differ only in their driver. The driver gives the
|
|
4
|
-
// command's word, its part of the leaf help, how to find its program, count its tests
|
|
5
|
-
// run's summary says to do next (its hints); everything else is the run every run command shares (`runCommand`,
|
|
4
|
+
// command's word, its part of the leaf help, how to find its program, count its tests when the run counts, and start
|
|
5
|
+
// it, and what its run's summary says to do next (its hints); everything else is the run every run command shares (`runCommand`,
|
|
6
6
|
// `run-command.ts`), which `storm exec` is made from directly too (`command.ts`).
|
|
7
7
|
import { defineOutcomes } from "@vercel/clinkr";
|
|
8
8
|
import { z } from "zod";
|
|
@@ -10,19 +10,24 @@ import { stormCommands } from "../../command-tree.js";
|
|
|
10
10
|
import { planSchema } from "../../run-directory/index.js";
|
|
11
11
|
import { planDriverCommand } from "./driver-plan.js";
|
|
12
12
|
import { driverRefusals } from "./driver-refusals.js";
|
|
13
|
-
import { RAN_DESCRIPTION, RUN_ERRORS,
|
|
13
|
+
import { RAN_DESCRIPTION, RUN_ERRORS, ranRenderer, ranSchema } from "./outcomes.js";
|
|
14
14
|
import { RUN_CLI_OPTIONS, RUN_REQUEST_FIELDS, runCommand, runProblems } from "./run-command.js";
|
|
15
15
|
import { runHelp } from "./run-metadata.js";
|
|
16
|
+
import { recordedPlan } from "./test-plan.js";
|
|
16
17
|
/**
|
|
17
18
|
* The run command of `driver`, which its `command.ts` default-exports. It takes the flags every run takes, then the
|
|
18
19
|
* driver's arguments, and runs the driver's command in a run (`runCommand`).
|
|
19
20
|
*
|
|
20
21
|
* It takes any arguments (`args`), which go to the driver's program unchanged, in order, those after `--` among
|
|
21
|
-
* them, which Clinkr reads into the same field
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* them, which Clinkr reads into the same field, and `--count-tests` (`countTests`) for a driver that counts only the
|
|
23
|
+
* test files unless asked (`Driver.countTests`), with the driver's help for it. Its part of planning the run finds the
|
|
24
|
+
* program and, when the config file sets `testPlan` or the run takes `--count-tests`, counts its tests, or their files,
|
|
25
|
+
* before anything is minted, acquired or started (`planDriverCommand`). The count is the run's test plan, which sizes
|
|
26
|
+
* any resource option whose default is a function of it, and which its `ran` carries as `plan`; a run that counts
|
|
27
|
+
* nothing has no plan, as `storm exec`'s has none. Beside every run's
|
|
24
28
|
* errors it ends with the driver's two refusals, `no_matching_tests` and `driver_plan_failed`, in the driver's words
|
|
25
|
-
* (`driverRefusals`).
|
|
29
|
+
* (`driverRefusals`). Its `ran` warns `no_final_test_results` when its program exited 0 and saved no final test
|
|
30
|
+
* result, with the driver's steps that add storm's reporter as its next steps (`ranRenderer`).
|
|
26
31
|
*/
|
|
27
32
|
export function defineRunCommand(driver) {
|
|
28
33
|
const errors = driverRefusals(driver);
|
|
@@ -31,28 +36,56 @@ export function defineRunCommand(driver) {
|
|
|
31
36
|
ran: {
|
|
32
37
|
schema: ranSchema.extend({
|
|
33
38
|
/**
|
|
34
|
-
* The test plan: what the driver's plan step counted before the run, and each resource
|
|
35
|
-
* is a function of it, with its value and where that came from.
|
|
39
|
+
* The test plan of a run that counted: what the driver's plan step counted before the run, and each resource
|
|
40
|
+
* option whose default is a function of it, with its value and where that came from. Absent for a run that
|
|
41
|
+
* counted nothing.
|
|
36
42
|
*/
|
|
37
|
-
plan: planSchema,
|
|
43
|
+
plan: planSchema.exactOptional(),
|
|
38
44
|
}),
|
|
39
45
|
description: RAN_DESCRIPTION,
|
|
40
|
-
render:
|
|
46
|
+
render: ranRenderer(driver.hints),
|
|
41
47
|
},
|
|
42
48
|
},
|
|
43
49
|
errors: { ...RUN_ERRORS, ...errors.errors },
|
|
44
50
|
});
|
|
51
|
+
const help = runHelp(driver.help, "args", { driver: driver.name });
|
|
45
52
|
return stormCommands.define({
|
|
46
|
-
requestSchema: z.object({
|
|
53
|
+
requestSchema: z.object({
|
|
54
|
+
...RUN_REQUEST_FIELDS,
|
|
55
|
+
...countTestsField(driver),
|
|
56
|
+
args: z.array(z.string()).default([]),
|
|
57
|
+
}),
|
|
47
58
|
cli: { options: RUN_CLI_OPTIONS, positionals: ["args"] },
|
|
48
|
-
help:
|
|
59
|
+
help: driver.countTests === undefined
|
|
60
|
+
? help
|
|
61
|
+
: { ...help, fields: { ...help.fields, countTests: { description: driver.countTests.description } } },
|
|
49
62
|
response: counted,
|
|
50
63
|
validate: runProblems,
|
|
51
64
|
handler: async (context, request) => await runCommand(context, request, {
|
|
52
65
|
name: driver.name,
|
|
53
66
|
hints: driver.hints,
|
|
54
|
-
planCommand: async (where, signal) => await planDriverCommand(context.app, driver, errors, request.args, where, signal),
|
|
55
|
-
ran: (facts, { testPlan, options }) =>
|
|
67
|
+
planCommand: async (where, signal, { testPlan }) => await planDriverCommand(context.app, driver, errors, request.args, driverCount(driver, testPlan, request.countTests === true), where, signal),
|
|
68
|
+
ran: (facts, { testPlan, options }) => {
|
|
69
|
+
const plan = recordedPlan(testPlan, options);
|
|
70
|
+
return counted.ran({ ...facts, ...(plan === undefined ? {} : { plan }) });
|
|
71
|
+
},
|
|
56
72
|
}),
|
|
57
73
|
});
|
|
58
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* What `driver`'s run counts: nothing unless the config file sets `testPlan` or the run takes `--count-tests`; then
|
|
77
|
+
* each test with `--count-tests` or for a driver with no `countTests`, which always counts each test, and otherwise only
|
|
78
|
+
* the test files.
|
|
79
|
+
*/
|
|
80
|
+
function driverCount(driver, testPlan, countTests) {
|
|
81
|
+
if (!testPlan && !countTests)
|
|
82
|
+
return undefined;
|
|
83
|
+
return { countTests: driver.countTests === undefined || countTests };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The request field of `--count-tests` for a driver that counts only the test files unless asked (`Driver.countTests`);
|
|
87
|
+
* none for a driver that always counts each test, so the field is optional in the request's type.
|
|
88
|
+
*/
|
|
89
|
+
function countTestsField(driver) {
|
|
90
|
+
return driver.countTests === undefined ? {} : { countTests: z.boolean().default(false) };
|
|
91
|
+
}
|
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
import type { StormApp } from "../../context.ts";
|
|
2
|
-
import type
|
|
2
|
+
import { type Driver, type RunTestPlan } from "../../sdk/extension/index.ts";
|
|
3
3
|
import type { DriverRefusals } from "./driver-refusals.ts";
|
|
4
4
|
import { canceledBeforeStart, type PlannedCommand, type PlannedWhere } from "./plan-run.ts";
|
|
5
5
|
import { checkoutFailedRefusal } from "./run-command.ts";
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Whether a run counts before it starts, and what: `undefined` counts nothing; otherwise the plan step counts each
|
|
8
|
+
* test, or only the test files where the driver can (`countTests`).
|
|
9
|
+
*/
|
|
10
|
+
export type DriverCount = {
|
|
11
|
+
readonly countTests: boolean;
|
|
12
|
+
} | undefined;
|
|
10
13
|
/** How a driver's part of planning ends a run before it starts. */
|
|
11
14
|
export type DriverPlanRefusal = ReturnType<typeof canceledBeforeStart> | ReturnType<typeof checkoutFailedRefusal> | ReturnType<DriverRefusals["planFailed"]> | ReturnType<DriverRefusals["noMatchingTests"]>;
|
|
12
15
|
/**
|
|
13
|
-
* `driver`'s part of planning a run, before anything is minted, acquired or started
|
|
16
|
+
* `driver`'s part of planning a run, before anything is minted, acquired or started. `count` says whether the run
|
|
17
|
+
* counts (`DriverCount`):
|
|
14
18
|
*
|
|
15
|
-
* 1.
|
|
19
|
+
* 1. A run with a runner that counts nothing asks nothing of this machine: its command is the driver's argv over the
|
|
20
|
+
* program's bare name, which the runner's `PATH` finds.
|
|
21
|
+
* 2. Finds the driver's program where the run runs (`findRunBin`): the directory on this machine the run is planned
|
|
16
22
|
* in, and its binary in `node_modules/.bin` of that directory or one above it. No binary is `driver_plan_failed`
|
|
17
|
-
* (`start-failed`), naming each directory searched. A repository root git can't say is `runner_failed`.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
23
|
+
* (`start-failed`), naming each directory searched. A repository root git can't say is `runner_failed`. A run with
|
|
24
|
+
* no runner that counts nothing starts the binary found.
|
|
25
|
+
* 3. For a run that counts, asks the driver's plan step, over the driver's own Context (`app.driverContexts`, by the
|
|
26
|
+
* driver's name), what the program would run there, with the binary found and this machine's environment, counting
|
|
27
|
+
* each test or only the test files as `count.countTests` says: `driver_plan_failed` when it fails, with the message
|
|
28
|
+
* the plan step worded, and `no_matching_tests` when it counts no test, or no test file when it counted only the
|
|
29
|
+
* files. `signal` aborting stops it, and the run cancels (`canceledBeforeStart`).
|
|
22
30
|
*
|
|
23
|
-
* What the plan step counted is the run's test plan,
|
|
24
|
-
*
|
|
25
|
-
* the ones its command's outcomes list, which `driver.refusals`, the driver's words, word.
|
|
31
|
+
* What the plan step counted is the run's test plan, `not-counted` for a run that counts nothing, and the command is
|
|
32
|
+
* the driver's argv (`launch`) over the binary the run starts. `errors` are the builders of the driver's two errors
|
|
33
|
+
* (`driverRefusals`), the ones its command's outcomes list, which `driver.refusals`, the driver's words, word.
|
|
26
34
|
*/
|
|
27
|
-
export declare function planDriverCommand(app: Pick<StormApp, "context" | "cwd" | "packageBins" | "driverContexts">, driver: Driver, errors: DriverRefusals, args: readonly string[], where: PlannedWhere, signal: AbortSignal): Promise<PlannedCommand<
|
|
35
|
+
export declare function planDriverCommand(app: Pick<StormApp, "context" | "cwd" | "packageBins" | "driverContexts">, driver: Driver, errors: DriverRefusals, args: readonly string[], count: DriverCount, where: PlannedWhere, signal: AbortSignal): Promise<PlannedCommand<RunTestPlan> | {
|
|
28
36
|
readonly ok: false;
|
|
29
37
|
readonly refusal: DriverPlanRefusal;
|
|
30
38
|
}>;
|
|
@@ -1,36 +1,51 @@
|
|
|
1
1
|
// A program driver's part of planning a run (`PlanCommand`, `plan-run.ts`): finding the program, asking the driver's
|
|
2
|
-
// plan step for the test plan, and the refusals that end the run there. Every driver of a program plans through it, so
|
|
2
|
+
// plan step for the test plan when the run counts, and the refusals that end the run there. Every driver of a program plans through it, so
|
|
3
3
|
// no command holds planning or refusal logic of its own.
|
|
4
4
|
import { refused } from "@vercel/clinkr";
|
|
5
|
+
import { NOT_COUNTED } from "../../sdk/extension/index.js";
|
|
5
6
|
import { canceledBeforeStart } from "./plan-run.js";
|
|
6
7
|
import { findRunBin } from "./run-bin.js";
|
|
7
8
|
import { checkoutFailedRefusal } from "./run-command.js";
|
|
8
9
|
/**
|
|
9
|
-
* `driver`'s part of planning a run, before anything is minted, acquired or started
|
|
10
|
+
* `driver`'s part of planning a run, before anything is minted, acquired or started. `count` says whether the run
|
|
11
|
+
* counts (`DriverCount`):
|
|
10
12
|
*
|
|
11
|
-
* 1.
|
|
13
|
+
* 1. A run with a runner that counts nothing asks nothing of this machine: its command is the driver's argv over the
|
|
14
|
+
* program's bare name, which the runner's `PATH` finds.
|
|
15
|
+
* 2. Finds the driver's program where the run runs (`findRunBin`): the directory on this machine the run is planned
|
|
12
16
|
* in, and its binary in `node_modules/.bin` of that directory or one above it. No binary is `driver_plan_failed`
|
|
13
|
-
* (`start-failed`), naming each directory searched. A repository root git can't say is `runner_failed`.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* (`start-failed`), naming each directory searched. A repository root git can't say is `runner_failed`. A run with
|
|
18
|
+
* no runner that counts nothing starts the binary found.
|
|
19
|
+
* 3. For a run that counts, asks the driver's plan step, over the driver's own Context (`app.driverContexts`, by the
|
|
20
|
+
* driver's name), what the program would run there, with the binary found and this machine's environment, counting
|
|
21
|
+
* each test or only the test files as `count.countTests` says: `driver_plan_failed` when it fails, with the message
|
|
22
|
+
* the plan step worded, and `no_matching_tests` when it counts no test, or no test file when it counted only the
|
|
23
|
+
* files. `signal` aborting stops it, and the run cancels (`canceledBeforeStart`).
|
|
18
24
|
*
|
|
19
|
-
* What the plan step counted is the run's test plan,
|
|
20
|
-
*
|
|
21
|
-
* the ones its command's outcomes list, which `driver.refusals`, the driver's words, word.
|
|
25
|
+
* What the plan step counted is the run's test plan, `not-counted` for a run that counts nothing, and the command is
|
|
26
|
+
* the driver's argv (`launch`) over the binary the run starts. `errors` are the builders of the driver's two errors
|
|
27
|
+
* (`driverRefusals`), the ones its command's outcomes list, which `driver.refusals`, the driver's words, word.
|
|
22
28
|
*/
|
|
23
|
-
export async function planDriverCommand(app, driver, errors, args, where, signal) {
|
|
29
|
+
export async function planDriverCommand(app, driver, errors, args, count, where, signal) {
|
|
24
30
|
const { bin: name } = driver.program;
|
|
31
|
+
if (count === undefined && where.kind === "runner")
|
|
32
|
+
return { ok: true, argv: driver.launch(name, args), testPlan: NOT_COUNTED.testPlan };
|
|
25
33
|
const bin = await findRunBin(app, name, where);
|
|
26
34
|
if (bin.kind === "checkout-failed")
|
|
27
35
|
return refused(checkoutFailedRefusal(bin.failure));
|
|
28
36
|
const planned = { args, cwd: bin.cwd };
|
|
29
37
|
if (bin.kind === "not-found")
|
|
30
38
|
return refused(errors.planFailed({ kind: "start-failed", message: `found no ${name} in node_modules/.bin of ${bin.searched.join(", ")}` }, planned));
|
|
39
|
+
if (count === undefined)
|
|
40
|
+
return { ok: true, argv: driver.launch(bin.runs, args), testPlan: NOT_COUNTED.testPlan };
|
|
31
41
|
// Each Context goes only to the plan step of the driver that built it, which `defineDriver`'s cast rests on.
|
|
32
42
|
const contexts = app.driverContexts;
|
|
33
|
-
const answer = await driver.plan(contexts[driver.name])({
|
|
43
|
+
const answer = await driver.plan(contexts[driver.name])({
|
|
44
|
+
...planned,
|
|
45
|
+
bin: bin.counts,
|
|
46
|
+
countTests: count.countTests,
|
|
47
|
+
signal,
|
|
48
|
+
});
|
|
34
49
|
if (!answer.ok) {
|
|
35
50
|
const { kind, message } = answer;
|
|
36
51
|
if (kind === "canceled")
|
|
@@ -38,7 +53,11 @@ export async function planDriverCommand(app, driver, errors, args, where, signal
|
|
|
38
53
|
return refused(errors.planFailed({ kind, message }, planned));
|
|
39
54
|
}
|
|
40
55
|
const { tests, files } = answer.plan;
|
|
41
|
-
if (tests === 0)
|
|
56
|
+
if ((tests ?? files) === 0)
|
|
42
57
|
return refused(errors.noMatchingTests(planned));
|
|
43
|
-
return {
|
|
58
|
+
return {
|
|
59
|
+
ok: true,
|
|
60
|
+
argv: driver.launch(bin.runs, args),
|
|
61
|
+
testPlan: { kind: "counted", ...(tests === undefined ? {} : { tests }), files },
|
|
62
|
+
};
|
|
44
63
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
// How a run ends when its driver's
|
|
2
|
-
// program shares, as every resource's refusals share `resource_refused` (`resource-refusals.ts`).
|
|
3
|
-
// is a plan step that counted no test,
|
|
4
|
-
//
|
|
1
|
+
// How a run ends when its driver's part of planning gives it no command: two errors of storm's own, which every driver
|
|
2
|
+
// of a program shares, as every resource's refusals share `resource_refused` (`resource-refusals.ts`).
|
|
3
|
+
// `no_matching_tests` is a plan step that counted no test, for a run that counts, and
|
|
4
|
+
// `driver_plan_failed` a program the launcher didn't find or a plan step that failed. Each carries the driver's name
|
|
5
|
+
// (`driver`) beside the arguments and the directory the run was planned in,
|
|
5
6
|
// and `driver_plan_failed` how the plan step failed (`kind`) and what went wrong (`message`), which holds the timeout,
|
|
6
7
|
// the exit code or the signal: no field of its own carries them. The driver words both: each error's description and
|
|
7
8
|
// the next step (`DriverRefusalWords`, `src/sdk/extension/driver.ts`), and what went wrong, which its plan step answers
|
|
@@ -16,7 +17,7 @@ const plannedShape = {
|
|
|
16
17
|
driver: z.string().min(1),
|
|
17
18
|
/** The arguments given to the driver's program, which its plan step was given too. */
|
|
18
19
|
args: z.array(z.string()),
|
|
19
|
-
/** The directory the
|
|
20
|
+
/** The directory the run was planned in, on this machine: where its program was looked for and its tests counted. */
|
|
20
21
|
cwd: z.string(),
|
|
21
22
|
};
|
|
22
23
|
/**
|
|
@@ -47,7 +48,7 @@ export function driverRefusals({ name, refusals }) {
|
|
|
47
48
|
cwd: plannedShape.cwd,
|
|
48
49
|
}),
|
|
49
50
|
render: ({ kind, message, cwd }) => ({
|
|
50
|
-
message: `Couldn't
|
|
51
|
+
message: `Couldn't plan the run in ${cwd}: ${/[.!?]$/.test(message) ? message : `${message}.`} The command didn't run.`,
|
|
51
52
|
next: [{ type: "text", text: refusals.planFailed.next[kind] }],
|
|
52
53
|
}),
|
|
53
54
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DriverHelp, DriverHints } from "../../sdk/extension/index.ts";
|
|
2
2
|
/** `exec`'s part of its leaf help: its usage after the run flags, its arguments, `--verbose`'s ending and its examples. */
|
|
3
3
|
export declare const EXEC_HELP: DriverHelp;
|
|
4
|
-
/** What an `exec` run
|
|
4
|
+
/** What an `exec` run says to do next. */
|
|
5
5
|
export declare const EXEC_HINTS: DriverHints;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/** `exec`'s part of its leaf help: its usage after the run flags, its arguments, `--verbose`'s ending and its examples. */
|
|
7
7
|
export const EXEC_HELP = {
|
|
8
8
|
usage: "-- <command...>",
|
|
9
|
-
args: "The command to run, after --, as an argument list with no shell. Unsandboxed, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN and FORCE_COLOR or NO_COLOR; in a sandboxed run, the runner recipe's cwd, its env, the runner's PATH and
|
|
9
|
+
args: "The command to run, after --, as an argument list with no shell. Unsandboxed, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR when neither is set; in a sandboxed run, the runner recipe's cwd, its env, the runner's PATH, STORM_RUN, and FORCE_COLOR or NO_COLOR when that env sets neither, with paths under the repository's root rewritten.",
|
|
10
10
|
verbose: "which asks the command to print what each test does as it happens, for passing tests too",
|
|
11
11
|
examples: [
|
|
12
12
|
{
|
|
@@ -23,9 +23,15 @@ export const EXEC_HELP = {
|
|
|
23
23
|
},
|
|
24
24
|
],
|
|
25
25
|
};
|
|
26
|
-
/** What an `exec` run
|
|
26
|
+
/** What an `exec` run says to do next. */
|
|
27
27
|
export const EXEC_HINTS = {
|
|
28
28
|
// The command's test runner reported no final result. Which one it is the launcher can't tell, so the hint names
|
|
29
29
|
// storm's reporter for each: the Vitest one and the Playwright one, by their published paths.
|
|
30
30
|
noFinalResults: "add storm's reporter to the test runner's config (stormReporter() from @vercel/storm/vitest/config for Vitest, @vercel/storm/playwright/reporter for Playwright)",
|
|
31
|
+
// The command may run no test at all, so the steps say they apply if it does, and name storm's reporter for each test
|
|
32
|
+
// runner, under either npm name.
|
|
33
|
+
addReporter: [
|
|
34
|
+
'If the command runs tests, add storm\'s reporter to its test runner\'s config: for Vitest, set test.reporters to stormReporters() from "@vercel/storm/vitest/config"; for Playwright, add ["@vercel/storm/playwright/reporter"] to the reporter list. In a package that installs storm as @cnc-tools/storm, use "@cnc-tools/storm/vitest/config" or "@cnc-tools/storm/playwright/reporter".',
|
|
35
|
+
"Remove any --reporter from the test runner's arguments, since it replaces the config's reporters, storm's among them. Then run the same storm exec command again.",
|
|
36
|
+
],
|
|
31
37
|
};
|