@cnc-tools/storm 0.13.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-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/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/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: {
|
|
@@ -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";
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// them and unit tests can check them.
|
|
3
3
|
import { isOpenRecord } from "../../../vendor/testserver-sdk/index.js";
|
|
4
4
|
import { STOP_GRACE_MS } from "./invocation.js";
|
|
5
|
+
import { vercelCliSessionId } from "./session-id.js";
|
|
5
6
|
/** The most characters of each of an invocation's stdout and stderr a report prints: the last ones. */
|
|
6
7
|
export const OUTPUT_REPORT_CHARS = 4000;
|
|
7
8
|
/** The most characters of an invocation's piped stdin text a report prints: the first ones. */
|
|
@@ -70,8 +71,10 @@ export function describeRequests(requests) {
|
|
|
70
71
|
if (requests.length === 0)
|
|
71
72
|
return "no proxy requests while it ran";
|
|
72
73
|
const counts = new Map();
|
|
73
|
-
for (const request of requests)
|
|
74
|
-
|
|
74
|
+
for (const request of requests) {
|
|
75
|
+
const session = vercelCliSessionId(request.requestHeaders);
|
|
76
|
+
counts.set(session, (counts.get(session) ?? 0) + 1);
|
|
77
|
+
}
|
|
75
78
|
const sessions = [...counts].map(([session, count]) => session === undefined ? `no session id (${count})` : `session ${session} (${count})`);
|
|
76
79
|
const noun = requests.length === 1 ? "proxy request" : "proxy requests";
|
|
77
80
|
const open = requests.filter(isOpenRecord).length;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type RecordedHeaders } from "../../../vendor/testserver-sdk/index.js";
|
|
2
|
+
/** The header the `vercel` CLI sends with the same id on every request of one invocation. */
|
|
3
|
+
export declare const VERCEL_CLI_SESSION_ID_HEADER = "x-vercel-cli-session-id";
|
|
4
|
+
/**
|
|
5
|
+
* The `vercel` CLI's session id a request record's `requestHeaders` hold, or `undefined` when it sent none or the
|
|
6
|
+
* record hides it, because its proxy's `recordHeaders` doesn't name the header.
|
|
7
|
+
*/
|
|
8
|
+
export declare function vercelCliSessionId(requestHeaders: RecordedHeaders): string | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The `vercel` CLI's session id, read from a request record's headers. The Vercel CLI invoker's failure report counts
|
|
2
|
+
// proxy records by it, and the Testserver Vitest fixtures' request lines name it. A record shows a header's value only
|
|
3
|
+
// when its proxy's `recordHeaders` names it, so the Testserver Vitest fixtures' `proxy` adds this one; a proxy that
|
|
4
|
+
// doesn't leaves every record without a session id. It belongs with the `vercel` CLI's own tests, and moves to
|
|
5
|
+
// vercel-internal with the invoker. It loads no other file at run time.
|
|
6
|
+
import { REDACTED_HEADER } from "../../../vendor/testserver-sdk/index.js";
|
|
7
|
+
/** The header the `vercel` CLI sends with the same id on every request of one invocation. */
|
|
8
|
+
export const VERCEL_CLI_SESSION_ID_HEADER = "x-vercel-cli-session-id";
|
|
9
|
+
/**
|
|
10
|
+
* The `vercel` CLI's session id a request record's `requestHeaders` hold, or `undefined` when it sent none or the
|
|
11
|
+
* record hides it, because its proxy's `recordHeaders` doesn't name the header.
|
|
12
|
+
*/
|
|
13
|
+
export function vercelCliSessionId(requestHeaders) {
|
|
14
|
+
const sessionId = requestHeaders[VERCEL_CLI_SESSION_ID_HEADER];
|
|
15
|
+
return sessionId === REDACTED_HEADER ? undefined : sessionId;
|
|
16
|
+
}
|
|
@@ -8,8 +8,8 @@ export { WORKERS_PER_SANDBOX } from "../run/sandbox.ts";
|
|
|
8
8
|
* container after a test whose factory call, API request or proxied request failed so, so the retry runs on a new
|
|
9
9
|
* container, where a factory call that half-happened on the old one can't collide with it. vitest's own output marks
|
|
10
10
|
* a test it rescued `(retry x1)`. Spread it to change the count: `retry: { ...testserverTransientRetry, count: 2 }`;
|
|
11
|
-
* under Vitest before 5.0.4, only the first retry can start a container again after a failed start
|
|
12
|
-
* `README.md`, `stormContainer`).
|
|
11
|
+
* under Vitest 4, and Vitest 5 before 5.0.4, only the first retry can start a container again after a failed start
|
|
12
|
+
* (the library's `README.md`, `stormContainer`), and under Vitest 5.0.4 and later each retry can.
|
|
13
13
|
*/
|
|
14
14
|
export declare const testserverTransientRetry: {
|
|
15
15
|
readonly count: number;
|
|
@@ -14,8 +14,8 @@ export { WORKERS_PER_SANDBOX } from "../run/sandbox.js";
|
|
|
14
14
|
* container after a test whose factory call, API request or proxied request failed so, so the retry runs on a new
|
|
15
15
|
* container, where a factory call that half-happened on the old one can't collide with it. vitest's own output marks
|
|
16
16
|
* a test it rescued `(retry x1)`. Spread it to change the count: `retry: { ...testserverTransientRetry, count: 2 }`;
|
|
17
|
-
* under Vitest before 5.0.4, only the first retry can start a container again after a failed start
|
|
18
|
-
* `README.md`, `stormContainer`).
|
|
17
|
+
* under Vitest 4, and Vitest 5 before 5.0.4, only the first retry can start a container again after a failed start
|
|
18
|
+
* (the library's `README.md`, `stormContainer`), and under Vitest 5.0.4 and later each retry can.
|
|
19
19
|
*/
|
|
20
20
|
export const testserverTransientRetry = {
|
|
21
21
|
count: 1,
|
|
@@ -2,7 +2,7 @@ import { type Container, type ServiceWarmup, type TestserverServiceId } from "..
|
|
|
2
2
|
/**
|
|
3
3
|
* How long the Testserver Vitest fixtures' container lives: `'file'`, one container shared by a test file's tests and
|
|
4
4
|
* replaced after a test that failed because of a Testserver failure (`endsSharedContainer`), for a test with different
|
|
5
|
-
* feature flags, or for a test it reached after Testserver had stopped it, as Testserver's idle eviction does, or
|
|
5
|
+
* feature flags or a different `recordHeaders` list, or for a test it reached after Testserver had stopped it, as Testserver's idle eviction does, or
|
|
6
6
|
* `'test'`, one per test.
|
|
7
7
|
*/
|
|
8
8
|
export type ContainerScope = "file" | "test";
|
|
@@ -13,14 +13,23 @@ export type SharedContainer = Pick<Container, "testId" | "testserverUrl" | "feat
|
|
|
13
13
|
/**
|
|
14
14
|
* Where the container `FileContainer.acquire` hands out came from: `reused`, the file's running container; `new`,
|
|
15
15
|
* one it started, or a start in flight it shared; `replaced`, one it started after ending the file's container,
|
|
16
|
-
* which had different
|
|
16
|
+
* which had a different `ContainerKey` or which Testserver had stopped (`FileContainer.replaceStopped`).
|
|
17
17
|
*/
|
|
18
18
|
export type ContainerOrigin = "new" | "reused" | "replaced";
|
|
19
|
+
/**
|
|
20
|
+
* What a file container is started for, which a test must match to share it: the canonical keys of the feature flags
|
|
21
|
+
* (`featureFlagsKey`) and of the `recordHeaders` list (`recordHeadersKey`) of the test that started it.
|
|
22
|
+
*/
|
|
23
|
+
export interface ContainerKey {
|
|
24
|
+
readonly featureFlags: string;
|
|
25
|
+
readonly recordHeaders: string;
|
|
26
|
+
}
|
|
19
27
|
/**
|
|
20
28
|
* Why a new file container replaces the file's container: `feature-flags`, the file's had different feature flags;
|
|
21
|
-
* `
|
|
29
|
+
* `record-headers`, it had a different `recordHeaders` list; `options`, it had both; `stopped`, Testserver had
|
|
30
|
+
* stopped the file's, as its idle eviction does.
|
|
22
31
|
*/
|
|
23
|
-
export type ReplacedFor = "feature-flags" | "stopped";
|
|
32
|
+
export type ReplacedFor = "feature-flags" | "record-headers" | "options" | "stopped";
|
|
24
33
|
/** The container `FileContainer.acquire` hands out, and where it came from. */
|
|
25
34
|
export interface AcquiredContainer<C> {
|
|
26
35
|
readonly container: C;
|
|
@@ -30,28 +39,28 @@ export interface AcquiredContainer<C> {
|
|
|
30
39
|
export type StartFileContainer<C> = (replacing?: ReplacedFor) => Promise<C>;
|
|
31
40
|
/**
|
|
32
41
|
* A test file's container in `'file'` scope. It starts lazily, when the first test asks for it; concurrent
|
|
33
|
-
* `acquire` calls with the same
|
|
34
|
-
* next `acquire` starts again. The container remembers the
|
|
35
|
-
*
|
|
42
|
+
* `acquire` calls with the same `ContainerKey` share one start, and a failed start leaves nothing behind, so the
|
|
43
|
+
* next `acquire` starts again. The container remembers the key it started with: a test with a different one gets a
|
|
44
|
+
* new container, which replaces it.
|
|
36
45
|
*/
|
|
37
46
|
export declare class FileContainer<C extends SharedContainer> {
|
|
38
47
|
#private;
|
|
39
48
|
/** The file's running container, if one has started and not been discarded. */
|
|
40
49
|
get current(): C | undefined;
|
|
41
50
|
/**
|
|
42
|
-
* The file's container for a test whose
|
|
43
|
-
*
|
|
51
|
+
* The file's container for a test whose container key is `key`: the running one, or the one starting, when either
|
|
52
|
+
* has the same key, or one `start` starts. A running container with a different key is
|
|
44
53
|
* forgotten and ended first, and the new one replaces it; when that end fails, rejects saying so, leaving no
|
|
45
54
|
* container. A start in flight with a different key is waited for, its failure ignored, then treated the same way.
|
|
46
55
|
* Throws after `close`.
|
|
47
56
|
*/
|
|
48
|
-
acquire(start: StartFileContainer<C>, key:
|
|
57
|
+
acquire(start: StartFileContainer<C>, key: ContainerKey): Promise<AcquiredContainer<C>>;
|
|
49
58
|
/**
|
|
50
59
|
* Replaces `stopped`, the file's container, which Testserver has stopped, with one `start` starts for a test whose
|
|
51
|
-
*
|
|
60
|
+
* container key is `key`: forgets it, ends it (Testserver answers the end of a stopped container's test id),
|
|
52
61
|
* then starts the new one. When the end fails, rejects saying so, leaving no container. Throws after `close`.
|
|
53
62
|
*/
|
|
54
|
-
replaceStopped(stopped: C, start: StartFileContainer<C>, key:
|
|
63
|
+
replaceStopped(stopped: C, start: StartFileContainer<C>, key: ContainerKey): Promise<AcquiredContainer<C>>;
|
|
55
64
|
/** Forgets `container` if it is the file's, then ends it. An end that fails throws, but it is forgotten all the same. */
|
|
56
65
|
discard(container: C): Promise<void>;
|
|
57
66
|
/**
|
|
@@ -79,9 +88,9 @@ export interface ContainerRequest<C extends SharedContainer> {
|
|
|
79
88
|
* request a fault rule on the test's proxy forwarded, asked in the failure handler.
|
|
80
89
|
*/
|
|
81
90
|
readonly testserverFailed: () => boolean;
|
|
82
|
-
/** The
|
|
83
|
-
readonly
|
|
84
|
-
/** Starts the file's container, in `'file'` scope, saying
|
|
91
|
+
/** The test's container key, its feature flags' and its `recordHeaders` list's, which the file's container must match. */
|
|
92
|
+
readonly containerKey: ContainerKey;
|
|
93
|
+
/** Starts the file's container, in `'file'` scope, saying why it replaces the file's container when it does. */
|
|
85
94
|
readonly startShared: StartFileContainer<C>;
|
|
86
95
|
/** Starts the test's own container, in `'test'` scope. */
|
|
87
96
|
readonly startOwn: () => Promise<C>;
|
|
@@ -96,7 +105,7 @@ export interface ContainerRequest<C extends SharedContainer> {
|
|
|
96
105
|
* container log read there, before the container ends; one that fails later is reported without it.
|
|
97
106
|
*
|
|
98
107
|
* In `'file'` scope, hands the test the file's container, starting it if need be, or replacing it when its feature
|
|
99
|
-
* flags differ from the test's. A test that aborts while it is starting never gets it, but the container stays the
|
|
108
|
+
* flags or its `recordHeaders` list differ from the test's. A test that aborts while it is starting never gets it, but the container stays the
|
|
100
109
|
* file's, for its next test. A test handed a container an earlier test used notes its container log's last record, so
|
|
101
110
|
* its report can print only the records after it. When that note finds Testserver has stopped the container
|
|
102
111
|
* (`container-stopped`), as its idle eviction does between tests, the test gets a new container in its place, before
|