@testsprite/testsprite-cli 0.2.0 → 0.4.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 +35 -26
- package/dist/commands/agent.d.ts +43 -0
- package/dist/commands/agent.js +200 -18
- package/dist/commands/auth.d.ts +5 -0
- package/dist/commands/auth.js +38 -27
- package/dist/commands/doctor.d.ts +49 -0
- package/dist/commands/doctor.js +233 -0
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.js +24 -14
- package/dist/commands/project.d.ts +75 -2
- package/dist/commands/project.js +326 -47
- package/dist/commands/test.d.ts +281 -2
- package/dist/commands/test.js +1658 -177
- package/dist/commands/usage.js +13 -12
- package/dist/index.js +71 -3
- package/dist/lib/agent-targets.d.ts +72 -6
- package/dist/lib/agent-targets.js +188 -6
- package/dist/lib/bundle.d.ts +34 -0
- package/dist/lib/bundle.js +63 -11
- package/dist/lib/client-factory.d.ts +31 -0
- package/dist/lib/client-factory.js +63 -0
- package/dist/lib/config.d.ts +2 -0
- package/dist/lib/config.js +11 -2
- package/dist/lib/credentials.js +10 -1
- package/dist/lib/dry-run/samples.d.ts +5 -0
- package/dist/lib/dry-run/samples.js +64 -0
- package/dist/lib/errors.d.ts +28 -1
- package/dist/lib/errors.js +40 -0
- 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 +80 -0
- package/dist/lib/flaky.js +76 -0
- package/dist/lib/http.d.ts +73 -1
- package/dist/lib/http.js +327 -135
- package/dist/lib/interrupt.d.ts +116 -0
- package/dist/lib/interrupt.js +182 -0
- package/dist/lib/junit-report.d.ts +58 -0
- package/dist/lib/junit-report.js +210 -0
- package/dist/lib/output.d.ts +16 -1
- package/dist/lib/output.js +24 -2
- package/dist/lib/pagination.d.ts +4 -3
- package/dist/lib/pagination.js +34 -6
- package/dist/lib/poll.d.ts +11 -0
- package/dist/lib/poll.js +70 -5
- package/dist/lib/prompt.js +52 -8
- package/dist/lib/proxy.d.ts +29 -0
- package/dist/lib/proxy.js +30 -0
- package/dist/lib/render-error.js +3 -1
- package/dist/lib/runs.types.d.ts +9 -0
- package/dist/lib/skill-nudge.d.ts +2 -2
- package/dist/lib/skill-nudge.js +13 -4
- package/dist/lib/target-url.js +8 -1
- package/dist/lib/ticker.d.ts +11 -1
- package/dist/lib/ticker.js +33 -1
- package/dist/lib/update-check.d.ts +67 -0
- package/dist/lib/update-check.js +246 -0
- package/dist/lib/v3-advisory.d.ts +13 -0
- package/dist/lib/v3-advisory.js +24 -0
- package/dist/lib/version-notice.d.ts +37 -0
- package/dist/lib/version-notice.js +87 -0
- package/dist/version-guard.d.ts +33 -0
- package/dist/version-guard.js +39 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -2
- package/skills/testsprite-onboard.skill.md +21 -0
- package/skills/testsprite-verify.codex.md +6 -0
- package/skills/testsprite-verify.skill.md +48 -4
package/dist/commands/test.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { type CommonOptions as FactoryCommonOptions } from '../lib/client-factory.js';
|
|
3
3
|
import { type WriteBundleResult } from '../lib/bundle.js';
|
|
4
|
+
import { type JUnitReportFormat } from '../lib/junit-report.js';
|
|
4
5
|
import { ApiError } from '../lib/errors.js';
|
|
6
|
+
import { type ShutdownHandle } from '../lib/interrupt.js';
|
|
5
7
|
import type { FetchImpl } from '../lib/http.js';
|
|
6
8
|
import { type Page } from '../lib/pagination.js';
|
|
7
|
-
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';
|
|
10
|
+
import { type FlakyReport } from '../lib/flaky.js';
|
|
8
11
|
/**
|
|
9
12
|
* `details` debug block per the CLI OpenAPI `Test` schema
|
|
10
13
|
* (M2.1 amendment). `processingStatus` / `testStatus` are the
|
|
@@ -66,6 +69,14 @@ export interface CliTest {
|
|
|
66
69
|
* no priority has been set. Text mode surfaces it only when truthy.
|
|
67
70
|
*/
|
|
68
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;
|
|
69
80
|
}
|
|
70
81
|
export type CliPublicStatus = 'draft' | 'ready' | 'queued' | 'running' | 'passed' | 'failed' | 'blocked' | 'cancelled' | 'unknown';
|
|
71
82
|
/**
|
|
@@ -102,6 +113,19 @@ export interface CliTestStep {
|
|
|
102
113
|
* that don't emit the field still type-check.
|
|
103
114
|
*/
|
|
104
115
|
outcomeContributesToFailure?: boolean | null;
|
|
116
|
+
/**
|
|
117
|
+
* Per-step failure text, carried from `RunStepDto.error` on the run-scoped
|
|
118
|
+
* endpoint (`GET /runs/{id}?includeSteps=true`). Only present on `--run-id`
|
|
119
|
+
* responses; the cumulative `/tests/{id}/steps` rows do not carry it, so the
|
|
120
|
+
* field stays optional (additive, non-breaking for existing consumers).
|
|
121
|
+
*/
|
|
122
|
+
error?: string | null;
|
|
123
|
+
/**
|
|
124
|
+
* Wire step kind from `RunStepDto.type` on the run-scoped endpoint. Same
|
|
125
|
+
* availability rules as `error`. Named `stepType` to avoid colliding with
|
|
126
|
+
* the free-form `action` label above.
|
|
127
|
+
*/
|
|
128
|
+
stepType?: 'action' | 'assertion';
|
|
105
129
|
}
|
|
106
130
|
/**
|
|
107
131
|
* §6.5 failureKind enum (M2.1 piece 4 widened from six to nine values).
|
|
@@ -159,6 +183,18 @@ export interface CliLatestResult {
|
|
|
159
183
|
* former `{passed,failed,skipped}` count object).
|
|
160
184
|
*/
|
|
161
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;
|
|
162
198
|
/**
|
|
163
199
|
* §6.5.1 (M2.1 piece 3) — inline failure analysis. Present when the
|
|
164
200
|
* caller passed `--include-analysis` (`?includeAnalysis=true` on
|
|
@@ -243,6 +279,14 @@ export interface CliFailureBlock {
|
|
|
243
279
|
*/
|
|
244
280
|
recommendedFixTarget: CliFixTarget | null;
|
|
245
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;
|
|
246
290
|
}
|
|
247
291
|
/** §6.7 wire shape — one atomic snapshot of the latest failing run. */
|
|
248
292
|
export interface CliFailureContext {
|
|
@@ -272,6 +316,13 @@ export interface TestDeps {
|
|
|
272
316
|
* no-op in tests to avoid real delays.
|
|
273
317
|
*/
|
|
274
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;
|
|
275
326
|
}
|
|
276
327
|
type CommonOptions = FactoryCommonOptions;
|
|
277
328
|
interface ListOptions extends CommonOptions {
|
|
@@ -300,6 +351,12 @@ export interface CliCreateTestResponse {
|
|
|
300
351
|
type: 'frontend' | 'backend';
|
|
301
352
|
codeVersion: string;
|
|
302
353
|
createdAt: string;
|
|
354
|
+
/**
|
|
355
|
+
* Non-fatal advisories from the backend (e.g. the BE auth guardrail
|
|
356
|
+
* flagging a hardcoded credential). Rendered on stderr; the create
|
|
357
|
+
* still succeeded.
|
|
358
|
+
*/
|
|
359
|
+
warnings?: string[];
|
|
303
360
|
}
|
|
304
361
|
export declare const CLI_CREATE_PRIORITIES: readonly ["p0", "p1", "p2", "p3"];
|
|
305
362
|
export type CliCreatePriority = (typeof CLI_CREATE_PRIORITIES)[number];
|
|
@@ -436,6 +493,12 @@ interface UpdateOptions extends CommonOptions {
|
|
|
436
493
|
description?: string;
|
|
437
494
|
/** Optional new priority. Enum-validated CLI-side. */
|
|
438
495
|
priority?: CliCreatePriority;
|
|
496
|
+
/** Backend-only: variable names this test produces (repeatable --produces). */
|
|
497
|
+
produces?: string[];
|
|
498
|
+
/** Backend-only: variable names this test consumes (repeatable --needs); wire field `consumes`. */
|
|
499
|
+
needs?: string[];
|
|
500
|
+
/** Backend-only: free-text wave category (--category). */
|
|
501
|
+
category?: string;
|
|
439
502
|
/** Caller-supplied idempotency token; UUIDv4 minted client-side if absent. */
|
|
440
503
|
idempotencyKey?: string;
|
|
441
504
|
}
|
|
@@ -847,6 +910,12 @@ export interface CliPutTestCodeResponse {
|
|
|
847
910
|
testId: string;
|
|
848
911
|
codeVersion: string;
|
|
849
912
|
updatedAt: string;
|
|
913
|
+
/**
|
|
914
|
+
* Non-fatal advisories (e.g. the BE auth guardrail flagging a hardcoded
|
|
915
|
+
* credential in the replaced code). Rendered on stderr; the update still
|
|
916
|
+
* succeeded.
|
|
917
|
+
*/
|
|
918
|
+
warnings?: string[];
|
|
850
919
|
}
|
|
851
920
|
type CodePutLanguage = CliTestCode['language'];
|
|
852
921
|
interface CodePutOptions extends CommonOptions {
|
|
@@ -934,6 +1003,102 @@ interface StepsOptions extends CommonOptions {
|
|
|
934
1003
|
*/
|
|
935
1004
|
runId?: string;
|
|
936
1005
|
}
|
|
1006
|
+
export interface DiffOptions extends CommonOptions {
|
|
1007
|
+
runA: string;
|
|
1008
|
+
runB: string;
|
|
1009
|
+
}
|
|
1010
|
+
/** One step whose status flipped between the two compared runs. */
|
|
1011
|
+
export interface CliDiffStep {
|
|
1012
|
+
stepIndex: number;
|
|
1013
|
+
statusA: string;
|
|
1014
|
+
statusB: string;
|
|
1015
|
+
/** First divergent failing side's error text, when the wire carried one. */
|
|
1016
|
+
errorA?: string | null;
|
|
1017
|
+
errorB?: string | null;
|
|
1018
|
+
}
|
|
1019
|
+
export interface CliRunDiff {
|
|
1020
|
+
runA: {
|
|
1021
|
+
runId: string;
|
|
1022
|
+
testId: string;
|
|
1023
|
+
status: string;
|
|
1024
|
+
failureKind: string | null;
|
|
1025
|
+
failedStepIndex: number | null;
|
|
1026
|
+
codeVersion: string | null;
|
|
1027
|
+
};
|
|
1028
|
+
runB: {
|
|
1029
|
+
runId: string;
|
|
1030
|
+
testId: string;
|
|
1031
|
+
status: string;
|
|
1032
|
+
failureKind: string | null;
|
|
1033
|
+
failedStepIndex: number | null;
|
|
1034
|
+
codeVersion: string | null;
|
|
1035
|
+
};
|
|
1036
|
+
verdictChanged: boolean;
|
|
1037
|
+
failedStepIndexChanged: boolean;
|
|
1038
|
+
failureKindChanged: boolean;
|
|
1039
|
+
codeVersionChanged: boolean;
|
|
1040
|
+
/** True when the two runs belong to DIFFERENT tests (deltas may be meaningless). */
|
|
1041
|
+
crossTest: boolean;
|
|
1042
|
+
changedSteps: CliDiffStep[];
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* `test diff <runA> <runB>` (issue #124): isolate what regressed between two
|
|
1046
|
+
* runs, the first question when CI goes red ("what changed since the last
|
|
1047
|
+
* green run?"). Pure client-side composition of the existing per-run read
|
|
1048
|
+
* (`GET /runs/{id}?includeSteps=true`); the endpoint accepts any two run-ids,
|
|
1049
|
+
* so a cross-test pair is a WARNING, not an error. Exit 0 when the verdicts
|
|
1050
|
+
* match, exit 1 when they differ, so the command is CI-scriptable.
|
|
1051
|
+
*/
|
|
1052
|
+
export declare function runDiff(opts: DiffOptions, deps?: TestDeps): Promise<CliRunDiff>;
|
|
1053
|
+
export interface LintOptions extends CommonOptions {
|
|
1054
|
+
planFrom?: string;
|
|
1055
|
+
planFromDir?: string;
|
|
1056
|
+
plans?: string;
|
|
1057
|
+
steps?: string;
|
|
1058
|
+
}
|
|
1059
|
+
export interface CliLintIssue {
|
|
1060
|
+
file: string;
|
|
1061
|
+
field: string;
|
|
1062
|
+
reason: string;
|
|
1063
|
+
}
|
|
1064
|
+
export interface CliLintReport {
|
|
1065
|
+
checked: number;
|
|
1066
|
+
valid: number;
|
|
1067
|
+
issues: CliLintIssue[];
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* `test lint` (issue #98): validate plan/steps files fully OFFLINE with the
|
|
1071
|
+
* SAME validators the create paths run, but collecting EVERY problem instead
|
|
1072
|
+
* of dying on the first one, and without any network write. The create-batch
|
|
1073
|
+
* reader is first-error-fatal and only reachable through a command that POSTs,
|
|
1074
|
+
* so authoring a 12-plan directory meant one error per paid round-trip. Zero
|
|
1075
|
+
* network, zero credentials: exit 0 when everything is valid, 5 otherwise, so
|
|
1076
|
+
* it drops into a pre-commit hook or CI step before `create-batch`.
|
|
1077
|
+
*/
|
|
1078
|
+
export declare function runLint(opts: LintOptions, deps?: TestDeps): Promise<CliLintReport>;
|
|
1079
|
+
export interface ScaffoldOptions extends CommonOptions {
|
|
1080
|
+
scaffoldType: 'frontend' | 'backend';
|
|
1081
|
+
out?: string;
|
|
1082
|
+
force: boolean;
|
|
1083
|
+
}
|
|
1084
|
+
/** JSON payload `test scaffold --type backend` prints under --output json. */
|
|
1085
|
+
export interface CliBackendScaffold {
|
|
1086
|
+
type: 'backend';
|
|
1087
|
+
language: 'python';
|
|
1088
|
+
code: string;
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* `test scaffold` — emit a schema-correct starter test definition so a first
|
|
1092
|
+
* test never starts from hand-copied JSON. Pure-local: no network, no
|
|
1093
|
+
* credentials, no filesystem reads. The frontend template is a `CliPlanInput`
|
|
1094
|
+
* (the exact shape `--plan-from` ingests; sourceRef: CliPlanInput /
|
|
1095
|
+
* PLAN_STEP_TYPES above), so `scaffold | create --plan-from -`-style flows
|
|
1096
|
+
* validate out of the box. The backend template is the minimal `requests`
|
|
1097
|
+
* script the onboarding skill mandates: define a test function with a
|
|
1098
|
+
* concrete status assertion, then CALL it (a defined-but-never-called test
|
|
1099
|
+
* would pass without asserting anything).
|
|
1100
|
+
*/
|
|
1101
|
+
export declare function runScaffold(opts: ScaffoldOptions, deps?: TestDeps): Promise<CliPlanInput | CliBackendScaffold>;
|
|
937
1102
|
export declare function runSteps(opts: StepsOptions, deps?: TestDeps): Promise<Page<CliTestStep>>;
|
|
938
1103
|
interface ResultOptions extends CommonOptions {
|
|
939
1104
|
testId: string;
|
|
@@ -1134,6 +1299,12 @@ interface RunTestRerunOptions extends CommonOptions {
|
|
|
1134
1299
|
* filters. Client-side only.
|
|
1135
1300
|
*/
|
|
1136
1301
|
nameFilter?: string;
|
|
1302
|
+
/** --report junit: write a JUnit XML sidecar after batch --wait completes. */
|
|
1303
|
+
report?: JUnitReportFormat;
|
|
1304
|
+
/** --report-file: destination path for the JUnit XML artifact. */
|
|
1305
|
+
reportFile?: string;
|
|
1306
|
+
/** --report-suite-name: optional override for the JUnit <testsuite name=...>. */
|
|
1307
|
+
reportSuiteName?: string;
|
|
1137
1308
|
}
|
|
1138
1309
|
/**
|
|
1139
1310
|
* Decide whether a testId-scoped result belongs to THIS run (vs a stale
|
|
@@ -1154,6 +1325,85 @@ export declare function backendResultIsForThisRun(result: CliLatestResult, runId
|
|
|
1154
1325
|
* 7 on timeout.
|
|
1155
1326
|
*/
|
|
1156
1327
|
export declare function runTestRun(opts: RunTestRunOptions, deps?: TestDeps): Promise<TriggerRunResponse | RunResponse>;
|
|
1328
|
+
/** One row of the `test wait <run-id...>` multi-run payload. */
|
|
1329
|
+
export interface CliMultiWaitResult {
|
|
1330
|
+
runId: string;
|
|
1331
|
+
/** Terminal run status, or 'timeout', or 'error:<CODE>' when the poll failed. */
|
|
1332
|
+
status: string;
|
|
1333
|
+
/** Test the run belongs to, when the poll observed it. */
|
|
1334
|
+
testId?: string;
|
|
1335
|
+
}
|
|
1336
|
+
export interface RunTestWaitManyOptions extends CommonOptions {
|
|
1337
|
+
runIds: string[];
|
|
1338
|
+
timeoutSeconds: number;
|
|
1339
|
+
maxConcurrency: number;
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* `test wait <run-id...>` with two or more ids: attach to N already-dispatched
|
|
1343
|
+
* runs in ONE invocation. This closes the loop the CLI itself opens: every
|
|
1344
|
+
* batch/closure timeout prints one `testsprite test wait <runId>` hint PER
|
|
1345
|
+
* member, which previously meant N sequential blocking invocations. The runs
|
|
1346
|
+
* are polled concurrently under a bounded pool with ONE shared deadline
|
|
1347
|
+
* (`--timeout` bounds the whole invocation, not each member), each member's
|
|
1348
|
+
* poll is total (a transient error on one run never discards the others), and
|
|
1349
|
+
* the exit code is the worst status across members: auth errors escalate to
|
|
1350
|
+
* exit 3, any timeout or poll error exits 7, any non-passed terminal exits 1.
|
|
1351
|
+
* Distinct from a run journal (issue #80): no persistence, just N known ids.
|
|
1352
|
+
*/
|
|
1353
|
+
export declare function runTestWaitMany(opts: RunTestWaitManyOptions, deps?: TestDeps): Promise<{
|
|
1354
|
+
results: CliMultiWaitResult[];
|
|
1355
|
+
summary: Record<string, number>;
|
|
1356
|
+
}>;
|
|
1357
|
+
export interface RunTestCancelOptions extends CommonOptions {
|
|
1358
|
+
runIds: string[];
|
|
1359
|
+
}
|
|
1360
|
+
/** One run's outcome in a multi-id `test cancel` summary. */
|
|
1361
|
+
export interface CliCancelResultRow {
|
|
1362
|
+
runId: string;
|
|
1363
|
+
status: 'cancelled' | 'alreadyCancelled' | 'conflict' | 'notFound' | 'error';
|
|
1364
|
+
/** Terminal status the run was already in, for a `conflict` row. */
|
|
1365
|
+
conflictStatus?: string;
|
|
1366
|
+
error?: string;
|
|
1367
|
+
}
|
|
1368
|
+
/** JSON payload for a multi-id `test cancel` — per piece-3 CXL-11. */
|
|
1369
|
+
export interface CliCancelSummary {
|
|
1370
|
+
cancelled: string[];
|
|
1371
|
+
alreadyCancelled: string[];
|
|
1372
|
+
conflicts: Array<{
|
|
1373
|
+
runId: string;
|
|
1374
|
+
status: string;
|
|
1375
|
+
}>;
|
|
1376
|
+
notFound: string[];
|
|
1377
|
+
/**
|
|
1378
|
+
* Runs that errored for a reason other than 404/409 (e.g. auth, transport).
|
|
1379
|
+
* Always present — an empty array on full success — so machine consumers
|
|
1380
|
+
* can rely on a stable shape (DEV-331 codex finding 2).
|
|
1381
|
+
*/
|
|
1382
|
+
errors: Array<{
|
|
1383
|
+
runId: string;
|
|
1384
|
+
message: string;
|
|
1385
|
+
}>;
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* `test cancel <run-id...>` — DEV-331 piece 3.
|
|
1389
|
+
*
|
|
1390
|
+
* User-initiated cancel of one or more queued/running runs via
|
|
1391
|
+
* `POST /api/cli/v1/runs/{runId}/cancel`. Naturally idempotent (D10): a
|
|
1392
|
+
* repeat cancel of the same run is a 200 `alreadyCancelled` success, not an
|
|
1393
|
+
* error. Dispatches serially (per-id volume is tiny — no batch endpoint,
|
|
1394
|
+
* D8 "Batch-level cancel endpoint... YAGNI").
|
|
1395
|
+
*
|
|
1396
|
+
* Single id: renders the returned run card (`status cancelled`); an
|
|
1397
|
+
* `alreadyCancelled` response adds an `[advisory]` line. Exit code mirrors
|
|
1398
|
+
* the server response directly — 0 on success (fresh or already-cancelled),
|
|
1399
|
+
* 4 on 404 (unknown/cross-tenant), 6 on 409 (already terminal).
|
|
1400
|
+
*
|
|
1401
|
+
* Multi-id: prints a `{cancelled, alreadyCancelled, conflicts, notFound}`
|
|
1402
|
+
* summary. Exit precedence (CXL-11): any `notFound` → 4 (outranks conflict —
|
|
1403
|
+
* it signals a caller bug, wrong id/tenant); else any `conflicts` → 6; else 0.
|
|
1404
|
+
*/
|
|
1405
|
+
export declare function runTestCancel(opts: RunTestCancelOptions, deps?: TestDeps): Promise<CancelRunResponse | CliCancelSummary>;
|
|
1406
|
+
export declare function createTestCancelCommand(deps: TestDeps): Command;
|
|
1157
1407
|
/**
|
|
1158
1408
|
* `test wait <run-id>` — M3.3 piece-3.
|
|
1159
1409
|
*
|
|
@@ -1162,7 +1412,7 @@ export declare function runTestRun(opts: RunTestRunOptions, deps?: TestDeps): Pr
|
|
|
1162
1412
|
*/
|
|
1163
1413
|
export declare function runTestWait(opts: RunTestWaitOptions, deps?: TestDeps): Promise<RunResponse>;
|
|
1164
1414
|
interface RunTestRunAllOptions extends CommonOptions {
|
|
1165
|
-
/** projectId to run all
|
|
1415
|
+
/** projectId to run all tests in. */
|
|
1166
1416
|
projectId: string;
|
|
1167
1417
|
/** --filter <substr>: only run tests whose name contains this substring (case-insensitive). */
|
|
1168
1418
|
nameFilter?: string;
|
|
@@ -1174,6 +1424,12 @@ interface RunTestRunAllOptions extends CommonOptions {
|
|
|
1174
1424
|
maxConcurrency: number;
|
|
1175
1425
|
/** Caller-supplied idempotency token; auto-minted if absent. */
|
|
1176
1426
|
idempotencyKey?: string;
|
|
1427
|
+
/** --report junit: write a JUnit XML sidecar after batch --wait completes. */
|
|
1428
|
+
report?: JUnitReportFormat;
|
|
1429
|
+
/** --report-file: destination path for the JUnit XML artifact. */
|
|
1430
|
+
reportFile?: string;
|
|
1431
|
+
/** --report-suite-name: optional override for the JUnit <testsuite name=...>. */
|
|
1432
|
+
reportSuiteName?: string;
|
|
1177
1433
|
}
|
|
1178
1434
|
/**
|
|
1179
1435
|
* `test run --all --project <id>` — M4 piece-2.
|
|
@@ -1215,6 +1471,7 @@ export interface ArtifactGetResult {
|
|
|
1215
1471
|
/** Set when bundle was written to disk. */
|
|
1216
1472
|
bundle?: WriteBundleResult;
|
|
1217
1473
|
}
|
|
1474
|
+
export declare function resolveDefaultArtifactDir(runId: string, cwd?: string): string;
|
|
1218
1475
|
/**
|
|
1219
1476
|
* Validate that the parent directory of `resolvedDir` exists and is a
|
|
1220
1477
|
* directory. Surfaces `VALIDATION_ERROR` (exit 5) — matches the convention
|
|
@@ -1238,6 +1495,28 @@ export declare function assertOutDirParentExists(resolvedDir: string): Promise<v
|
|
|
1238
1495
|
*/
|
|
1239
1496
|
export declare function runArtifactGet(opts: ArtifactGetOptions, deps?: TestDeps): Promise<ArtifactGetResult>;
|
|
1240
1497
|
export declare function createTestCommand(deps?: TestDeps): Command;
|
|
1498
|
+
interface RunTestFlakyOptions extends CommonOptions {
|
|
1499
|
+
testId: string;
|
|
1500
|
+
/** Number of replays to run (1..MAX_FLAKY_RUNS). */
|
|
1501
|
+
runs: number;
|
|
1502
|
+
/** Stop at the first non-passing attempt. */
|
|
1503
|
+
untilFail: boolean;
|
|
1504
|
+
/** Per-attempt polling deadline in seconds. */
|
|
1505
|
+
timeoutSeconds: number;
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* `test flaky <test-id>` — replay a test N times and report a stability score.
|
|
1509
|
+
*
|
|
1510
|
+
* Each attempt is a `POST /tests/{id}/runs/rerun` with auto-heal OFF (a strict
|
|
1511
|
+
* verbatim replay) followed by `pollRunUntilTerminal`. Frontend replays are
|
|
1512
|
+
* free verbatim script replays; backend replays re-run the dependency closure
|
|
1513
|
+
* (a one-line credit advisory is printed). The pure scoring lives in
|
|
1514
|
+
* `lib/flaky.ts`; this function is the I/O orchestrator.
|
|
1515
|
+
*
|
|
1516
|
+
* Exit code: 0 when every observed attempt passed (stable), else 1 — so CI can
|
|
1517
|
+
* gate a merge on flakiness.
|
|
1518
|
+
*/
|
|
1519
|
+
export declare function runFlaky(opts: RunTestFlakyOptions, deps?: TestDeps): Promise<FlakyReport | undefined>;
|
|
1241
1520
|
/**
|
|
1242
1521
|
* D4 (dogfood CoderCup 2026-06-05): under `--wait` the user opts into a
|
|
1243
1522
|
* long-running operation bounded by `--timeout`. The default 120s per-request
|