@testsprite/testsprite-cli 0.3.0 → 0.5.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/README.md +55 -29
- package/dist/commands/agent.js +17 -6
- package/dist/commands/auth.d.ts +51 -0
- package/dist/commands/auth.js +46 -2
- package/dist/commands/completion.d.ts +36 -0
- package/dist/commands/completion.js +111 -0
- package/dist/commands/doctor.js +56 -16
- package/dist/commands/init.d.ts +32 -1
- package/dist/commands/init.js +40 -10
- package/dist/commands/project.d.ts +102 -4
- package/dist/commands/project.js +250 -47
- package/dist/commands/test.d.ts +253 -11
- package/dist/commands/test.js +1822 -390
- package/dist/commands/usage.d.ts +56 -17
- package/dist/commands/usage.js +144 -29
- package/dist/index.js +172 -29
- package/dist/lib/browser.d.ts +6 -0
- package/dist/lib/browser.js +54 -0
- package/dist/lib/bundle.d.ts +32 -31
- package/dist/lib/bundle.js +144 -84
- package/dist/lib/client-factory.d.ts +29 -0
- package/dist/lib/client-factory.js +49 -1
- package/dist/lib/config.js +7 -3
- package/dist/lib/credentials.d.ts +17 -1
- package/dist/lib/credentials.js +175 -16
- package/dist/lib/dry-run/samples.js +51 -1
- package/dist/lib/errors.d.ts +33 -1
- package/dist/lib/errors.js +110 -19
- package/dist/lib/failing-fe-resolver.d.ts +15 -0
- package/dist/lib/failing-fe-resolver.js +49 -1
- package/dist/lib/flaky.d.ts +12 -1
- package/dist/lib/flaky.js +7 -12
- package/dist/lib/gh-output.d.ts +62 -0
- package/dist/lib/gh-output.js +99 -0
- package/dist/lib/http.d.ts +86 -16
- package/dist/lib/http.js +181 -11
- package/dist/lib/interrupt.d.ts +65 -10
- package/dist/lib/interrupt.js +94 -9
- package/dist/lib/org-render.d.ts +52 -0
- package/dist/lib/org-render.js +59 -0
- package/dist/lib/poll.d.ts +11 -0
- package/dist/lib/poll.js +71 -6
- package/dist/lib/render-error.d.ts +14 -0
- package/dist/lib/render-error.js +30 -0
- package/dist/lib/response-schemas.d.ts +83 -0
- package/dist/lib/response-schemas.js +272 -0
- package/dist/lib/runs.types.d.ts +62 -8
- package/dist/lib/skill-nudge.d.ts +17 -0
- package/dist/lib/skill-nudge.js +19 -0
- package/dist/lib/telemetry.d.ts +90 -0
- package/dist/lib/telemetry.js +171 -0
- package/dist/lib/text-table.d.ts +14 -0
- package/dist/lib/text-table.js +45 -0
- package/dist/lib/v3-advisory.d.ts +22 -0
- package/dist/lib/v3-advisory.js +32 -0
- package/dist/lib/version-notice.d.ts +37 -0
- package/dist/lib/version-notice.js +87 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +16 -5
- package/schemas/plan.schema.json +61 -0
- package/skills/testsprite-verify.codex.md +8 -2
- package/skills/testsprite-verify.skill.md +18 -7
package/dist/commands/test.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ import { type CommonOptions as FactoryCommonOptions } from '../lib/client-factor
|
|
|
3
3
|
import { type WriteBundleResult } from '../lib/bundle.js';
|
|
4
4
|
import { type JUnitReportFormat } from '../lib/junit-report.js';
|
|
5
5
|
import { ApiError } from '../lib/errors.js';
|
|
6
|
+
import { type ShutdownHandle } from '../lib/interrupt.js';
|
|
6
7
|
import type { FetchImpl } from '../lib/http.js';
|
|
7
8
|
import { type Page } from '../lib/pagination.js';
|
|
8
|
-
import type { RunResponse, TriggerRunResponse, RerunResponse, BatchRerunResponse, ListRunsResponse, RunSource, BatchRunFreshResponse } from '../lib/runs.types.js';
|
|
9
|
+
import type { RunResponse, TriggerRunResponse, RerunResponse, BatchRerunResponse, ListRunsResponse, RunSource, BatchRunFreshResponse, CancelRunResponse } from '../lib/runs.types.js';
|
|
9
10
|
import { type FlakyReport } from '../lib/flaky.js';
|
|
10
11
|
/**
|
|
11
12
|
* `details` debug block per the CLI OpenAPI `Test` schema
|
|
@@ -68,6 +69,14 @@ export interface CliTest {
|
|
|
68
69
|
* no priority has been set. Text mode surfaces it only when truthy.
|
|
69
70
|
*/
|
|
70
71
|
priority?: string | null;
|
|
72
|
+
/**
|
|
73
|
+
* Backend-only dependency declarations that drive wave ordering.
|
|
74
|
+
* Optional on the wire so older facades that don't ship them still
|
|
75
|
+
* type-check; text mode surfaces them only when present/non-empty.
|
|
76
|
+
*/
|
|
77
|
+
produces?: string[] | null;
|
|
78
|
+
consumes?: string[] | null;
|
|
79
|
+
category?: string | null;
|
|
71
80
|
}
|
|
72
81
|
export type CliPublicStatus = 'draft' | 'ready' | 'queued' | 'running' | 'passed' | 'failed' | 'blocked' | 'cancelled' | 'unknown';
|
|
73
82
|
/**
|
|
@@ -174,6 +183,18 @@ export interface CliLatestResult {
|
|
|
174
183
|
* former `{passed,failed,skipped}` count object).
|
|
175
184
|
*/
|
|
176
185
|
summary: string;
|
|
186
|
+
/**
|
|
187
|
+
* Captured stdout (`api_output`) from a backend-test execution.
|
|
188
|
+
* Present (possibly null) only for backend tests; omitted for FE/MCP and on
|
|
189
|
+
* older backends that omit them. Capped at 50 KB UTF-8 by the server.
|
|
190
|
+
*/
|
|
191
|
+
apiOutput?: string | null;
|
|
192
|
+
/**
|
|
193
|
+
* Python traceback from a backend-test execution (ends with the
|
|
194
|
+
* `ExceptionType: message` line). Present (possibly null) only for backend
|
|
195
|
+
* tests; omitted for FE/MCP and on older backends.
|
|
196
|
+
*/
|
|
197
|
+
trace?: string | null;
|
|
177
198
|
/**
|
|
178
199
|
* §6.5.1 (M2.1 piece 3) — inline failure analysis. Present when the
|
|
179
200
|
* caller passed `--include-analysis` (`?includeAnalysis=true` on
|
|
@@ -258,6 +279,14 @@ export interface CliFailureBlock {
|
|
|
258
279
|
*/
|
|
259
280
|
recommendedFixTarget: CliFixTarget | null;
|
|
260
281
|
evidence: CliEvidence[];
|
|
282
|
+
/**
|
|
283
|
+
* Backend-test execution artifacts, surfaced on the failure block
|
|
284
|
+
* so triage has stdout + traceback next to the hypothesis (mirrors
|
|
285
|
+
* `result.apiOutput` / `result.trace`). Present (possibly null) only for
|
|
286
|
+
* backend failures; omitted for FE and on older backends.
|
|
287
|
+
*/
|
|
288
|
+
apiOutput?: string | null;
|
|
289
|
+
trace?: string | null;
|
|
261
290
|
}
|
|
262
291
|
/** §6.7 wire shape — one atomic snapshot of the latest failing run. */
|
|
263
292
|
export interface CliFailureContext {
|
|
@@ -287,10 +316,17 @@ export interface TestDeps {
|
|
|
287
316
|
* no-op in tests to avoid real delays.
|
|
288
317
|
*/
|
|
289
318
|
sleep?: (ms: number) => Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Graceful-detach coordinator for the `--wait` paths (DEV-331 piece 1).
|
|
321
|
+
* Defaults to the process-wide `globalShutdown`; tests inject their own
|
|
322
|
+
* controller and abort it to simulate Ctrl-C deterministically (same
|
|
323
|
+
* pattern as `sleep` / `fetchImpl`).
|
|
324
|
+
*/
|
|
325
|
+
shutdown?: ShutdownHandle;
|
|
290
326
|
}
|
|
291
327
|
type CommonOptions = FactoryCommonOptions;
|
|
292
328
|
interface ListOptions extends CommonOptions {
|
|
293
|
-
projectId
|
|
329
|
+
projectId?: string;
|
|
294
330
|
type?: 'frontend' | 'backend';
|
|
295
331
|
createdFrom?: 'portal' | 'mcp' | 'cli';
|
|
296
332
|
/**
|
|
@@ -303,6 +339,8 @@ interface ListOptions extends CommonOptions {
|
|
|
303
339
|
pageSize?: number;
|
|
304
340
|
startingToken?: string;
|
|
305
341
|
maxItems?: number;
|
|
342
|
+
columns?: string;
|
|
343
|
+
noHeader?: boolean;
|
|
306
344
|
}
|
|
307
345
|
export declare function runList(opts: ListOptions, deps?: TestDeps): Promise<Page<CliTest>>;
|
|
308
346
|
/**
|
|
@@ -325,7 +363,7 @@ export interface CliCreateTestResponse {
|
|
|
325
363
|
export declare const CLI_CREATE_PRIORITIES: readonly ["p0", "p1", "p2", "p3"];
|
|
326
364
|
export type CliCreatePriority = (typeof CLI_CREATE_PRIORITIES)[number];
|
|
327
365
|
interface CreateOptions extends CommonOptions {
|
|
328
|
-
projectId
|
|
366
|
+
projectId?: string;
|
|
329
367
|
type: 'frontend' | 'backend';
|
|
330
368
|
name: string;
|
|
331
369
|
description?: string;
|
|
@@ -457,6 +495,12 @@ interface UpdateOptions extends CommonOptions {
|
|
|
457
495
|
description?: string;
|
|
458
496
|
/** Optional new priority. Enum-validated CLI-side. */
|
|
459
497
|
priority?: CliCreatePriority;
|
|
498
|
+
/** Backend-only: variable names this test produces (repeatable --produces). */
|
|
499
|
+
produces?: string[];
|
|
500
|
+
/** Backend-only: variable names this test consumes (repeatable --needs); wire field `consumes`. */
|
|
501
|
+
needs?: string[];
|
|
502
|
+
/** Backend-only: free-text wave category (--category). */
|
|
503
|
+
category?: string;
|
|
460
504
|
/** Caller-supplied idempotency token; UUIDv4 minted client-side if absent. */
|
|
461
505
|
idempotencyKey?: string;
|
|
462
506
|
}
|
|
@@ -602,6 +646,64 @@ export interface CliPlanInput {
|
|
|
602
646
|
export interface CliCreateFromPlanResponse extends CliCreateTestResponse {
|
|
603
647
|
planSteps?: CliPlanStep[];
|
|
604
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Public raw-content URL for
|
|
651
|
+
* `schemas/plan.schema.json`, shipped in both the npm package (see
|
|
652
|
+
* `package.json` `files`) and the repo. Points at the PUBLIC mirror
|
|
653
|
+
* (`TestSprite/testsprite-cli`) since that's what ships to npm consumers;
|
|
654
|
+
* the private atlas repo syncs to it via `scripts/make-public-snapshot.sh`.
|
|
655
|
+
*
|
|
656
|
+
* Pinned to the running CLI's own `v<VERSION>` git tag (the same `VERSION`
|
|
657
|
+
* constant `--version` / `doctor` / the update-check registry probe already
|
|
658
|
+
* read from `src/version.ts`) rather than the mutable `main` branch — a plan
|
|
659
|
+
* file authored against one CLI version should resolve the SAME schema
|
|
660
|
+
* forever, not whatever `main` happens to contain when the file is opened
|
|
661
|
+
* months later (`main` can gain new required fields between versions).
|
|
662
|
+
*
|
|
663
|
+
* This is deliberately DIFFERENT from `schemas/plan.schema.json`'s own
|
|
664
|
+
* internal `$id`, which stays the canonical `main` URL — `$id` is a schema
|
|
665
|
+
* IDENTITY (what this document calls itself, used for cross-referencing),
|
|
666
|
+
* not a fetch instruction, so it is intentionally version-independent.
|
|
667
|
+
* `PLAN_SCHEMA_URL` is the fetch instruction embedded in generated plan
|
|
668
|
+
* files and is intentionally version-PINNED. See DOCUMENTATION.md's "Plan
|
|
669
|
+
* file format" section for the same distinction spelled out for humans.
|
|
670
|
+
*
|
|
671
|
+
* Caveat: the pinned tag only resolves once that version is actually
|
|
672
|
+
* released — a locally-built/pre-release checkout may see a 404 until then.
|
|
673
|
+
*/
|
|
674
|
+
export declare const PLAN_SCHEMA_URL = "https://raw.githubusercontent.com/TestSprite/testsprite-cli/v0.5.0/schemas/plan.schema.json";
|
|
675
|
+
/**
|
|
676
|
+
* The SINGLE canonical example plan. This
|
|
677
|
+
* exact value (via `PLAN_TEMPLATE_TEXT` below) is:
|
|
678
|
+
* - printed to stdout by `test create --plan-template`
|
|
679
|
+
* - embedded verbatim in `test create --help` (`PLAN_TEMPLATE_HELP_TEXT`)
|
|
680
|
+
* - asserted in tests against `schemas/plan.schema.json` and against
|
|
681
|
+
* `assertPlanShape` so the three surfaces can't drift
|
|
682
|
+
*
|
|
683
|
+
* Deliberately minimal (no optional `description`/`priority`) — this is
|
|
684
|
+
* the smallest shape `assertPlanShape` accepts, not a fully-annotated
|
|
685
|
+
* showcase (that lives in `skills/testsprite-verify.skill.md`).
|
|
686
|
+
*/
|
|
687
|
+
export declare const PLAN_TEMPLATE: CliPlanInput;
|
|
688
|
+
/** `CliPlanInput` plus the optional editor-discoverability hint. */
|
|
689
|
+
export interface PlanFileTemplate extends CliPlanInput {
|
|
690
|
+
$schema: string;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* `$schema` is an ordinary extra property from `assertPlanShape`'s point of
|
|
694
|
+
* view (no `additionalProperties` check exists on the plan-from path) — it
|
|
695
|
+
* validates exactly like a bare `CliPlanInput` while giving editors (VS
|
|
696
|
+
* Code's JSON language service, and by extension Copilot inline
|
|
697
|
+
* completions) something to resolve for live validation as the file is
|
|
698
|
+
* edited.
|
|
699
|
+
*/
|
|
700
|
+
export declare const PLAN_TEMPLATE_WITH_SCHEMA: PlanFileTemplate;
|
|
701
|
+
/**
|
|
702
|
+
* Rendered once from the object above (never hand-formatted separately) so
|
|
703
|
+
* `test create --plan-template`'s stdout and `test create --help`'s example
|
|
704
|
+
* are generated from — not merely modeled on — the same source.
|
|
705
|
+
*/
|
|
706
|
+
export declare const PLAN_TEMPLATE_TEXT: string;
|
|
605
707
|
/** Per-spec result from `POST /tests/batch`. */
|
|
606
708
|
export interface CliBatchSpecResult {
|
|
607
709
|
/** Position of the spec in the input JSONL, preserved across the response. */
|
|
@@ -681,6 +783,39 @@ export declare const BATCH_RUN_RATE_LIMIT = 50;
|
|
|
681
783
|
export declare const BATCH_RUN_RATE_WINDOW_MS = 60000;
|
|
682
784
|
/** Maximum number of outer RATE_LIMITED retries inside the batch fan-out (beyond HTTP-layer retries). */
|
|
683
785
|
export declare const BATCH_RUN_RATE_MAX_OUTER_RETRIES = 5;
|
|
786
|
+
/**
|
|
787
|
+
* Maximum number of outer RATE_LIMITED retries per member inside the multi-id
|
|
788
|
+
* `test wait` fan-out (beyond HTTP-layer retries). Lower than the trigger
|
|
789
|
+
* fan-out's budget on purpose: a throttled *poll* costs nothing but latency and
|
|
790
|
+
* the run is already executing, so a couple of Retry-After-length backoffs is
|
|
791
|
+
* enough to ride out one limiter window — burning the whole `--timeout` on
|
|
792
|
+
* backoff instead of reporting the throttle would be worse than reporting it.
|
|
793
|
+
*/
|
|
794
|
+
export declare const WAIT_POLL_RATE_MAX_OUTER_RETRIES = 3;
|
|
795
|
+
/**
|
|
796
|
+
* Backoff to honour before retrying a `RATE_LIMITED` response, in ms.
|
|
797
|
+
*
|
|
798
|
+
* Precedence: `ApiError.retryAfterMs` (set by `HttpClient` from the HTTP
|
|
799
|
+
* `Retry-After` header, already clamped to [1s, 300s]) → `details.retryAfterSeconds`
|
|
800
|
+
* from the envelope body, capped at 120s → 60s. Callers clamp the result to their
|
|
801
|
+
* own remaining deadline; this function only decides "how long does the server
|
|
802
|
+
* want us to wait."
|
|
803
|
+
*
|
|
804
|
+
* Shared by the `test run --all` trigger fan-out and the multi-id `test wait`
|
|
805
|
+
* poll fan-out so the two can't drift — they were hand-copies of the same
|
|
806
|
+
* precedence rule.
|
|
807
|
+
*/
|
|
808
|
+
/**
|
|
809
|
+
* Sleep that a termination signal cuts short by rejecting with the signal's
|
|
810
|
+
* `InterruptError`, so the caller's existing DEV-331 catch owns the detach UX.
|
|
811
|
+
*
|
|
812
|
+
* Mirrors `HttpClient.sleepBeforeRetry` — an in-flight backoff must not be a
|
|
813
|
+
* window where a first Ctrl-C hard-exits with empty stdout. The caller is
|
|
814
|
+
* responsible for having ARMED the shutdown scope; a disarmed controller never
|
|
815
|
+
* aborts its signal, so this would otherwise sleep straight through the signal.
|
|
816
|
+
*/
|
|
817
|
+
export declare function sleepUntilOrInterrupt(ms: number, signal: AbortSignal | undefined, sleep: (ms: number) => Promise<void>): Promise<void>;
|
|
818
|
+
export declare function resolveRateLimitRetryMs(err: ApiError): number;
|
|
684
819
|
/**
|
|
685
820
|
* D3: max automatic retry attempts for deferred tests under `--wait`.
|
|
686
821
|
* Each attempt is preceded by a Retry-After-aware sleep (server value if
|
|
@@ -1005,7 +1140,10 @@ export interface CliRunDiff {
|
|
|
1005
1140
|
* green run?"). Pure client-side composition of the existing per-run read
|
|
1006
1141
|
* (`GET /runs/{id}?includeSteps=true`); the endpoint accepts any two run-ids,
|
|
1007
1142
|
* so a cross-test pair is a WARNING, not an error. Exit 0 when the verdicts
|
|
1008
|
-
* match, exit 1 when they differ, so the command is CI-scriptable
|
|
1143
|
+
* match, exit 1 when they differ, so the command is CI-scriptable —
|
|
1144
|
+
* `--dry-run` honors the same contract: the canned sample has a
|
|
1145
|
+
* changed verdict, so `test diff --dry-run` (with no overrides) exits 1,
|
|
1146
|
+
* same as a real regressed pair would.
|
|
1009
1147
|
*/
|
|
1010
1148
|
export declare function runDiff(opts: DiffOptions, deps?: TestDeps): Promise<CliRunDiff>;
|
|
1011
1149
|
export interface LintOptions extends CommonOptions {
|
|
@@ -1032,6 +1170,15 @@ export interface CliLintReport {
|
|
|
1032
1170
|
* so authoring a 12-plan directory meant one error per paid round-trip. Zero
|
|
1033
1171
|
* network, zero credentials: exit 0 when everything is valid, 5 otherwise, so
|
|
1034
1172
|
* it drops into a pre-commit hook or CI step before `create-batch`.
|
|
1173
|
+
*
|
|
1174
|
+
* The collection granularity used to be per-FILE, not per-PROBLEM — a single
|
|
1175
|
+
* plan with 6 independent field errors reported one at a time across 6
|
|
1176
|
+
* fix-and-rerun cycles, because each file was validated through the
|
|
1177
|
+
* throw-on-first `assertPlanShape`/`assertPlanStepsShape`. Every branch below
|
|
1178
|
+
* now separates "parse the file" (still a single fatal issue on I/O/JSON
|
|
1179
|
+
* failure — there's nothing left to validate) from "check the parsed shape"
|
|
1180
|
+
* (routed through `collectPlanIssues` / `collectPlanStepsIssues`, which
|
|
1181
|
+
* report every failing field in one pass).
|
|
1035
1182
|
*/
|
|
1036
1183
|
export declare function runLint(opts: LintOptions, deps?: TestDeps): Promise<CliLintReport>;
|
|
1037
1184
|
export interface ScaffoldOptions extends CommonOptions {
|
|
@@ -1057,6 +1204,38 @@ export interface CliBackendScaffold {
|
|
|
1057
1204
|
* would pass without asserting anything).
|
|
1058
1205
|
*/
|
|
1059
1206
|
export declare function runScaffold(opts: ScaffoldOptions, deps?: TestDeps): Promise<CliPlanInput | CliBackendScaffold>;
|
|
1207
|
+
/**
|
|
1208
|
+
* `test create --plan-template` — prints the canonical minimal
|
|
1209
|
+
* valid plan file (`PLAN_TEMPLATE_WITH_SCHEMA` / `PLAN_TEMPLATE_TEXT`,
|
|
1210
|
+
* defined above near `CliPlanInput`) to stdout and exits — before any of
|
|
1211
|
+
* `test create`'s other flag handling runs. Pure-local: no network, no
|
|
1212
|
+
* credentials, no filesystem I/O.
|
|
1213
|
+
*
|
|
1214
|
+
* Deliberately simpler than `test scaffold --type frontend` (which
|
|
1215
|
+
* substitutes a live `TESTSPRITE_PROJECT_ID` when set, and supports
|
|
1216
|
+
* `--out`): `--plan-template`'s job is a single deterministic ground-truth
|
|
1217
|
+
* document that is BYTE-IDENTICAL every invocation, because it doubles as
|
|
1218
|
+
* the literal example embedded in `test create --help` and the
|
|
1219
|
+
* fixture asserted against `schemas/plan.schema.json` in tests.
|
|
1220
|
+
*/
|
|
1221
|
+
export declare function runPlanTemplate(opts: CommonOptions, deps?: TestDeps): PlanFileTemplate;
|
|
1222
|
+
export interface OpenOptions extends CommonOptions {
|
|
1223
|
+
testId: string;
|
|
1224
|
+
/** Print the URL only; never spawn a browser (SSH/headless/CI/agents). */
|
|
1225
|
+
noBrowser: boolean;
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* `test open <test-id>` (issue #121): jump from the terminal to the test's
|
|
1229
|
+
* dashboard page. The CLI already computes this deep-link and prints it as
|
|
1230
|
+
* text on other commands; this closes the last inch (the `gh browse` /
|
|
1231
|
+
* `cypress open` hop). The URL is ALWAYS printed to stdout (so `--no-browser`
|
|
1232
|
+
* and headless use still compose), then the OS browser is spawned unless
|
|
1233
|
+
* --no-browser. An endpoint with no known portal mapping is a hard error
|
|
1234
|
+
* rather than a silent no-op.
|
|
1235
|
+
*/
|
|
1236
|
+
export declare function runOpen(opts: OpenOptions, deps?: TestDeps, opener?: (url: string) => void): Promise<{
|
|
1237
|
+
dashboardUrl: string;
|
|
1238
|
+
}>;
|
|
1060
1239
|
export declare function runSteps(opts: StepsOptions, deps?: TestDeps): Promise<Page<CliTestStep>>;
|
|
1061
1240
|
interface ResultOptions extends CommonOptions {
|
|
1062
1241
|
testId: string;
|
|
@@ -1096,6 +1275,13 @@ interface ResultHistoryOptions extends CommonOptions {
|
|
|
1096
1275
|
pageSize?: number;
|
|
1097
1276
|
/** Opaque cursor from a prior page's `nextCursor`. */
|
|
1098
1277
|
cursor?: string;
|
|
1278
|
+
/**
|
|
1279
|
+
* Client-side rerun filter. `true` → only reruns (isRerun), `false` → only
|
|
1280
|
+
* fresh runs, `undefined` → no filter. Applied to each page after the fetch.
|
|
1281
|
+
*/
|
|
1282
|
+
rerun?: boolean;
|
|
1283
|
+
columns?: string;
|
|
1284
|
+
noHeader?: boolean;
|
|
1099
1285
|
}
|
|
1100
1286
|
/**
|
|
1101
1287
|
* `test result <test-id> --history [options]`
|
|
@@ -1312,6 +1498,56 @@ export declare function runTestWaitMany(opts: RunTestWaitManyOptions, deps?: Tes
|
|
|
1312
1498
|
results: CliMultiWaitResult[];
|
|
1313
1499
|
summary: Record<string, number>;
|
|
1314
1500
|
}>;
|
|
1501
|
+
export interface RunTestCancelOptions extends CommonOptions {
|
|
1502
|
+
runIds: string[];
|
|
1503
|
+
}
|
|
1504
|
+
/** One run's outcome in a multi-id `test cancel` summary. */
|
|
1505
|
+
export interface CliCancelResultRow {
|
|
1506
|
+
runId: string;
|
|
1507
|
+
status: 'cancelled' | 'alreadyCancelled' | 'conflict' | 'notFound' | 'error';
|
|
1508
|
+
/** Terminal status the run was already in, for a `conflict` row. */
|
|
1509
|
+
conflictStatus?: string;
|
|
1510
|
+
error?: string;
|
|
1511
|
+
}
|
|
1512
|
+
/** JSON payload for a multi-id `test cancel` — per piece-3 CXL-11. */
|
|
1513
|
+
export interface CliCancelSummary {
|
|
1514
|
+
cancelled: string[];
|
|
1515
|
+
alreadyCancelled: string[];
|
|
1516
|
+
conflicts: Array<{
|
|
1517
|
+
runId: string;
|
|
1518
|
+
status: string;
|
|
1519
|
+
}>;
|
|
1520
|
+
notFound: string[];
|
|
1521
|
+
/**
|
|
1522
|
+
* Runs that errored for a reason other than 404/409 (e.g. auth, transport).
|
|
1523
|
+
* Always present — an empty array on full success — so machine consumers
|
|
1524
|
+
* can rely on a stable shape (DEV-331 codex finding 2).
|
|
1525
|
+
*/
|
|
1526
|
+
errors: Array<{
|
|
1527
|
+
runId: string;
|
|
1528
|
+
message: string;
|
|
1529
|
+
}>;
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* `test cancel <run-id...>` — DEV-331 piece 3.
|
|
1533
|
+
*
|
|
1534
|
+
* User-initiated cancel of one or more queued/running runs via
|
|
1535
|
+
* `POST /api/cli/v1/runs/{runId}/cancel`. Naturally idempotent (D10): a
|
|
1536
|
+
* repeat cancel of the same run is a 200 `alreadyCancelled` success, not an
|
|
1537
|
+
* error. Dispatches serially (per-id volume is tiny — no batch endpoint,
|
|
1538
|
+
* D8 "Batch-level cancel endpoint... YAGNI").
|
|
1539
|
+
*
|
|
1540
|
+
* Single id: renders the returned run card (`status cancelled`); an
|
|
1541
|
+
* `alreadyCancelled` response adds an `[advisory]` line. Exit code mirrors
|
|
1542
|
+
* the server response directly — 0 on success (fresh or already-cancelled),
|
|
1543
|
+
* 4 on 404 (unknown/cross-tenant), 6 on 409 (already terminal).
|
|
1544
|
+
*
|
|
1545
|
+
* Multi-id: prints a `{cancelled, alreadyCancelled, conflicts, notFound}`
|
|
1546
|
+
* summary. Exit precedence (CXL-11): any `notFound` → 4 (outranks conflict —
|
|
1547
|
+
* it signals a caller bug, wrong id/tenant); else any `conflicts` → 6; else 0.
|
|
1548
|
+
*/
|
|
1549
|
+
export declare function runTestCancel(opts: RunTestCancelOptions, deps?: TestDeps): Promise<CancelRunResponse | CliCancelSummary>;
|
|
1550
|
+
export declare function createTestCancelCommand(deps: TestDeps): Command;
|
|
1315
1551
|
/**
|
|
1316
1552
|
* `test wait <run-id>` — M3.3 piece-3.
|
|
1317
1553
|
*
|
|
@@ -1320,8 +1556,8 @@ export declare function runTestWaitMany(opts: RunTestWaitManyOptions, deps?: Tes
|
|
|
1320
1556
|
*/
|
|
1321
1557
|
export declare function runTestWait(opts: RunTestWaitOptions, deps?: TestDeps): Promise<RunResponse>;
|
|
1322
1558
|
interface RunTestRunAllOptions extends CommonOptions {
|
|
1323
|
-
/** projectId to run all tests in. */
|
|
1324
|
-
projectId
|
|
1559
|
+
/** projectId to run all tests in; may be resolved from --project or TESTSPRITE_PROJECT_ID. */
|
|
1560
|
+
projectId?: string;
|
|
1325
1561
|
/** --filter <substr>: only run tests whose name contains this substring (case-insensitive). */
|
|
1326
1562
|
nameFilter?: string;
|
|
1327
1563
|
/** --wait: block until terminal or --timeout. */
|
|
@@ -1338,6 +1574,10 @@ interface RunTestRunAllOptions extends CommonOptions {
|
|
|
1338
1574
|
reportFile?: string;
|
|
1339
1575
|
/** --report-suite-name: optional override for the JUnit <testsuite name=...>. */
|
|
1340
1576
|
reportSuiteName?: string;
|
|
1577
|
+
/** --gh-output: force the GitHub-native output layer even off-Actions (issue #99). */
|
|
1578
|
+
ghOutput?: boolean;
|
|
1579
|
+
/** --summary-file: also write the reduced machine summary JSON to this path. */
|
|
1580
|
+
summaryFile?: string;
|
|
1341
1581
|
}
|
|
1342
1582
|
/**
|
|
1343
1583
|
* `test run --all --project <id>` — M4 piece-2.
|
|
@@ -1350,8 +1590,9 @@ export declare function runTestRunAll(opts: RunTestRunAllOptions, deps?: TestDep
|
|
|
1350
1590
|
/**
|
|
1351
1591
|
* `test rerun` — M3.4 piece-3.
|
|
1352
1592
|
*
|
|
1353
|
-
* FE: `POST /tests/{id}/runs/rerun` → verbatim replay
|
|
1354
|
-
*
|
|
1593
|
+
* FE: `POST /tests/{id}/runs/rerun` → verbatim replay, billed at 0.5 credits
|
|
1594
|
+
* (same as a fresh run; legacy V2 accounts: free). With `--wait`, polls
|
|
1595
|
+
* `GET /runs/{runId}` until terminal.
|
|
1355
1596
|
*
|
|
1356
1597
|
* BE: same route → closure + per-member runIds. With `--wait`, polls every
|
|
1357
1598
|
* closure-member runId; exits on the named test's verdict; failed closure
|
|
@@ -1416,9 +1657,10 @@ interface RunTestFlakyOptions extends CommonOptions {
|
|
|
1416
1657
|
* `test flaky <test-id>` — replay a test N times and report a stability score.
|
|
1417
1658
|
*
|
|
1418
1659
|
* Each attempt is a `POST /tests/{id}/runs/rerun` with auto-heal OFF (a strict
|
|
1419
|
-
* verbatim replay) followed by `pollRunUntilTerminal`.
|
|
1420
|
-
*
|
|
1421
|
-
*
|
|
1660
|
+
* verbatim replay) followed by `pollRunUntilTerminal`. Each replay is billed
|
|
1661
|
+
* as a rerun (0.5 credits FE / 0.2 credits BE, same as a fresh run; legacy V2
|
|
1662
|
+
* accounts: FE rerun remains free) — a one-line credit advisory is printed
|
|
1663
|
+
* for backend tests. The pure scoring lives in
|
|
1422
1664
|
* `lib/flaky.ts`; this function is the I/O orchestrator.
|
|
1423
1665
|
*
|
|
1424
1666
|
* Exit code: 0 when every observed attempt passed (stable), else 1 — so CI can
|