@orkestrel/capture 0.0.4 → 0.0.5
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/README.md +10 -8
- package/dist/src/core/index.cjs +2 -1
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +2 -0
- package/dist/src/core/index.d.ts +2 -0
- package/dist/src/core/index.js +2 -1
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +44 -22
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +32 -10
- package/dist/src/server/index.d.ts +32 -10
- package/dist/src/server/index.js +44 -22
- package/dist/src/server/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -258,6 +258,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
258
258
|
plan: Readonly<{
|
|
259
259
|
type: "boolean";
|
|
260
260
|
}>;
|
|
261
|
+
mode: Readonly<{
|
|
262
|
+
type: "string";
|
|
263
|
+
}>;
|
|
261
264
|
}>;
|
|
262
265
|
readonly capture: Readonly<{
|
|
263
266
|
config: Readonly<{
|
|
@@ -279,6 +282,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
279
282
|
plan: Readonly<{
|
|
280
283
|
type: "boolean";
|
|
281
284
|
}>;
|
|
285
|
+
mode: Readonly<{
|
|
286
|
+
type: "string";
|
|
287
|
+
}>;
|
|
282
288
|
}>;
|
|
283
289
|
readonly stale: Readonly<{
|
|
284
290
|
config: Readonly<{
|
|
@@ -297,6 +303,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
297
303
|
portfolio: Readonly<{
|
|
298
304
|
type: "string";
|
|
299
305
|
}>;
|
|
306
|
+
mode: Readonly<{
|
|
307
|
+
type: "string";
|
|
308
|
+
}>;
|
|
300
309
|
}>;
|
|
301
310
|
readonly preflight: Readonly<{
|
|
302
311
|
variant: Readonly<{
|
|
@@ -321,6 +330,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
321
330
|
checks: Readonly<{
|
|
322
331
|
type: "string";
|
|
323
332
|
}>;
|
|
333
|
+
mode: Readonly<{
|
|
334
|
+
type: "string";
|
|
335
|
+
}>;
|
|
324
336
|
}>;
|
|
325
337
|
readonly sheets: Readonly<{
|
|
326
338
|
variant: Readonly<{
|
|
@@ -345,6 +357,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
345
357
|
checks: Readonly<{
|
|
346
358
|
type: "string";
|
|
347
359
|
}>;
|
|
360
|
+
mode: Readonly<{
|
|
361
|
+
type: "string";
|
|
362
|
+
}>;
|
|
348
363
|
output: Readonly<{
|
|
349
364
|
type: "string";
|
|
350
365
|
}>;
|
|
@@ -696,7 +711,7 @@ export declare const CAPTURE_VITEST_ENTRY = "node_modules/vitest/vitest.mjs";
|
|
|
696
711
|
* absolute JSON reporter path and `projects` the Vitest project labels the stage runs. `filter`
|
|
697
712
|
* is the tag expression. An exact `case` adds the anchored name pattern for that case and the
|
|
698
713
|
* `final` case, so the final case still writes the run record. A `mode` adds Vitest's `--mode`
|
|
699
|
-
* flag
|
|
714
|
+
* flag to discovery and execution children.
|
|
700
715
|
*
|
|
701
716
|
* @example
|
|
702
717
|
* ```ts
|
|
@@ -1049,7 +1064,7 @@ export declare interface CaptureDiscoveryInterface {
|
|
|
1049
1064
|
* @remarks
|
|
1050
1065
|
* `ppid`, `argv`, `directory`, and `config` are the ones `CaptureRequestOptions` names. `projects`
|
|
1051
1066
|
* is the wrapper's own `test.projects` list, each entry an inline project, a promise of one, or a
|
|
1052
|
-
* factory, which the answer resolves the
|
|
1067
|
+
* factory, which the answer resolves with the requested mode or the default test mode.
|
|
1053
1068
|
*
|
|
1054
1069
|
* @example
|
|
1055
1070
|
* ```ts
|
|
@@ -1076,7 +1091,8 @@ export declare interface CaptureDiscoveryOptions {
|
|
|
1076
1091
|
* `phase` is always `discover`, which is what tells a wrapper this is no execution request. `nonce`
|
|
1077
1092
|
* is the challenge the wrapper must echo in its answer, `pid` the runner's process id, `config` the
|
|
1078
1093
|
* repository-relative wrapper path, and `args` the exact arguments the discovery child was spawned
|
|
1079
|
-
* with.
|
|
1094
|
+
* with. `mode` is present when the command line selects one. The file has the name and location of
|
|
1095
|
+
* an execution request, so one lease covers both.
|
|
1080
1096
|
*
|
|
1081
1097
|
* @example
|
|
1082
1098
|
* ```ts
|
|
@@ -1097,6 +1113,7 @@ export declare interface CaptureDiscoveryRequest {
|
|
|
1097
1113
|
readonly id: string;
|
|
1098
1114
|
readonly nonce: string;
|
|
1099
1115
|
readonly config: string;
|
|
1116
|
+
readonly mode?: string;
|
|
1100
1117
|
readonly pid: number;
|
|
1101
1118
|
readonly args: readonly string[];
|
|
1102
1119
|
}
|
|
@@ -2173,7 +2190,8 @@ export declare interface CaptureReaderDefaults {
|
|
|
2173
2190
|
* Configures a read-only capture consumer using the wrapper's host declarations.
|
|
2174
2191
|
*
|
|
2175
2192
|
* @remarks
|
|
2176
|
-
* `root` is the absolute workspace and `config` the absolute wrapper path. `
|
|
2193
|
+
* `root` is the absolute workspace and `config` the absolute wrapper path. `mode` selects Vitest's
|
|
2194
|
+
* wrapper mode when present. `selection` bounds the
|
|
2177
2195
|
* population, and `journeys` is the absolute directory of journey artifacts. `checks`, when
|
|
2178
2196
|
* supplied, is the path of a module, absolute or relative to `root`, that exports the host's
|
|
2179
2197
|
* `CAPTURE_CHECKS` list of frame readers. The reader loads it through the runtime's own module
|
|
@@ -2197,6 +2215,7 @@ export declare interface CaptureReaderDefaults {
|
|
|
2197
2215
|
export declare interface CaptureReaderOptions {
|
|
2198
2216
|
readonly root: string;
|
|
2199
2217
|
readonly config: string;
|
|
2218
|
+
readonly mode?: string;
|
|
2200
2219
|
readonly selection: CaptureReadOptions;
|
|
2201
2220
|
readonly journeys: string;
|
|
2202
2221
|
readonly checks?: string;
|
|
@@ -2474,7 +2493,8 @@ export declare class CaptureRunner implements CaptureRunnerInterface {
|
|
|
2474
2493
|
}
|
|
2475
2494
|
|
|
2476
2495
|
/**
|
|
2477
|
-
* Carries parsed runner arguments
|
|
2496
|
+
* Carries parsed runner arguments, including an optional wrapper mode, while leaving omitted
|
|
2497
|
+
* selectors available to the usage diagnostic.
|
|
2478
2498
|
*
|
|
2479
2499
|
* @example
|
|
2480
2500
|
* ```ts
|
|
@@ -2486,6 +2506,7 @@ export declare interface CaptureRunnerArguments {
|
|
|
2486
2506
|
readonly changed?: string;
|
|
2487
2507
|
readonly plan?: boolean;
|
|
2488
2508
|
readonly config: string;
|
|
2509
|
+
readonly mode?: string;
|
|
2489
2510
|
readonly variants: readonly string[];
|
|
2490
2511
|
readonly case?: string;
|
|
2491
2512
|
readonly state?: string;
|
|
@@ -2560,7 +2581,7 @@ export declare interface CaptureRunnerOptions {
|
|
|
2560
2581
|
* wrapper path, and `final` the full name of the case that closes a variant's run. `filter` is
|
|
2561
2582
|
* the tag expression. `case` and `state` appear only when the command line named them, and `case`
|
|
2562
2583
|
* holds the resolved declaring case once a state selects one. `command` is the request command
|
|
2563
|
-
* every stage records.
|
|
2584
|
+
* every stage records. `mode` selects the wrapper's Vitest mode when present.
|
|
2564
2585
|
*
|
|
2565
2586
|
* @example
|
|
2566
2587
|
* ```ts
|
|
@@ -2585,6 +2606,7 @@ export declare interface CaptureRunPlan {
|
|
|
2585
2606
|
readonly final: string;
|
|
2586
2607
|
readonly directory: string;
|
|
2587
2608
|
readonly config: string;
|
|
2609
|
+
readonly mode?: string;
|
|
2588
2610
|
}
|
|
2589
2611
|
|
|
2590
2612
|
/**
|
|
@@ -3509,7 +3531,7 @@ export declare function readCaptureProject(test: unknown): CaptureProject;
|
|
|
3509
3531
|
* @remarks
|
|
3510
3532
|
* The first argument is the selector and every flag after it takes one nonempty value, separated
|
|
3511
3533
|
* or in equals form. Only `--variant` repeats. `--output` belongs to sheets; the preflight option
|
|
3512
|
-
* table refuses it before discovery. The wrapper, the journey artifact directory, and the checks module
|
|
3534
|
+
* table refuses it before discovery. `--mode` selects the wrapper's Vitest mode. The wrapper, the journey artifact directory, and the checks module
|
|
3513
3535
|
* resolve against `root`; `defaults` supplies the first two when the command line names neither.
|
|
3514
3536
|
*
|
|
3515
3537
|
* @param argv - The arguments after the entry name
|
|
@@ -3845,8 +3867,8 @@ export declare function resolveCaptureVariants(selected: readonly string[], proj
|
|
|
3845
3867
|
* Resolves one entry of a wrapper's project list to the project it declares.
|
|
3846
3868
|
*
|
|
3847
3869
|
* @remarks
|
|
3848
|
-
* A factory entry is called with the serve command and the
|
|
3849
|
-
* promise is awaited. The result is the project as plain data
|
|
3870
|
+
* A factory entry is called with the serve command and the requested mode, or the default test
|
|
3871
|
+
* mode, as Vitest calls it, and a promise is awaited. The result is the project as plain data: the runner reads
|
|
3850
3872
|
* and validates it, so one reader owns every refusal.
|
|
3851
3873
|
*
|
|
3852
3874
|
* @param input - The entry as the wrapper declared it: an inline project, a promise of one, or a factory
|
|
@@ -3857,7 +3879,7 @@ export declare function resolveCaptureVariants(selected: readonly string[], proj
|
|
|
3857
3879
|
* const project = await resolveCaptureWrapperProject(wrapper.test.projects[0])
|
|
3858
3880
|
* ```
|
|
3859
3881
|
*/
|
|
3860
|
-
export declare function resolveCaptureWrapperProject(input: unknown): Promise<unknown>;
|
|
3882
|
+
export declare function resolveCaptureWrapperProject(input: unknown, mode?: string): Promise<unknown>;
|
|
3861
3883
|
|
|
3862
3884
|
/**
|
|
3863
3885
|
* Reports a portfolio, owner, and viewport whose frames mix cropped, viewport-sized, and page-sized images.
|
|
@@ -258,6 +258,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
258
258
|
plan: Readonly<{
|
|
259
259
|
type: "boolean";
|
|
260
260
|
}>;
|
|
261
|
+
mode: Readonly<{
|
|
262
|
+
type: "string";
|
|
263
|
+
}>;
|
|
261
264
|
}>;
|
|
262
265
|
readonly capture: Readonly<{
|
|
263
266
|
config: Readonly<{
|
|
@@ -279,6 +282,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
279
282
|
plan: Readonly<{
|
|
280
283
|
type: "boolean";
|
|
281
284
|
}>;
|
|
285
|
+
mode: Readonly<{
|
|
286
|
+
type: "string";
|
|
287
|
+
}>;
|
|
282
288
|
}>;
|
|
283
289
|
readonly stale: Readonly<{
|
|
284
290
|
config: Readonly<{
|
|
@@ -297,6 +303,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
297
303
|
portfolio: Readonly<{
|
|
298
304
|
type: "string";
|
|
299
305
|
}>;
|
|
306
|
+
mode: Readonly<{
|
|
307
|
+
type: "string";
|
|
308
|
+
}>;
|
|
300
309
|
}>;
|
|
301
310
|
readonly preflight: Readonly<{
|
|
302
311
|
variant: Readonly<{
|
|
@@ -321,6 +330,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
321
330
|
checks: Readonly<{
|
|
322
331
|
type: "string";
|
|
323
332
|
}>;
|
|
333
|
+
mode: Readonly<{
|
|
334
|
+
type: "string";
|
|
335
|
+
}>;
|
|
324
336
|
}>;
|
|
325
337
|
readonly sheets: Readonly<{
|
|
326
338
|
variant: Readonly<{
|
|
@@ -345,6 +357,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
345
357
|
checks: Readonly<{
|
|
346
358
|
type: "string";
|
|
347
359
|
}>;
|
|
360
|
+
mode: Readonly<{
|
|
361
|
+
type: "string";
|
|
362
|
+
}>;
|
|
348
363
|
output: Readonly<{
|
|
349
364
|
type: "string";
|
|
350
365
|
}>;
|
|
@@ -696,7 +711,7 @@ export declare const CAPTURE_VITEST_ENTRY = "node_modules/vitest/vitest.mjs";
|
|
|
696
711
|
* absolute JSON reporter path and `projects` the Vitest project labels the stage runs. `filter`
|
|
697
712
|
* is the tag expression. An exact `case` adds the anchored name pattern for that case and the
|
|
698
713
|
* `final` case, so the final case still writes the run record. A `mode` adds Vitest's `--mode`
|
|
699
|
-
* flag
|
|
714
|
+
* flag to discovery and execution children.
|
|
700
715
|
*
|
|
701
716
|
* @example
|
|
702
717
|
* ```ts
|
|
@@ -1049,7 +1064,7 @@ export declare interface CaptureDiscoveryInterface {
|
|
|
1049
1064
|
* @remarks
|
|
1050
1065
|
* `ppid`, `argv`, `directory`, and `config` are the ones `CaptureRequestOptions` names. `projects`
|
|
1051
1066
|
* is the wrapper's own `test.projects` list, each entry an inline project, a promise of one, or a
|
|
1052
|
-
* factory, which the answer resolves the
|
|
1067
|
+
* factory, which the answer resolves with the requested mode or the default test mode.
|
|
1053
1068
|
*
|
|
1054
1069
|
* @example
|
|
1055
1070
|
* ```ts
|
|
@@ -1076,7 +1091,8 @@ export declare interface CaptureDiscoveryOptions {
|
|
|
1076
1091
|
* `phase` is always `discover`, which is what tells a wrapper this is no execution request. `nonce`
|
|
1077
1092
|
* is the challenge the wrapper must echo in its answer, `pid` the runner's process id, `config` the
|
|
1078
1093
|
* repository-relative wrapper path, and `args` the exact arguments the discovery child was spawned
|
|
1079
|
-
* with.
|
|
1094
|
+
* with. `mode` is present when the command line selects one. The file has the name and location of
|
|
1095
|
+
* an execution request, so one lease covers both.
|
|
1080
1096
|
*
|
|
1081
1097
|
* @example
|
|
1082
1098
|
* ```ts
|
|
@@ -1097,6 +1113,7 @@ export declare interface CaptureDiscoveryRequest {
|
|
|
1097
1113
|
readonly id: string;
|
|
1098
1114
|
readonly nonce: string;
|
|
1099
1115
|
readonly config: string;
|
|
1116
|
+
readonly mode?: string;
|
|
1100
1117
|
readonly pid: number;
|
|
1101
1118
|
readonly args: readonly string[];
|
|
1102
1119
|
}
|
|
@@ -2173,7 +2190,8 @@ export declare interface CaptureReaderDefaults {
|
|
|
2173
2190
|
* Configures a read-only capture consumer using the wrapper's host declarations.
|
|
2174
2191
|
*
|
|
2175
2192
|
* @remarks
|
|
2176
|
-
* `root` is the absolute workspace and `config` the absolute wrapper path. `
|
|
2193
|
+
* `root` is the absolute workspace and `config` the absolute wrapper path. `mode` selects Vitest's
|
|
2194
|
+
* wrapper mode when present. `selection` bounds the
|
|
2177
2195
|
* population, and `journeys` is the absolute directory of journey artifacts. `checks`, when
|
|
2178
2196
|
* supplied, is the path of a module, absolute or relative to `root`, that exports the host's
|
|
2179
2197
|
* `CAPTURE_CHECKS` list of frame readers. The reader loads it through the runtime's own module
|
|
@@ -2197,6 +2215,7 @@ export declare interface CaptureReaderDefaults {
|
|
|
2197
2215
|
export declare interface CaptureReaderOptions {
|
|
2198
2216
|
readonly root: string;
|
|
2199
2217
|
readonly config: string;
|
|
2218
|
+
readonly mode?: string;
|
|
2200
2219
|
readonly selection: CaptureReadOptions;
|
|
2201
2220
|
readonly journeys: string;
|
|
2202
2221
|
readonly checks?: string;
|
|
@@ -2474,7 +2493,8 @@ export declare class CaptureRunner implements CaptureRunnerInterface {
|
|
|
2474
2493
|
}
|
|
2475
2494
|
|
|
2476
2495
|
/**
|
|
2477
|
-
* Carries parsed runner arguments
|
|
2496
|
+
* Carries parsed runner arguments, including an optional wrapper mode, while leaving omitted
|
|
2497
|
+
* selectors available to the usage diagnostic.
|
|
2478
2498
|
*
|
|
2479
2499
|
* @example
|
|
2480
2500
|
* ```ts
|
|
@@ -2486,6 +2506,7 @@ export declare interface CaptureRunnerArguments {
|
|
|
2486
2506
|
readonly changed?: string;
|
|
2487
2507
|
readonly plan?: boolean;
|
|
2488
2508
|
readonly config: string;
|
|
2509
|
+
readonly mode?: string;
|
|
2489
2510
|
readonly variants: readonly string[];
|
|
2490
2511
|
readonly case?: string;
|
|
2491
2512
|
readonly state?: string;
|
|
@@ -2560,7 +2581,7 @@ export declare interface CaptureRunnerOptions {
|
|
|
2560
2581
|
* wrapper path, and `final` the full name of the case that closes a variant's run. `filter` is
|
|
2561
2582
|
* the tag expression. `case` and `state` appear only when the command line named them, and `case`
|
|
2562
2583
|
* holds the resolved declaring case once a state selects one. `command` is the request command
|
|
2563
|
-
* every stage records.
|
|
2584
|
+
* every stage records. `mode` selects the wrapper's Vitest mode when present.
|
|
2564
2585
|
*
|
|
2565
2586
|
* @example
|
|
2566
2587
|
* ```ts
|
|
@@ -2585,6 +2606,7 @@ export declare interface CaptureRunPlan {
|
|
|
2585
2606
|
readonly final: string;
|
|
2586
2607
|
readonly directory: string;
|
|
2587
2608
|
readonly config: string;
|
|
2609
|
+
readonly mode?: string;
|
|
2588
2610
|
}
|
|
2589
2611
|
|
|
2590
2612
|
/**
|
|
@@ -3509,7 +3531,7 @@ export declare function readCaptureProject(test: unknown): CaptureProject;
|
|
|
3509
3531
|
* @remarks
|
|
3510
3532
|
* The first argument is the selector and every flag after it takes one nonempty value, separated
|
|
3511
3533
|
* or in equals form. Only `--variant` repeats. `--output` belongs to sheets; the preflight option
|
|
3512
|
-
* table refuses it before discovery. The wrapper, the journey artifact directory, and the checks module
|
|
3534
|
+
* table refuses it before discovery. `--mode` selects the wrapper's Vitest mode. The wrapper, the journey artifact directory, and the checks module
|
|
3513
3535
|
* resolve against `root`; `defaults` supplies the first two when the command line names neither.
|
|
3514
3536
|
*
|
|
3515
3537
|
* @param argv - The arguments after the entry name
|
|
@@ -3845,8 +3867,8 @@ export declare function resolveCaptureVariants(selected: readonly string[], proj
|
|
|
3845
3867
|
* Resolves one entry of a wrapper's project list to the project it declares.
|
|
3846
3868
|
*
|
|
3847
3869
|
* @remarks
|
|
3848
|
-
* A factory entry is called with the serve command and the
|
|
3849
|
-
* promise is awaited. The result is the project as plain data
|
|
3870
|
+
* A factory entry is called with the serve command and the requested mode, or the default test
|
|
3871
|
+
* mode, as Vitest calls it, and a promise is awaited. The result is the project as plain data: the runner reads
|
|
3850
3872
|
* and validates it, so one reader owns every refusal.
|
|
3851
3873
|
*
|
|
3852
3874
|
* @param input - The entry as the wrapper declared it: an inline project, a promise of one, or a factory
|
|
@@ -3857,7 +3879,7 @@ export declare function resolveCaptureVariants(selected: readonly string[], proj
|
|
|
3857
3879
|
* const project = await resolveCaptureWrapperProject(wrapper.test.projects[0])
|
|
3858
3880
|
* ```
|
|
3859
3881
|
*/
|
|
3860
|
-
export declare function resolveCaptureWrapperProject(input: unknown): Promise<unknown>;
|
|
3882
|
+
export declare function resolveCaptureWrapperProject(input: unknown, mode?: string): Promise<unknown>;
|
|
3861
3883
|
|
|
3862
3884
|
/**
|
|
3863
3885
|
* Reports a portfolio, owner, and viewport whose frames mix cropped, viewport-sized, and page-sized images.
|
package/dist/src/server/index.js
CHANGED
|
@@ -97,7 +97,8 @@ var CAPTURE_COMMAND_OPTIONS = Object.freeze({
|
|
|
97
97
|
}),
|
|
98
98
|
case: Object.freeze({ type: "string" }),
|
|
99
99
|
changed: Object.freeze({ type: "string" }),
|
|
100
|
-
plan: Object.freeze({ type: "boolean" })
|
|
100
|
+
plan: Object.freeze({ type: "boolean" }),
|
|
101
|
+
mode: Object.freeze({ type: "string" })
|
|
101
102
|
}),
|
|
102
103
|
capture: Object.freeze({
|
|
103
104
|
config: Object.freeze({ type: "string" }),
|
|
@@ -108,7 +109,8 @@ var CAPTURE_COMMAND_OPTIONS = Object.freeze({
|
|
|
108
109
|
case: Object.freeze({ type: "string" }),
|
|
109
110
|
state: Object.freeze({ type: "string" }),
|
|
110
111
|
changed: Object.freeze({ type: "string" }),
|
|
111
|
-
plan: Object.freeze({ type: "boolean" })
|
|
112
|
+
plan: Object.freeze({ type: "boolean" }),
|
|
113
|
+
mode: Object.freeze({ type: "string" })
|
|
112
114
|
}),
|
|
113
115
|
stale: Object.freeze({
|
|
114
116
|
config: Object.freeze({ type: "string" }),
|
|
@@ -118,7 +120,8 @@ var CAPTURE_COMMAND_OPTIONS = Object.freeze({
|
|
|
118
120
|
}),
|
|
119
121
|
case: Object.freeze({ type: "string" }),
|
|
120
122
|
state: Object.freeze({ type: "string" }),
|
|
121
|
-
portfolio: Object.freeze({ type: "string" })
|
|
123
|
+
portfolio: Object.freeze({ type: "string" }),
|
|
124
|
+
mode: Object.freeze({ type: "string" })
|
|
122
125
|
}),
|
|
123
126
|
preflight: Object.freeze({
|
|
124
127
|
variant: Object.freeze({
|
|
@@ -130,7 +133,8 @@ var CAPTURE_COMMAND_OPTIONS = Object.freeze({
|
|
|
130
133
|
portfolio: Object.freeze({ type: "string" }),
|
|
131
134
|
config: Object.freeze({ type: "string" }),
|
|
132
135
|
journeys: Object.freeze({ type: "string" }),
|
|
133
|
-
checks: Object.freeze({ type: "string" })
|
|
136
|
+
checks: Object.freeze({ type: "string" }),
|
|
137
|
+
mode: Object.freeze({ type: "string" })
|
|
134
138
|
}),
|
|
135
139
|
sheets: Object.freeze({
|
|
136
140
|
variant: Object.freeze({
|
|
@@ -143,6 +147,7 @@ var CAPTURE_COMMAND_OPTIONS = Object.freeze({
|
|
|
143
147
|
config: Object.freeze({ type: "string" }),
|
|
144
148
|
journeys: Object.freeze({ type: "string" }),
|
|
145
149
|
checks: Object.freeze({ type: "string" }),
|
|
150
|
+
mode: Object.freeze({ type: "string" }),
|
|
146
151
|
output: Object.freeze({ type: "string" })
|
|
147
152
|
}),
|
|
148
153
|
registry: Object.freeze({
|
|
@@ -413,13 +418,13 @@ var CAPTURE_DISCOVERY = Object.freeze({
|
|
|
413
418
|
var CAPTURE_USAGE = [
|
|
414
419
|
"Usage: capture <command> [arguments]",
|
|
415
420
|
"Commands:",
|
|
416
|
-
" journey <selector> [--variant <name>]... [--case <full name>] [--config <file>]",
|
|
417
|
-
" journey --changed <ref> [--plan] [--variant <name>]... [--case <full name>] [--config <file>]",
|
|
418
|
-
" frames <selector> [--variant <name>]... [--case <full name>] [--state <name>] [--config <file>]",
|
|
419
|
-
" frames --changed <ref> [--plan] [--variant <name>]... [--case <full name>] [--state <name>] [--config <file>]",
|
|
420
|
-
" stale <selector> [--variant <name>]... [--case <full name>] [--state <name>] [--portfolio <name>] [--config <file>]",
|
|
421
|
-
" preflight <selector> [--variant <name>]... [--state <name>] [--case <full name>] [--portfolio <name>] [--config <file>] [--journeys <directory>] [--checks <module>]",
|
|
422
|
-
" sheets <selector> --output <new directory> [--variant <name>]... [--state <name>] [--case <full name>] [--portfolio <name>] [--config <file>] [--journeys <directory>] [--checks <module>]",
|
|
421
|
+
" journey <selector> [--variant <name>]... [--case <full name>] [--mode <name>] [--config <file>]",
|
|
422
|
+
" journey --changed <ref> [--plan] [--variant <name>]... [--case <full name>] [--mode <name>] [--config <file>]",
|
|
423
|
+
" frames <selector> [--variant <name>]... [--case <full name>] [--state <name>] [--mode <name>] [--config <file>]",
|
|
424
|
+
" frames --changed <ref> [--plan] [--variant <name>]... [--case <full name>] [--state <name>] [--mode <name>] [--config <file>]",
|
|
425
|
+
" stale <selector> [--variant <name>]... [--case <full name>] [--state <name>] [--portfolio <name>] [--mode <name>] [--config <file>]",
|
|
426
|
+
" preflight <selector> [--variant <name>]... [--state <name>] [--case <full name>] [--portfolio <name>] [--mode <name>] [--config <file>] [--journeys <directory>] [--checks <module>]",
|
|
427
|
+
" sheets <selector> --output <new directory> [--variant <name>]... [--state <name>] [--case <full name>] [--portfolio <name>] [--mode <name>] [--config <file>] [--journeys <directory>] [--checks <module>]",
|
|
423
428
|
" registry [--variant <name>]... [--mode <name>] [--config <file>]",
|
|
424
429
|
"--changed takes one Git ref; HEAD selects uncommitted work. It cannot accompany a selector.",
|
|
425
430
|
"--plan requires --changed and prints paths and commands after read-only discovery; no execution child starts.",
|
|
@@ -495,6 +500,7 @@ function renderCaptureCommand(command, parsed, selector, root) {
|
|
|
495
500
|
command === "registry" ? command : CAPTURE_COMMAND_NAMES[command],
|
|
496
501
|
...selector === void 0 ? [] : [selector],
|
|
497
502
|
...parsed.variants.flatMap((variant) => ["--variant", variant]),
|
|
503
|
+
...parsed.mode === void 0 ? [] : ["--mode", parsed.mode],
|
|
498
504
|
...parsed.case === void 0 ? [] : parsed.case.startsWith("-") ? [`--case=${parsed.case}`] : ["--case", parsed.case],
|
|
499
505
|
...parsed.state === void 0 ? [] : ["--state", parsed.state],
|
|
500
506
|
...config.startsWith("-") ? [`--config=${config}`] : ["--config", config]
|
|
@@ -1372,7 +1378,7 @@ function buildCaptureArguments(options) {
|
|
|
1372
1378
|
"run",
|
|
1373
1379
|
"--config",
|
|
1374
1380
|
options.config,
|
|
1375
|
-
...options.mode === void 0 ? [] : ["--mode", options.mode],
|
|
1381
|
+
...options.mode === void 0 ? [] : options.mode.startsWith("-") ? [`--mode=${options.mode}`] : ["--mode", options.mode],
|
|
1376
1382
|
"--configLoader",
|
|
1377
1383
|
"runner",
|
|
1378
1384
|
"--no-cache",
|
|
@@ -1510,6 +1516,7 @@ function readCaptureArguments(argv, command, root, fallback) {
|
|
|
1510
1516
|
const state = "state" in values && typeof values.state === "string" ? values.state : void 0;
|
|
1511
1517
|
if (state !== void 0 && !isCaptureSegment(state)) throw new CaptureError(`Invalid state identity; ${describeCaptureFault("--state", state, "a portable nonempty state identity; valid values come from the selected case's state declarations")}`, { code: "USAGE" });
|
|
1512
1518
|
const name = values.case;
|
|
1519
|
+
const mode = values.mode;
|
|
1513
1520
|
if (name !== void 0 && name.trim() === "") throw new CaptureError("Empty case name", { code: "USAGE" });
|
|
1514
1521
|
const portfolio = "portfolio" in values && typeof values.portfolio === "string" ? values.portfolio : void 0;
|
|
1515
1522
|
const selector = positional.at(0);
|
|
@@ -1522,6 +1529,7 @@ function readCaptureArguments(argv, command, root, fallback) {
|
|
|
1522
1529
|
...changed === void 0 ? {} : { changed },
|
|
1523
1530
|
...plan ? { plan: true } : {},
|
|
1524
1531
|
config: resolve(root, values.config ?? fallback),
|
|
1532
|
+
...mode === void 0 ? {} : { mode },
|
|
1525
1533
|
variants,
|
|
1526
1534
|
...name === void 0 ? {} : { case: name },
|
|
1527
1535
|
...state === void 0 ? {} : { state },
|
|
@@ -1782,6 +1790,7 @@ function readCaptureRequest(options) {
|
|
|
1782
1790
|
if (parsed.version !== 1) throw new CaptureError("Journey selection request has invalid version", { code: "HOST" });
|
|
1783
1791
|
if (!isCaptureSegment(parsed.id) || !isCaptureSegment(parsed.stage)) throw new CaptureError("Journey selection request has invalid identity", { code: "HOST" });
|
|
1784
1792
|
if (parsed.config !== options.config) throw new CaptureError("Journey selection request has invalid config", { code: "HOST" });
|
|
1793
|
+
if (parsed.mode !== void 0 && (typeof parsed.mode !== "string" || parsed.mode.trim() === "")) throw new CaptureError("Journey selection request has invalid mode", { code: "HOST" });
|
|
1785
1794
|
const command = parsed.command === "journey" || parsed.command === "capture" ? parsed.command : void 0;
|
|
1786
1795
|
if (parsed.state !== void 0 && (typeof parsed.state !== "string" || parsed.state.trim() === "" || command !== "capture")) throw new CaptureError("Journey selection request has invalid state", { code: "HOST" });
|
|
1787
1796
|
const selector = typeof parsed.selector === "string" ? parsed.selector : void 0;
|
|
@@ -1794,6 +1803,7 @@ function readCaptureRequest(options) {
|
|
|
1794
1803
|
config: options.config,
|
|
1795
1804
|
pid: options.ppid,
|
|
1796
1805
|
command,
|
|
1806
|
+
...typeof parsed.mode === "string" ? { mode: parsed.mode } : {},
|
|
1797
1807
|
selector,
|
|
1798
1808
|
...typeof parsed.case === "string" ? { case: parsed.case } : {},
|
|
1799
1809
|
variants,
|
|
@@ -1807,7 +1817,7 @@ function readCaptureRequest(options) {
|
|
|
1807
1817
|
* @remarks
|
|
1808
1818
|
* The first argument is the selector and every flag after it takes one nonempty value, separated
|
|
1809
1819
|
* or in equals form. Only `--variant` repeats. `--output` belongs to sheets; the preflight option
|
|
1810
|
-
* table refuses it before discovery. The wrapper, the journey artifact directory, and the checks module
|
|
1820
|
+
* table refuses it before discovery. `--mode` selects the wrapper's Vitest mode. The wrapper, the journey artifact directory, and the checks module
|
|
1811
1821
|
* resolve against `root`; `defaults` supplies the first two when the command line names neither.
|
|
1812
1822
|
*
|
|
1813
1823
|
* @param argv - The arguments after the entry name
|
|
@@ -1837,10 +1847,12 @@ function readCaptureReaderArguments(argv, root, defaults, command = "sheets") {
|
|
|
1837
1847
|
const portfolio = values.portfolio;
|
|
1838
1848
|
const checks = values.checks;
|
|
1839
1849
|
const output = "output" in values && typeof values.output === "string" ? values.output : void 0;
|
|
1850
|
+
const mode = values.mode;
|
|
1840
1851
|
return {
|
|
1841
1852
|
reader: {
|
|
1842
1853
|
root: resolve(root),
|
|
1843
1854
|
config: resolve(root, values.config ?? defaults.config),
|
|
1855
|
+
...mode === void 0 ? {} : { mode },
|
|
1844
1856
|
journeys: resolve(root, values.journeys ?? defaults.journeys),
|
|
1845
1857
|
selection: {
|
|
1846
1858
|
selector,
|
|
@@ -2002,8 +2014,8 @@ function readCaptureRunning(pid) {
|
|
|
2002
2014
|
* Resolves one entry of a wrapper's project list to the project it declares.
|
|
2003
2015
|
*
|
|
2004
2016
|
* @remarks
|
|
2005
|
-
* A factory entry is called with the serve command and the
|
|
2006
|
-
* promise is awaited. The result is the project as plain data
|
|
2017
|
+
* A factory entry is called with the serve command and the requested mode, or the default test
|
|
2018
|
+
* mode, as Vitest calls it, and a promise is awaited. The result is the project as plain data: the runner reads
|
|
2007
2019
|
* and validates it, so one reader owns every refusal.
|
|
2008
2020
|
*
|
|
2009
2021
|
* @param input - The entry as the wrapper declared it: an inline project, a promise of one, or a factory
|
|
@@ -2014,10 +2026,10 @@ function readCaptureRunning(pid) {
|
|
|
2014
2026
|
* const project = await resolveCaptureWrapperProject(wrapper.test.projects[0])
|
|
2015
2027
|
* ```
|
|
2016
2028
|
*/
|
|
2017
|
-
async function resolveCaptureWrapperProject(input) {
|
|
2029
|
+
async function resolveCaptureWrapperProject(input, mode = "test") {
|
|
2018
2030
|
return isFunction(input) ? await input({
|
|
2019
2031
|
command: "serve",
|
|
2020
|
-
mode
|
|
2032
|
+
mode
|
|
2021
2033
|
}) : await input;
|
|
2022
2034
|
}
|
|
2023
2035
|
/**
|
|
@@ -2180,13 +2192,15 @@ async function answerCaptureDiscovery(options) {
|
|
|
2180
2192
|
if (parsed.version !== CAPTURE_VERSION) throw new CaptureError("Discovery request has invalid version", { code: "HOST" });
|
|
2181
2193
|
if (!isCaptureSegment(parsed.id) || !isCaptureSegment(parsed.nonce)) throw new CaptureError("Discovery request has invalid identity", { code: "HOST" });
|
|
2182
2194
|
if (parsed.config !== options.config) throw new CaptureError("Discovery request has invalid config", { code: "HOST" });
|
|
2195
|
+
if (parsed.mode !== void 0 && (typeof parsed.mode !== "string" || parsed.mode.trim() === "")) throw new CaptureError("Discovery request has invalid mode", { code: "HOST" });
|
|
2183
2196
|
const answer = resolve(directory, CAPTURE_RUNS_DIRECTORY, parsed.id, CAPTURE_DISCOVERY.description);
|
|
2184
2197
|
const prior = existsSync(answer) ? parseJSON(readFileSync(answer, "utf8")) : void 0;
|
|
2185
2198
|
if (prior !== void 0 && !(isRecord(prior) && prior.pid === process.pid)) throw new CaptureError(`Discovery was already answered for this request: ${file}`, {
|
|
2186
2199
|
code: "HOST",
|
|
2187
2200
|
context: { file }
|
|
2188
2201
|
});
|
|
2189
|
-
const
|
|
2202
|
+
const mode = typeof parsed.mode === "string" ? parsed.mode : void 0;
|
|
2203
|
+
const projects = await Promise.all(options.projects.map((input) => resolveCaptureWrapperProject(input, mode)));
|
|
2190
2204
|
writeCaptureDocument(answer, {
|
|
2191
2205
|
version: CAPTURE_VERSION,
|
|
2192
2206
|
id: parsed.id,
|
|
@@ -2346,7 +2360,7 @@ var CaptureDiscovery = class {
|
|
|
2346
2360
|
...CAPTURE_DISCOVERY.arguments,
|
|
2347
2361
|
"--config",
|
|
2348
2362
|
resolve(root, config),
|
|
2349
|
-
...mode === void 0 ? [] : ["--mode", mode],
|
|
2363
|
+
...mode === void 0 ? [] : mode.startsWith("-") ? [`--mode=${mode}`] : ["--mode", mode],
|
|
2350
2364
|
"--configLoader",
|
|
2351
2365
|
"runner"
|
|
2352
2366
|
];
|
|
@@ -2356,6 +2370,7 @@ var CaptureDiscovery = class {
|
|
|
2356
2370
|
id: invocation.id,
|
|
2357
2371
|
nonce,
|
|
2358
2372
|
config: relative,
|
|
2373
|
+
...mode === void 0 ? {} : { mode },
|
|
2359
2374
|
pid: process.pid,
|
|
2360
2375
|
args
|
|
2361
2376
|
};
|
|
@@ -3908,7 +3923,7 @@ var CapturePreflight = class {
|
|
|
3908
3923
|
}
|
|
3909
3924
|
}
|
|
3910
3925
|
async #load(config, invocation) {
|
|
3911
|
-
const { root, deadline } = this.#options;
|
|
3926
|
+
const { root, deadline, mode } = this.#options;
|
|
3912
3927
|
invocation.prepare();
|
|
3913
3928
|
requireCaptureArgument(root, resolve(root, this.#options.journeys), "--journeys");
|
|
3914
3929
|
if (this.#options.checks !== void 0) requireCaptureArgument(root, resolve(root, this.#options.checks), "--checks");
|
|
@@ -3916,6 +3931,7 @@ var CapturePreflight = class {
|
|
|
3916
3931
|
root,
|
|
3917
3932
|
config,
|
|
3918
3933
|
invocation,
|
|
3934
|
+
...mode === void 0 ? {} : { mode },
|
|
3919
3935
|
...deadline === void 0 ? {} : { deadline }
|
|
3920
3936
|
}).describe()).projects.map(({ project, viewport }) => {
|
|
3921
3937
|
if (viewport === void 0) throw new CaptureError("A reader project declares no viewport geometry", { code: "HOST" });
|
|
@@ -4228,6 +4244,7 @@ var CaptureRegistrar = class {
|
|
|
4228
4244
|
config: resolveCaptureRelative(root, parsed.config),
|
|
4229
4245
|
pid: process.pid,
|
|
4230
4246
|
command: "journey",
|
|
4247
|
+
...parsed.mode === void 0 ? {} : { mode: parsed.mode },
|
|
4231
4248
|
selector: "all",
|
|
4232
4249
|
variants: [variant],
|
|
4233
4250
|
args
|
|
@@ -4380,6 +4397,7 @@ var CaptureRunner = class {
|
|
|
4380
4397
|
root,
|
|
4381
4398
|
config: parsed.config,
|
|
4382
4399
|
invocation,
|
|
4400
|
+
...parsed.mode === void 0 ? {} : { mode: parsed.mode },
|
|
4383
4401
|
...this.#options.deadline === void 0 ? {} : { deadline: this.#options.deadline }
|
|
4384
4402
|
}).describe()).projects.map((entry) => entry.project);
|
|
4385
4403
|
if (parsed.selector !== void 0) requireCaptureSelection(parsed.selector, [], projects, [], parsed.portfolio);
|
|
@@ -4421,7 +4439,8 @@ var CaptureRunner = class {
|
|
|
4421
4439
|
const shared = plan.changes.filter((change) => change.classification === "shared");
|
|
4422
4440
|
const complete = renderCaptureCommand("journey", {
|
|
4423
4441
|
config: parsed.config,
|
|
4424
|
-
variants: parsed.variants
|
|
4442
|
+
variants: parsed.variants,
|
|
4443
|
+
...parsed.mode === void 0 ? {} : { mode: parsed.mode }
|
|
4425
4444
|
}, "all", root);
|
|
4426
4445
|
for (const next of commands) this.#stdout(`COMMAND ${next}\n`);
|
|
4427
4446
|
const variants = resolveCaptureVariants(parsed.variants, projects);
|
|
@@ -4555,7 +4574,8 @@ var CaptureRunner = class {
|
|
|
4555
4574
|
...parsed.state === void 0 ? {} : { state: parsed.state },
|
|
4556
4575
|
final: primary.final,
|
|
4557
4576
|
directory: resolveCaptureRelative(root, primary.directory),
|
|
4558
|
-
config: resolveCaptureRelative(root, parsed.config)
|
|
4577
|
+
config: resolveCaptureRelative(root, parsed.config),
|
|
4578
|
+
...parsed.mode === void 0 ? {} : { mode: parsed.mode }
|
|
4559
4579
|
};
|
|
4560
4580
|
const outcomes = [];
|
|
4561
4581
|
const stages = resolveCaptureStages(variants, primary.first, command);
|
|
@@ -4599,6 +4619,7 @@ var CaptureRunner = class {
|
|
|
4599
4619
|
report,
|
|
4600
4620
|
projects: selected.map((project) => project.name),
|
|
4601
4621
|
filter: plan.filter,
|
|
4622
|
+
...plan.mode === void 0 ? {} : { mode: plan.mode },
|
|
4602
4623
|
...plan.case === void 0 ? {} : { case: plan.case },
|
|
4603
4624
|
...plan.case === void 0 ? {} : { titles: readCaptureTitles(root, resolve(root, plan.directory, CAPTURE_REGISTRY_FILE)) },
|
|
4604
4625
|
final: plan.final
|
|
@@ -4610,6 +4631,7 @@ var CaptureRunner = class {
|
|
|
4610
4631
|
config: plan.config,
|
|
4611
4632
|
pid: process.pid,
|
|
4612
4633
|
command: plan.command,
|
|
4634
|
+
...plan.mode === void 0 ? {} : { mode: plan.mode },
|
|
4613
4635
|
selector: plan.selector,
|
|
4614
4636
|
...plan.case === void 0 ? {} : { case: plan.case },
|
|
4615
4637
|
...plan.state === void 0 ? {} : { state: plan.state },
|