@cnc-tools/storm 0.13.0 → 0.14.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/dist/application.js +5 -1
- package/dist/bin/storm.js +6 -2
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-N7E6DAUE.js → chunk-27P2QSIM.js} +1 -1
- package/dist/chunks/{chunk-ZDJLKF2G.js → chunk-5ED3IDUJ.js} +7 -4
- package/dist/chunks/{chunk-6EQKA7LI.js → chunk-5TMHYH7G.js} +1 -1
- package/dist/chunks/{chunk-AX4EQZUS.js → chunk-BFLYGMG3.js} +12 -7
- package/dist/chunks/{chunk-LQKNI3EG.js → chunk-BRUIATTR.js} +6 -6
- package/dist/chunks/{chunk-DOFB2ACU.js → chunk-HOKDKP5A.js} +1 -1
- package/dist/chunks/{chunk-EGNP3S6C.js → chunk-IVRRGGCD.js} +60 -20
- package/dist/chunks/{chunk-RTILVSYQ.js → chunk-QBR5VHJ7.js} +1 -1
- package/dist/chunks/{chunk-YT5OROR7.js → chunk-RA4L2ACU.js} +12 -2
- package/dist/chunks/{chunk-YGS5VRQT.js → chunk-RKONDLPS.js} +8 -5
- package/dist/chunks/{chunk-IYM44FUX.js → chunk-UC6DULWY.js} +2 -2
- package/dist/chunks/{chunk-2NZXL6OH.js → chunk-XPCUINWS.js} +1 -1
- package/dist/chunks/{chunk-Q4TKRILH.js → chunk-YBPTMJUM.js} +98 -21
- package/dist/chunks/{chunk-5UMJNVKT.js → chunk-Z5OXOZD3.js} +125 -83
- package/dist/chunks/{chunk-X4WBJIOF.js → chunk-ZH5R7W4A.js} +1 -1
- package/dist/chunks/{live-app-QFHS54SX.js → live-app-FBVWUUMT.js} +7 -7
- package/dist/commands/exec/command.d.ts +2 -0
- package/dist/commands/exec/command.js +15 -41
- package/dist/commands/exec/define-run-command.d.ts +17 -10
- 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/metadata.js +1 -1
- package/dist/commands/exec/outcomes.d.ts +13 -3
- package/dist/commands/exec/outcomes.js +21 -4
- package/dist/commands/exec/plan-run.d.ts +11 -3
- package/dist/commands/exec/plan-run.js +3 -2
- package/dist/commands/exec/run-command.d.ts +1 -1
- package/dist/commands/exec/run-command.js +27 -5
- 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/worker-chart.d.ts +1 -1
- package/dist/commands/playwright/command.d.ts +10 -7
- package/dist/commands/playwright/command.js +14 -14
- package/dist/commands/playwright/metadata.js +2 -2
- package/dist/commands/runs/list/command.js +6 -6
- package/dist/commands/runs/logs/command.js +6 -6
- package/dist/commands/runs/show/command.d.ts +2 -2
- package/dist/commands/runs/show/command.js +11 -11
- package/dist/commands/runs/show/outcomes.d.ts +1 -1
- package/dist/commands/snapshots/build/command.js +12 -12
- package/dist/commands/snapshots/list/command.js +9 -9
- package/dist/commands/vitest/command.d.ts +12 -8
- 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/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/arguments.d.ts +10 -4
- package/dist/extensions/testserver/vercel-cli/arguments.js +17 -6
- package/dist/extensions/testserver/vercel-cli/environment.d.ts +12 -1
- package/dist/extensions/testserver/vercel-cli/environment.js +35 -5
- 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/invoker.d.ts +28 -13
- package/dist/extensions/testserver/vercel-cli/invoker.js +81 -67
- package/dist/extensions/testserver/vercel-cli/live/process-gateway.js +4 -10
- 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 +17 -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 +14 -12
- package/dist/extensions/testserver/vitest/diagnostics.js +29 -21
- package/dist/extensions/testserver/vitest/fixtures.d.ts +14 -1
- package/dist/extensions/testserver/vitest/fixtures.js +41 -12
- package/dist/extensions/testserver/vitest/types.d.ts +16 -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/plan.d.ts +3 -2
- package/dist/run-directory/plan.js +6 -3
- package/dist/run-directory/run-record.d.ts +4 -3
- package/dist/runner/recipe.d.ts +5 -1
- package/dist/runner/sandboxed-command.d.ts +5 -3
- package/dist/runner/sandboxed-command.js +10 -4
- 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/testserver-builds.md +0 -82
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `storm vitest`: the run command of storm's Vitest driver, which the Vitest extension brings and the registry gives by
|
|
3
|
-
* name (`driverNamed`, `src/extensions.ts`). It runs `vitest run <args>` in a run, after counting the
|
|
4
|
-
*
|
|
3
|
+
* name (`driverNamed`, `src/extensions.ts`). It runs `vitest run <args>` in a run, after counting, where the config
|
|
4
|
+
* file sets `testPlan`, the test files with `vitest list --filesOnly`, or each test with `vitest list` under
|
|
5
|
+
* `--count-tests`. Its usage, its arguments' help, its examples and what its refusals say are the driver's; `metadata.ts`
|
|
5
6
|
* holds its summary and description as plain text, so group help loads no driver.
|
|
6
7
|
*/
|
|
7
8
|
declare const _default: import("@vercel/clinkr").CommandDefinition<import("zod").ZodObject<{
|
|
@@ -16,6 +17,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<import("zod")
|
|
|
16
17
|
keepSandbox: import("zod").ZodOptional<import("zod").ZodString>;
|
|
17
18
|
verbose: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
18
19
|
args: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
20
|
+
countTests?: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
19
21
|
}, import("zod/v4/core").$strip>, import("@vercel/clinkr").Outcomes<{
|
|
20
22
|
ran: import("zod").ZodObject<{
|
|
21
23
|
version: import("zod").ZodString;
|
|
@@ -81,8 +83,9 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<import("zod")
|
|
|
81
83
|
}, import("zod/v4/core").$strip>>;
|
|
82
84
|
}, import("zod/v4/core").$strip>;
|
|
83
85
|
runId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
noFinalTestResults: import("zod").ZodBoolean;
|
|
87
|
+
plan: import("zod").ZodExactOptional<import("zod").ZodObject<{
|
|
88
|
+
tests: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
86
89
|
files: import("zod").ZodNumber;
|
|
87
90
|
options: import("zod").ZodArray<import("zod").ZodObject<{
|
|
88
91
|
path: import("zod").ZodString;
|
|
@@ -93,7 +96,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<import("zod")
|
|
|
93
96
|
flag: "flag";
|
|
94
97
|
}>;
|
|
95
98
|
}, import("zod/v4/core").$strip>>;
|
|
96
|
-
}, import("zod/v4/core").$strip
|
|
99
|
+
}, import("zod/v4/core").$strip>>;
|
|
97
100
|
}, import("zod/v4/core").$strip>;
|
|
98
101
|
}, {
|
|
99
102
|
ran: unknown;
|
|
@@ -400,8 +403,9 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<import("zod")
|
|
|
400
403
|
}, import("zod/v4/core").$strip>>;
|
|
401
404
|
}, import("zod/v4/core").$strip>;
|
|
402
405
|
runId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
403
|
-
|
|
404
|
-
|
|
406
|
+
noFinalTestResults: import("zod").ZodBoolean;
|
|
407
|
+
plan: import("zod").ZodExactOptional<import("zod").ZodObject<{
|
|
408
|
+
tests: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
405
409
|
files: import("zod").ZodNumber;
|
|
406
410
|
options: import("zod").ZodArray<import("zod").ZodObject<{
|
|
407
411
|
path: import("zod").ZodString;
|
|
@@ -412,7 +416,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<import("zod")
|
|
|
412
416
|
flag: "flag";
|
|
413
417
|
}>;
|
|
414
418
|
}, import("zod/v4/core").$strip>>;
|
|
415
|
-
}, import("zod/v4/core").$strip
|
|
419
|
+
}, import("zod/v4/core").$strip>>;
|
|
416
420
|
}, import("zod/v4/core").$strip>;
|
|
417
421
|
}, {
|
|
418
422
|
ran: unknown;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineRunCommand
|
|
3
|
-
} from "../../chunks/chunk-
|
|
4
|
-
import "../../chunks/chunk-
|
|
5
|
-
import "../../chunks/chunk-
|
|
3
|
+
} from "../../chunks/chunk-IVRRGGCD.js";
|
|
4
|
+
import "../../chunks/chunk-HOKDKP5A.js";
|
|
5
|
+
import "../../chunks/chunk-YBPTMJUM.js";
|
|
6
6
|
import "../../chunks/chunk-I5GZLOLQ.js";
|
|
7
|
-
import "../../chunks/chunk-
|
|
8
|
-
import "../../chunks/chunk-
|
|
9
|
-
import "../../chunks/chunk-
|
|
7
|
+
import "../../chunks/chunk-27P2QSIM.js";
|
|
8
|
+
import "../../chunks/chunk-BFLYGMG3.js";
|
|
9
|
+
import "../../chunks/chunk-XPCUINWS.js";
|
|
10
10
|
import {
|
|
11
11
|
driverNamed
|
|
12
|
-
} from "../../chunks/chunk-
|
|
13
|
-
import "../../chunks/chunk-
|
|
14
|
-
import "../../chunks/chunk-
|
|
12
|
+
} from "../../chunks/chunk-Z5OXOZD3.js";
|
|
13
|
+
import "../../chunks/chunk-UC6DULWY.js";
|
|
14
|
+
import "../../chunks/chunk-BRUIATTR.js";
|
|
15
15
|
import "../../chunks/chunk-NMVODY3P.js";
|
|
16
|
-
import "../../chunks/chunk-
|
|
17
|
-
import "../../chunks/chunk-
|
|
18
|
-
import "../../chunks/chunk-
|
|
19
|
-
import "../../chunks/chunk-
|
|
20
|
-
import "../../chunks/chunk-
|
|
16
|
+
import "../../chunks/chunk-RKONDLPS.js";
|
|
17
|
+
import "../../chunks/chunk-QBR5VHJ7.js";
|
|
18
|
+
import "../../chunks/chunk-5TMHYH7G.js";
|
|
19
|
+
import "../../chunks/chunk-5ED3IDUJ.js";
|
|
20
|
+
import "../../chunks/chunk-RA4L2ACU.js";
|
|
21
21
|
import "../../chunks/chunk-BW2ADH7U.js";
|
|
22
22
|
import "../../chunks/chunk-GQIL3AHY.js";
|
|
23
23
|
import "../../chunks/chunk-GSC6SRTW.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/commands/vitest/metadata.ts
|
|
2
2
|
var metadata = {
|
|
3
|
-
description: "Run vitest run with the run payload in STORM_RUN, after counting its
|
|
4
|
-
summary: "
|
|
3
|
+
description: "Run vitest run with the run payload in STORM_RUN, after counting its test files and sizing the run when storm.config.ts sets testPlan. storm's flags come first; every other argument goes to vitest run unchanged, in order. Put vitest's own dash options, such as -t or --project, after --. Without testPlan: true in storm.config.ts, or --count-tests, it counts nothing, as storm exec counts nothing, so no program of the project runs on this machine before a sandboxed run. With it, before anything is minted, acquired or started, it counts the test files with vitest list --filesOnly --json and the same arguments, on this machine, with this machine's environment: in the working directory for an unsandboxed run (--unsandboxed), and in <repository root>/<runner cwd> for a sandboxed run, the directory where vitest runs in the runner sandbox. That count imports no test file and applies the file filters and --project, but not -t: a -t that matches no test starts the run, and vitest run skips every test and exits 0. With --count-tests it counts each test with vitest list --json instead, whether or not storm.config.ts sets testPlan, which imports every test file to collect its tests, so it is slow for a large suite and needs what the test files import to resolve on this machine. A run that counts refuses with no_matching_tests when vitest lists no file, or no test with --count-tests, and with driver_plan_failed when listing fails; vitest list refuses some options only vitest run takes. A signal while it counts stops vitest list and cancels the run. A vitest config that resolves only inside the runner sandbox can't be counted here: leave testPlan out of storm.config.ts. A resource of the run may size itself from the count: an option whose default is a function of the test plan takes its own flag if given, else its key in storm.config.ts, else the default for the count; the run says each such option's value and where it came from on stderr before it acquires anything. In an unsandboxed run, vitest is the nearest node_modules/.bin/vitest from the working directory up to the repository's root, or the filesystem's root outside a repository; in a sandboxed run, vitest from the runner's PATH, which starts with node_modules/.bin of the runner cwd and of the repository's root. Otherwise it runs as storm exec does: in a runner sandbox by default or on this machine with --unsandboxed, with a live view or plain lines on stderr, a waterfall, a run directory that storm runs show reads back, and the exit code of vitest. A run whose vitest exits 0 but reports no final test result to storm, since the Vitest config lists no storm reporter or a --reporter replaced it, warns no_final_test_results, whose next steps say what to add to the config. The result of a run that counted, and its run directory's run.json, carry the test plan: the files counted, the tests with --count-tests, and each option sized from them, with its value and where it came from.",
|
|
4
|
+
summary: "Run vitest, after counting the test files if storm.config.ts asks."
|
|
5
5
|
};
|
|
6
6
|
export {
|
|
7
7
|
metadata
|
package/dist/config/resolve.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface SettingFlags {
|
|
|
10
10
|
readonly project?: string | undefined;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Resolves each top-level setting: the flag's value, else the config file's. `runner`
|
|
13
|
+
* Resolves each top-level setting: the flag's value, else the config file's. `runner` and `testPlan` have no flag. `file` is the
|
|
14
14
|
* loaded config file's settings, already checked, or `undefined` when no file applies.
|
|
15
15
|
*/
|
|
16
16
|
export declare function resolveSettings(flags: SettingFlags, file: CheckedSettings | undefined): ResolvedSettings;
|
package/dist/config/resolve.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { defaultResourceKey, resourceCall, NOT_COUNTED, optionKeyPath, } from "../sdk/extension/index.js";
|
|
4
4
|
import { settingsOf } from "./typed-options.js";
|
|
5
5
|
/**
|
|
6
|
-
* Resolves each top-level setting: the flag's value, else the config file's. `runner`
|
|
6
|
+
* Resolves each top-level setting: the flag's value, else the config file's. `runner` and `testPlan` have no flag. `file` is the
|
|
7
7
|
* loaded config file's settings, already checked, or `undefined` when no file applies.
|
|
8
8
|
*/
|
|
9
9
|
export function resolveSettings(flags, file) {
|
|
@@ -16,6 +16,7 @@ export function resolveSettings(flags, file) {
|
|
|
16
16
|
scope: pick(flags.scope, file?.scope),
|
|
17
17
|
project: pick(flags.project, file?.project),
|
|
18
18
|
runner: pick(undefined, file?.runner),
|
|
19
|
+
testPlan: pick(undefined, file?.testPlan),
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
/**
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -18,6 +18,14 @@ export interface ConfigSettings {
|
|
|
18
18
|
* `vcpus` may be a function of the run, which reads a resource by its resource factory: `run.get(<name>)`.
|
|
19
19
|
*/
|
|
20
20
|
readonly runner?: RunnerRecipe<RecipeRun>;
|
|
21
|
+
/**
|
|
22
|
+
* Whether `storm vitest` and `storm playwright` plan the tests before a run: `true` counts them on this machine
|
|
23
|
+
* before anything is minted, acquired or started (`storm vitest` the test files, `storm playwright` each test), and
|
|
24
|
+
* the count is the run's test plan, which a resource option's default may size the run from. Without it a run
|
|
25
|
+
* counts nothing, and no program of the project runs on this machine before a run in a runner sandbox. `storm exec`
|
|
26
|
+
* never counts.
|
|
27
|
+
*/
|
|
28
|
+
readonly testPlan?: boolean;
|
|
21
29
|
}
|
|
22
30
|
/** A top-level setting's name. */
|
|
23
31
|
export type ConfigSettingKey = keyof ConfigSettings;
|
package/dist/config/schema.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// What a `storm.config.ts` holds at its top level: the settings `scope`, `project` and `
|
|
2
|
-
// rule, and `resources`, whose sections the resource definitions a caller passes in define (`src/sdk/extension/`). Also
|
|
1
|
+
// What a `storm.config.ts` holds at its top level: the settings `scope`, `project`, `runner` and `testPlan`, each
|
|
2
|
+
// with its rule, and `resources`, whose sections the resource definitions a caller passes in define (`src/sdk/extension/`). Also
|
|
3
3
|
// the check vocabulary every rule shares: `Checked`, `ValueProblem`, `checkWith` and how a problem names a value.
|
|
4
4
|
import { checkRecipe } from "../runner/index.js";
|
|
5
|
-
import { nonEmptyString } from "../sdk/extension/index.js";
|
|
5
|
+
import { booleanOption, nonEmptyString } from "../sdk/extension/index.js";
|
|
6
6
|
/** The config file's name. storm looks for it in the working directory and its parents. */
|
|
7
7
|
export const CONFIG_FILE_NAME = "storm.config.ts";
|
|
8
8
|
/** `value` checked by `schema`: its output, or each issue as a problem at the issue's path inside the value. */
|
|
@@ -23,9 +23,10 @@ const SETTING_CHECKS = {
|
|
|
23
23
|
scope: (value) => checkWith(nonEmptyString, value),
|
|
24
24
|
project: (value) => checkWith(nonEmptyString, value),
|
|
25
25
|
runner: checkRecipe,
|
|
26
|
+
testPlan: (value) => checkWith(booleanOption, value),
|
|
26
27
|
};
|
|
27
28
|
/** Every top-level setting, in the order a config file's problems list them. */
|
|
28
|
-
export const CONFIG_SETTING_KEYS = ["scope", "project", "runner"];
|
|
29
|
+
export const CONFIG_SETTING_KEYS = ["scope", "project", "runner", "testPlan"];
|
|
29
30
|
/** Whether `key` is a top-level setting. */
|
|
30
31
|
export function isConfigSettingKey(key) {
|
|
31
32
|
return Object.hasOwn(SETTING_CHECKS, key);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
// storm's Playwright driver: what the launcher knows of Playwright, the program `storm playwright`'s command starts.
|
|
2
|
-
//
|
|
3
|
-
// gateway (`plan/`), a test once per Playwright project that runs it, and holds
|
|
4
|
-
// `storm playwright`'s leaf help, what its run's summary says to do next, and what its
|
|
5
|
-
// makes `storm playwright` from it (`defineRunCommand`), reaching it through the
|
|
1
|
+
// storm's Playwright driver: what the launcher knows of Playwright, the program `storm playwright`'s command starts. It
|
|
2
|
+
// names the binary, builds the `playwright test` argv, counts the tests, where `storm.config.ts` sets `testPlan`, with
|
|
3
|
+
// `playwright test --list` through its gateway (`plan/`), a test once per Playwright project that runs it, and holds
|
|
4
|
+
// the words that name Playwright: `storm playwright`'s leaf help, what its run's summary says to do next, and what its
|
|
5
|
+
// two refusals say. The launcher makes `storm playwright` from it (`defineRunCommand`), reaching it through the
|
|
6
|
+
// registry (`src/extensions.ts`).
|
|
6
7
|
import { argsText, defineDriver } from "../../sdk/extension/index.js";
|
|
7
8
|
import { describePlaywrightListFailure, livePlaywrightListGateway, planPlaywrightRun, playwrightRunArgv, } from "./plan/plan.js";
|
|
8
9
|
export const playwrightDriver = defineDriver({
|
|
@@ -21,14 +22,14 @@ export const playwrightDriver = defineDriver({
|
|
|
21
22
|
},
|
|
22
23
|
help: {
|
|
23
24
|
usage: "[<playwright test args>...] [-- <playwright dash options>...]",
|
|
24
|
-
args: "What playwright test gets, unchanged and in order: every argument that isn't one of storm's flags, such as file filters, then everything after --, such as --project or --grep. Give file filters before --: Playwright reads each argument after --project as another project. playwright test --list gets the same arguments when it counts the tests.",
|
|
25
|
+
args: "What playwright test gets, unchanged and in order: every argument that isn't one of storm's flags, such as file filters, then everything after --, such as --project or --grep. Give file filters before --: Playwright reads each argument after --project as another project. playwright test --list gets the same arguments when it counts the tests, where storm.config.ts sets testPlan.",
|
|
25
26
|
// Nothing storm brings a Playwright project reads the run payload's `verbose`: storm's Playwright reporter never
|
|
26
27
|
// prints (`printsToStdio()` is false).
|
|
27
28
|
verbose: "which test code can read; storm's Playwright reporter prints nothing either way",
|
|
28
29
|
examples: [
|
|
29
30
|
{
|
|
30
31
|
argv: "",
|
|
31
|
-
description: "Run every test in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts, each resource that sizes itself sized from
|
|
32
|
+
description: "Run every test in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts. Where it sets testPlan, storm counts the tests first, and each resource that sizes itself is sized from that count.",
|
|
32
33
|
},
|
|
33
34
|
{
|
|
34
35
|
argv: "--unsandboxed tests/login.spec.ts -- --project chromium",
|
|
@@ -40,17 +41,23 @@ export const playwrightDriver = defineDriver({
|
|
|
40
41
|
// No final result: the Playwright config doesn't list storm's Playwright reporter, or a `--reporter` on
|
|
41
42
|
// Playwright's command line replaced it. A config lists a reporter as a tuple of its module name.
|
|
42
43
|
noFinalResults: 'add ["@vercel/storm/playwright/reporter"] to the reporter list in playwright.config',
|
|
44
|
+
// storm's Playwright reporter prints nothing, so the steps keep a reporter a person reads beside it. The package may
|
|
45
|
+
// install storm under either of its npm names.
|
|
46
|
+
addReporter: [
|
|
47
|
+
'In the Playwright config the run loads (playwright.config.ts, or the file --config names), set reporter to a list that holds ["@vercel/storm/playwright/reporter"], as in defineConfig({ reporter: [["list"], ["@vercel/storm/playwright/reporter"]] }). If reporter already names reporters, keep them and add ["@vercel/storm/playwright/reporter"] to the list. In a package that installs storm as @cnc-tools/storm, name "@cnc-tools/storm/playwright/reporter".',
|
|
48
|
+
"Remove any --reporter from the arguments given to playwright test, since it replaces the config's reporters, storm's among them. Then run the same storm playwright command again.",
|
|
49
|
+
],
|
|
43
50
|
},
|
|
44
51
|
refusals: {
|
|
45
52
|
noMatchingTests: {
|
|
46
|
-
description: "playwright test --list found no test for the arguments given to playwright test, so nothing was minted, acquired or started.",
|
|
53
|
+
description: "storm.config.ts sets testPlan, and playwright test --list found no test for the arguments given to playwright test, so nothing was minted, acquired or started.",
|
|
47
54
|
message: ({ args, cwd }) => `playwright test --list found no test for playwright test ${argsText(args)} in ${cwd}. The command didn't run.`,
|
|
48
55
|
next: ({ args }) => `Change the arguments given to playwright test (${argsText(args)}), then retry. Put Playwright's own dash options after --.`,
|
|
49
56
|
},
|
|
50
57
|
planFailed: {
|
|
51
|
-
description: "storm couldn't
|
|
58
|
+
description: "storm couldn't plan the run: playwright wasn't found, or, where storm.config.ts sets testPlan, playwright test --list failed to start, didn't finish within 120s, exited other than 0, or wrote something other than a list of tests. Nothing was minted, acquired or started.",
|
|
52
59
|
next: {
|
|
53
|
-
"start-failed": "Install @playwright/test in the package, or run the command with storm exec, which
|
|
60
|
+
"start-failed": "Install @playwright/test in the package, or run the command with storm exec, which needs no playwright.",
|
|
54
61
|
"timed-out": "Check why playwright test --list doesn't finish, such as a config file that waits, then retry.",
|
|
55
62
|
exited: "Fix what playwright test --list reports, then retry.",
|
|
56
63
|
"unreadable-output": "Check that the package's playwright writes its list with --reporter=json to the file PLAYWRIGHT_JSON_OUTPUT_FILE names, then retry.",
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
rejectedCredentialShape,
|
|
7
7
|
rejectedCredentialText,
|
|
8
8
|
testserverPoolDefinition
|
|
9
|
-
} from "../../../../../chunks/chunk-
|
|
9
|
+
} from "../../../../../chunks/chunk-UC6DULWY.js";
|
|
10
10
|
import {
|
|
11
11
|
CREATE_ATTEMPTS,
|
|
12
12
|
DEFAULT_TTL_MINUTES,
|
|
@@ -19,13 +19,13 @@ import {
|
|
|
19
19
|
parseTtl,
|
|
20
20
|
resolvePrBuild,
|
|
21
21
|
shortSha
|
|
22
|
-
} from "../../../../../chunks/chunk-
|
|
22
|
+
} from "../../../../../chunks/chunk-BRUIATTR.js";
|
|
23
23
|
import {
|
|
24
24
|
configErrors,
|
|
25
25
|
credentialErrors,
|
|
26
26
|
credentialSourceErrors
|
|
27
|
-
} from "../../../../../chunks/chunk-
|
|
28
|
-
import "../../../../../chunks/chunk-
|
|
27
|
+
} from "../../../../../chunks/chunk-5ED3IDUJ.js";
|
|
28
|
+
import "../../../../../chunks/chunk-RA4L2ACU.js";
|
|
29
29
|
import {
|
|
30
30
|
testserverCommands
|
|
31
31
|
} from "../../../../../chunks/chunk-GSC6SRTW.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
inspectPool
|
|
3
|
-
} from "../../../../../chunks/chunk-
|
|
4
|
-
import "../../../../../chunks/chunk-
|
|
3
|
+
} from "../../../../../chunks/chunk-BRUIATTR.js";
|
|
4
|
+
import "../../../../../chunks/chunk-RA4L2ACU.js";
|
|
5
5
|
import {
|
|
6
6
|
testserverCommands
|
|
7
7
|
} from "../../../../../chunks/chunk-GSC6SRTW.js";
|
|
@@ -20,7 +20,7 @@ export declare const testserverPoolDefinition: import("../../sdk/extension/resou
|
|
|
20
20
|
readonly default: ({ testPlan }: import("../../sdk/extension/resource-definition.ts").PlannedRun) => number;
|
|
21
21
|
readonly flag: {
|
|
22
22
|
readonly valueLabel: "N";
|
|
23
|
-
readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or
|
|
23
|
+
readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or one per 4 test files when storm vitest or storm playwright counts them (testPlan in storm.config.ts), at most 8. Gives the run the Testserver pool.";
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
readonly build: {
|
|
@@ -10,7 +10,7 @@ export declare const testserverExtension: import("../../sdk/extension/commands.t
|
|
|
10
10
|
readonly default: ({ testPlan }: import("../../sdk/extension/resource-definition.ts").PlannedRun) => number;
|
|
11
11
|
readonly flag: {
|
|
12
12
|
readonly valueLabel: "N";
|
|
13
|
-
readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or
|
|
13
|
+
readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or one per 4 test files when storm vitest or storm playwright counts them (testPlan in storm.config.ts), at most 8. Gives the run the Testserver pool.";
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
readonly build: {
|
|
@@ -6,15 +6,15 @@ import { type OptionSources, type PlannedRun, type ResolvedOptions } from "../..
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const testserverPoolRules: {
|
|
8
8
|
/**
|
|
9
|
-
* How many Testserver sandboxes a run gets: 1 to 32; by default 1, or
|
|
10
|
-
*
|
|
9
|
+
* How many Testserver sandboxes a run gets: 1 to 32; by default 1, or one per 4 test files `storm vitest` or
|
|
10
|
+
* `storm playwright` counted, at most 8, for a run that counts (`testPlan`).
|
|
11
11
|
*/
|
|
12
12
|
readonly sandboxes: {
|
|
13
13
|
readonly schema: z.ZodNumber;
|
|
14
14
|
readonly default: ({ testPlan }: PlannedRun) => number;
|
|
15
15
|
readonly flag: {
|
|
16
16
|
readonly valueLabel: "N";
|
|
17
|
-
readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or
|
|
17
|
+
readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or one per 4 test files when storm vitest or storm playwright counts them (testPlan in storm.config.ts), at most 8. Gives the run the Testserver pool.";
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
@@ -35,17 +35,17 @@ const ttl = z.string(mustBe(TTL)).refine((value) => parseTtl(value) !== undefine
|
|
|
35
35
|
*/
|
|
36
36
|
export const testserverPoolRules = {
|
|
37
37
|
/**
|
|
38
|
-
* How many Testserver sandboxes a run gets: 1 to 32; by default 1, or
|
|
39
|
-
*
|
|
38
|
+
* How many Testserver sandboxes a run gets: 1 to 32; by default 1, or one per 4 test files `storm vitest` or
|
|
39
|
+
* `storm playwright` counted, at most 8, for a run that counts (`testPlan`).
|
|
40
40
|
*/
|
|
41
41
|
sandboxes: {
|
|
42
42
|
schema: sandboxCount,
|
|
43
|
-
// `storm vitest` and `storm playwright` size the run from its
|
|
44
|
-
// `storm exec`'s, asks for one.
|
|
43
|
+
// `storm vitest` and `storm playwright` size the run from its test files where the config file sets `testPlan`; a
|
|
44
|
+
// run that counts none, such as `storm exec`'s, asks for one.
|
|
45
45
|
default: ({ testPlan }) => testPlan.kind === "counted" ? sandboxesForTests(testPlan.files) : MIN_SANDBOXES,
|
|
46
46
|
flag: {
|
|
47
47
|
valueLabel: "N",
|
|
48
|
-
description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or
|
|
48
|
+
description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or one per 4 test files when storm vitest or storm playwright counts them (testPlan in storm.config.ts), at most 8. Gives the run the Testserver pool.",
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
/**
|
|
@@ -18,7 +18,7 @@ export declare const testserverPool: import("../../sdk/extension/resource-factor
|
|
|
18
18
|
readonly default: ({ testPlan }: import("../../sdk/extension/resource-definition.ts").PlannedRun) => number;
|
|
19
19
|
readonly flag: {
|
|
20
20
|
readonly valueLabel: "N";
|
|
21
|
-
readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or
|
|
21
|
+
readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or one per 4 test files when storm vitest or storm playwright counts them (testPlan in storm.config.ts), at most 8. Gives the run the Testserver pool.";
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
readonly build: {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { Redactor } from "./redaction.ts";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
* `args` with `extra` inserted immediately before the first `"--"`, or appended at the end when `args` has no `"--"`,
|
|
4
|
+
* so flags the invoker adds are never turned into positional arguments after `"--"`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function insertBeforeDoubleDash(args: readonly string[], extra: readonly string[]): readonly string[];
|
|
7
|
+
/**
|
|
8
|
+
* An invocation's `vercel` arguments: `args`, with the hidden `--api` flag pointing the CLI at the proxy, `--token`
|
|
9
|
+
* when a token is given, `--global-config`, and `--scope` when one is given inserted immediately before the first
|
|
10
|
+
* `"--"` (or appended at the end when `args` has no `"--"`). Throws a `TypeError` when `args` already passes a flag
|
|
11
|
+
* the invoker adds, `--token` included when no token is given, or a scope flag along with `scope`: the invoker never
|
|
12
|
+
* sends a flag twice, and owns how an invocation authenticates.
|
|
7
13
|
*/
|
|
8
14
|
export declare function vercelArguments(options: {
|
|
9
15
|
readonly args: readonly string[];
|
|
@@ -6,10 +6,21 @@ const SCOPE_FLAGS = ["--scope", "-S", "--team"];
|
|
|
6
6
|
/** Flags whose next argument is a token. */
|
|
7
7
|
const TOKEN_FLAGS = new Set(["--token", "-t"]);
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
* `args` with `extra` inserted immediately before the first `"--"`, or appended at the end when `args` has no `"--"`,
|
|
10
|
+
* so flags the invoker adds are never turned into positional arguments after `"--"`.
|
|
11
|
+
*/
|
|
12
|
+
export function insertBeforeDoubleDash(args, extra) {
|
|
13
|
+
const separator = args.indexOf("--");
|
|
14
|
+
if (separator === -1)
|
|
15
|
+
return [...args, ...extra];
|
|
16
|
+
return [...args.slice(0, separator), ...extra, ...args.slice(separator)];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* An invocation's `vercel` arguments: `args`, with the hidden `--api` flag pointing the CLI at the proxy, `--token`
|
|
20
|
+
* when a token is given, `--global-config`, and `--scope` when one is given inserted immediately before the first
|
|
21
|
+
* `"--"` (or appended at the end when `args` has no `"--"`). Throws a `TypeError` when `args` already passes a flag
|
|
22
|
+
* the invoker adds, `--token` included when no token is given, or a scope flag along with `scope`: the invoker never
|
|
23
|
+
* sends a flag twice, and owns how an invocation authenticates.
|
|
13
24
|
*/
|
|
14
25
|
export function vercelArguments(options) {
|
|
15
26
|
const given = flagsIn(options.args);
|
|
@@ -23,8 +34,7 @@ export function vercelArguments(options) {
|
|
|
23
34
|
throw new TypeError(`vercel-cli: pass the scope either as the scope option or as ${scoped.join(", ")}, not both`);
|
|
24
35
|
}
|
|
25
36
|
}
|
|
26
|
-
|
|
27
|
-
...options.args,
|
|
37
|
+
const invokerFlags = [
|
|
28
38
|
"--api",
|
|
29
39
|
options.proxyUrl,
|
|
30
40
|
...(options.token === undefined ? [] : ["--token", options.token]),
|
|
@@ -32,6 +42,7 @@ export function vercelArguments(options) {
|
|
|
32
42
|
options.globalConfigDir,
|
|
33
43
|
...(options.scope === undefined ? [] : ["--scope", options.scope]),
|
|
34
44
|
];
|
|
45
|
+
return insertBeforeDoubleDash(options.args, invokerFlags);
|
|
35
46
|
}
|
|
36
47
|
/** Whether `args` names the scope with `--scope`, `-S` or `--team`, alone or with `=`, before any `--`. */
|
|
37
48
|
export function passesScopeFlag(args) {
|
|
@@ -13,7 +13,18 @@ export declare const TERMINAL_COLUMNS = 400;
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const RESERVED_VARIABLES: ReadonlySet<string>;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Throws a `TypeError` when `env` names any variable in `RESERVED_VARIABLES`, even when its value is `null`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function checkExtraEnvironment(env: Readonly<Record<string, string | null>>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Merges a handle's default environment variables (`VercelCliOptions.env` and `withEnv`) with an overlay (`withEnv`
|
|
21
|
+
* or a call's `env`): a string value sets or replaces the key, and `null` deletes it from the merged map so the
|
|
22
|
+
* variable is not inherited (and `{ PATH: null }` falls back to `host.PATH`). Validates every key against
|
|
23
|
+
* `RESERVED_VARIABLES`, including keys whose value is `null`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveExtraEnvironment(defaults: Readonly<Record<string, string>> | undefined, call: Readonly<Record<string, string | null>> | undefined): Readonly<Record<string, string>>;
|
|
26
|
+
/**
|
|
27
|
+
* An invocation's whole environment: `PATH`, `SystemRoot`, and `TEMP` from `host` when set, `HOME`, the fixed
|
|
17
28
|
* variables (`NO_COLOR`, `NO_UPDATE_NOTIFIER`, `VERCEL_TELEMETRY_DISABLED`, `VERCEL_TEST_KEYRING_UNAVAILABLE`),
|
|
18
29
|
* `FORCE_TTY=1`, no `CI`, and `CLI_WIDTH` and `COLUMNS` set to `columns` (default `TERMINAL_COLUMNS`) for an
|
|
19
30
|
* invocation at a terminal, or else `CI=1` and no width, as a script or CI has, and the call's `extra`, whose `PATH`
|
|
@@ -38,7 +38,40 @@ export const RESERVED_VARIABLES = new Set([
|
|
|
38
38
|
"VERCEL_TOKEN",
|
|
39
39
|
]);
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Throws a `TypeError` when `env` names any variable in `RESERVED_VARIABLES`, even when its value is `null`.
|
|
42
|
+
*/
|
|
43
|
+
export function checkExtraEnvironment(env) {
|
|
44
|
+
const reserved = Object.keys(env).filter((name) => RESERVED_VARIABLES.has(name));
|
|
45
|
+
if (reserved.length > 0) {
|
|
46
|
+
throw new TypeError(`vercel-cli: env may not set ${reserved.join(", ")}, which the invoker owns`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Merges a handle's default environment variables (`VercelCliOptions.env` and `withEnv`) with an overlay (`withEnv`
|
|
51
|
+
* or a call's `env`): a string value sets or replaces the key, and `null` deletes it from the merged map so the
|
|
52
|
+
* variable is not inherited (and `{ PATH: null }` falls back to `host.PATH`). Validates every key against
|
|
53
|
+
* `RESERVED_VARIABLES`, including keys whose value is `null`.
|
|
54
|
+
*/
|
|
55
|
+
export function resolveExtraEnvironment(defaults, call) {
|
|
56
|
+
if (defaults !== undefined)
|
|
57
|
+
checkExtraEnvironment(defaults);
|
|
58
|
+
if (call !== undefined)
|
|
59
|
+
checkExtraEnvironment(call);
|
|
60
|
+
const merged = defaults === undefined ? {} : { ...defaults };
|
|
61
|
+
if (call !== undefined) {
|
|
62
|
+
for (const [name, value] of Object.entries(call)) {
|
|
63
|
+
if (value === null) {
|
|
64
|
+
delete merged[name];
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
merged[name] = value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return merged;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* An invocation's whole environment: `PATH`, `SystemRoot`, and `TEMP` from `host` when set, `HOME`, the fixed
|
|
42
75
|
* variables (`NO_COLOR`, `NO_UPDATE_NOTIFIER`, `VERCEL_TELEMETRY_DISABLED`, `VERCEL_TEST_KEYRING_UNAVAILABLE`),
|
|
43
76
|
* `FORCE_TTY=1`, no `CI`, and `CLI_WIDTH` and `COLUMNS` set to `columns` (default `TERMINAL_COLUMNS`) for an
|
|
44
77
|
* invocation at a terminal, or else `CI=1` and no width, as a script or CI has, and the call's `extra`, whose `PATH`
|
|
@@ -50,10 +83,7 @@ export const RESERVED_VARIABLES = new Set([
|
|
|
50
83
|
*/
|
|
51
84
|
export function invocationEnvironment(options) {
|
|
52
85
|
const extra = options.extra ?? {};
|
|
53
|
-
|
|
54
|
-
if (reserved.length > 0) {
|
|
55
|
-
throw new TypeError(`vercel-cli: env may not set ${reserved.join(", ")}, which the invoker owns`);
|
|
56
|
-
}
|
|
86
|
+
checkExtraEnvironment(extra);
|
|
57
87
|
const env = {};
|
|
58
88
|
for (const name of PASSED_ON) {
|
|
59
89
|
const value = options.host[name];
|
|
@@ -8,3 +8,4 @@ export { type InvocationEnd, type NotStartedReason, REQUEST_SETTLE_MS, REQUEST_S
|
|
|
8
8
|
export type { VercelKey } from "./keys.ts";
|
|
9
9
|
export { readAuthConfig, readGlobalConfig, writeAuthConfig, writeGlobalConfig } from "./live/config-files.ts";
|
|
10
10
|
export { describeInvocation, describeInvocations, OUTPUT_REPORT_CHARS, STDIN_REPORT_CHARS } from "./report.ts";
|
|
11
|
+
export { VERCEL_CLI_SESSION_ID_HEADER } from "./session-id.ts";
|
|
@@ -12,3 +12,4 @@ export { VercelCliError } from "./errors.js";
|
|
|
12
12
|
export { REQUEST_SETTLE_MS, REQUEST_SETTLE_POLL_MS, STOP_GRACE_MS, WAIT_FOR_TIMEOUT_MS, } from "./invocation.js";
|
|
13
13
|
export { readAuthConfig, readGlobalConfig, writeAuthConfig, writeGlobalConfig } from "./live/config-files.js";
|
|
14
14
|
export { describeInvocation, describeInvocations, OUTPUT_REPORT_CHARS, STDIN_REPORT_CHARS } from "./report.js";
|
|
15
|
+
export { VERCEL_CLI_SESSION_ID_HEADER } from "./session-id.js";
|
|
@@ -32,10 +32,16 @@ export interface VercelCliOptions {
|
|
|
32
32
|
/** How long an invocation may run before it's killed, unless the call says otherwise; default 45s. */
|
|
33
33
|
readonly timeoutMs?: number;
|
|
34
34
|
/**
|
|
35
|
-
* Where `PATH`, `SystemRoot
|
|
36
|
-
* call's `env.PATH` replaces its `PATH` for that invocation.
|
|
35
|
+
* Where `PATH`, `SystemRoot`, and `TEMP` come from; default `process.env`. Nothing else in it reaches `vercel`. A
|
|
36
|
+
* handle's or call's `env.PATH` replaces its `PATH` for that invocation.
|
|
37
37
|
*/
|
|
38
38
|
readonly hostEnv?: Readonly<Record<string, string | undefined>>;
|
|
39
|
+
/**
|
|
40
|
+
* Default environment variables added to every invocation on the returned handle (and handles derived from it via
|
|
41
|
+
* `withEnv`). Validated eagerly against the invoker's reserved variables and shallow-copied. A derived handle's
|
|
42
|
+
* `withEnv` or a call's `env` overrides a key or unsets an inherited key with `null`.
|
|
43
|
+
*/
|
|
44
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
39
45
|
/**
|
|
40
46
|
* Hears each invocation once it has ended, or failed to start, tokens redacted, such as to print it with
|
|
41
47
|
* `describeInvocation` as the test goes. What it throws is dropped. Without one, `vercelCli` prints each invocation
|
|
@@ -73,8 +79,8 @@ export interface VercelCallOptions {
|
|
|
73
79
|
* - `"flag"`: `--token <secret>`, with the token `as` or the default identity names.
|
|
74
80
|
* - `"saved"`: no `--token`. The invoker first saves that token as `token` in `<globalConfigDir>/auth.json`,
|
|
75
81
|
* keeping the file's other keys, so `vercel` reads it as it reads a `vercel login`.
|
|
76
|
-
* - `"none"`: no `--token`, and the invoker removes `token`, `refreshToken
|
|
77
|
-
* its other keys: a logged-out `vercel`. It needs no default identity.
|
|
82
|
+
* - `"none"`: no `--token`, and the invoker removes `token`, `refreshToken`, and `expiresAt` from `auth.json`,
|
|
83
|
+
* keeping its other keys: a logged-out `vercel`. It needs no default identity.
|
|
78
84
|
*
|
|
79
85
|
* The invoker writes `auth.json` only when it differs from what the call needs in those keys. Under `"saved"` and
|
|
80
86
|
* `"none"`, only the call's own `scope` sends `--scope`: `vercel` picks the team as after a login, the saved
|
|
@@ -92,14 +98,15 @@ export interface VercelCallOptions {
|
|
|
92
98
|
/** Where it runs; default `<home>/work`. */
|
|
93
99
|
readonly cwd?: string;
|
|
94
100
|
/**
|
|
95
|
-
* Variables added to its environment
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* `command
|
|
101
|
+
* Variables added to its environment on top of any defaults this handle carries (`VercelCliOptions.env` and
|
|
102
|
+
* `withEnv`). A string value sets or replaces a variable, and `null` unsets an inherited default (`{ PATH: null }`
|
|
103
|
+
* falls back to `hostEnv.PATH`). `PATH` replaces the one from `hostEnv`; naming any other variable the invoker sets
|
|
104
|
+
* (`HOME`, `SystemRoot`, `TEMP`, `FORCE_TTY`, `CI`, `CLI_WIDTH`, `COLUMNS`, `NO_COLOR`, `NO_UPDATE_NOTIFIER`,
|
|
105
|
+
* `VERCEL_TELEMETRY_DISABLED`, `VERCEL_TEST_KEYRING_UNAVAILABLE`), or `VERCEL_TOKEN`, which would undo `auth`, is a
|
|
106
|
+
* usage error, even with `null`. A bare `command.file`, such as the default `vercel`, is looked up on this `PATH`,
|
|
107
|
+
* so a `PATH` without `vercel` needs an absolute `command`.
|
|
101
108
|
*/
|
|
102
|
-
readonly env?: Readonly<Record<string, string>>;
|
|
109
|
+
readonly env?: Readonly<Record<string, string | null>>;
|
|
103
110
|
/** How long it may run before it's killed; default the invoker's `timeoutMs`. */
|
|
104
111
|
readonly timeoutMs?: number;
|
|
105
112
|
}
|
|
@@ -177,12 +184,20 @@ export interface VercelCli {
|
|
|
177
184
|
* Sets who `vercel` acts as by default: `token.secretString` for `--token` and `team.slug` for `--scope` (none for
|
|
178
185
|
* `team: null`), and `auth`, how a call authenticates unless it says otherwise (default `"flag"`). Calling it again
|
|
179
186
|
* replaces the default, `auth` included. The token reads `<token>` in everything the invoker returns or prints from
|
|
180
|
-
* now on. A call's `as`, `scope
|
|
181
|
-
* `--scope`, `-S
|
|
187
|
+
* now on. A call's `as`, `scope`, or `auth` overrides it; the default scope steps aside when a call's arguments name
|
|
188
|
+
* `--scope`, `-S`, or `--team`, and under `"saved"` and `"none"`.
|
|
182
189
|
*/
|
|
183
190
|
actAs(identity: VercelIdentity, options?: {
|
|
184
191
|
readonly auth?: VercelAuth;
|
|
185
192
|
}): void;
|
|
193
|
+
/**
|
|
194
|
+
* Returns a new `VercelCli` handle over the same underlying session (`home`, `globalConfigDir`, `workDir`,
|
|
195
|
+
* `invocations`, `close()`, `failureReport()`, and shared `actAs` identity) with `env` merged over this handle's
|
|
196
|
+
* default environment. String values set or replace a variable, and `null` unsets an inherited default (`{ PATH:
|
|
197
|
+
* null }` falls back to `hostEnv.PATH`). Validates every key eagerly against the invoker's reserved variables,
|
|
198
|
+
* including `null` entries, and leaves this handle unchanged.
|
|
199
|
+
*/
|
|
200
|
+
withEnv(env: Readonly<Record<string, string | null>>): VercelCli;
|
|
186
201
|
/**
|
|
187
202
|
* Runs `vercel` with `args`, and resolves however it ends: its `stdout` and `stderr` with ANSI codes removed, as
|
|
188
203
|
* `waitFor` removes them, and `rawStdout` and `rawStderr` as they arrived. At a terminal, stdin closes at once:
|