@testsprite/testsprite-cli 0.15.0 → 0.17.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 +53 -141
- package/dist/commands/agent.d.ts +12 -4
- package/dist/commands/agent.js +55 -65
- package/dist/commands/auth.d.ts +6 -10
- package/dist/commands/auth.js +44 -56
- package/dist/commands/ci.d.ts +23 -100
- package/dist/commands/ci.js +297 -489
- package/dist/commands/completion.js +2 -1
- package/dist/commands/conversation.d.ts +27 -0
- package/dist/commands/conversation.js +702 -0
- package/dist/commands/doctor.d.ts +5 -1
- package/dist/commands/doctor.js +130 -34
- package/dist/commands/init.d.ts +4 -45
- package/dist/commands/init.js +116 -68
- package/dist/commands/project-env.d.ts +62 -2
- package/dist/commands/project-env.js +426 -53
- package/dist/commands/project-sign-in.d.ts +0 -48
- package/dist/commands/project-sign-in.js +1 -224
- package/dist/commands/project.d.ts +15 -186
- package/dist/commands/project.js +93 -921
- package/dist/commands/result.d.ts +10 -0
- package/dist/commands/result.js +215 -0
- package/dist/commands/schedule.d.ts +0 -29
- package/dist/commands/schedule.js +47 -97
- package/dist/commands/test.d.ts +315 -1824
- package/dist/commands/test.js +1962 -13733
- package/dist/commands/testlist.d.ts +128 -5
- package/dist/commands/testlist.js +269 -329
- package/dist/commands/tunnel.d.ts +2 -2
- package/dist/commands/tunnel.js +43 -41
- package/dist/commands/usage.d.ts +12 -45
- package/dist/commands/usage.js +51 -131
- package/dist/index.js +189 -108
- package/dist/lib/agent-detect.js +9 -5
- package/dist/lib/agent-targets.d.ts +21 -2
- package/dist/lib/agent-targets.js +88 -11
- package/dist/lib/args.d.ts +13 -0
- package/dist/lib/args.js +49 -0
- package/dist/lib/basic-auth.d.ts +3 -0
- package/dist/lib/basic-auth.js +15 -0
- package/dist/lib/billing-refusal.js +4 -3
- package/dist/lib/ci-linkage.d.ts +4 -82
- package/dist/lib/ci-linkage.js +4 -157
- package/dist/lib/ci-run.js +1 -1
- package/dist/lib/client-factory.d.ts +10 -2
- package/dist/lib/client-factory.js +38 -26
- package/dist/lib/commit-signal.d.ts +65 -0
- package/dist/lib/commit-signal.js +305 -0
- package/dist/lib/concurrency-limiter.d.ts +6 -0
- package/dist/lib/concurrency-limiter.js +29 -0
- package/dist/lib/config.js +10 -5
- package/dist/lib/conflict-reason.d.ts +31 -4
- package/dist/lib/conflict-reason.js +38 -4
- package/dist/lib/conversation/answers.d.ts +9 -0
- package/dist/lib/conversation/answers.js +49 -0
- package/dist/lib/conversation/api.d.ts +71 -0
- package/dist/lib/conversation/api.js +150 -0
- package/dist/lib/conversation/change.d.ts +31 -0
- package/dist/lib/conversation/change.js +124 -0
- package/dist/lib/conversation/context.d.ts +19 -0
- package/dist/lib/conversation/context.js +70 -0
- package/dist/lib/conversation/environment.d.ts +15 -0
- package/dist/lib/conversation/environment.js +33 -0
- package/dist/lib/conversation/follow.d.ts +24 -0
- package/dist/lib/conversation/follow.js +42 -0
- package/dist/lib/conversation/render.d.ts +33 -0
- package/dist/lib/conversation/render.js +315 -0
- package/dist/lib/conversation/title.d.ts +2 -0
- package/dist/lib/conversation/title.js +18 -0
- package/dist/lib/conversation/types.d.ts +156 -0
- package/dist/lib/conversation/types.js +6 -0
- package/dist/lib/credentials.js +67 -11
- package/dist/lib/cron.d.ts +1 -1
- package/dist/lib/cron.js +2 -2
- package/dist/lib/dispatch-stop.d.ts +20 -0
- package/dist/lib/dispatch-stop.js +30 -0
- package/dist/lib/download.d.ts +71 -0
- package/dist/lib/download.js +274 -0
- package/dist/lib/dry-run/fetch.d.ts +10 -0
- package/dist/lib/dry-run/fetch.js +20 -0
- package/dist/lib/dry-run/samples.d.ts +6 -34
- package/dist/lib/dry-run/samples.js +389 -751
- package/dist/lib/environment-tunnel.d.ts +16 -26
- package/dist/lib/environment-tunnel.js +161 -157
- package/dist/lib/errors.d.ts +20 -4
- package/dist/lib/errors.js +36 -16
- package/dist/lib/facade.d.ts +7 -29
- package/dist/lib/facade.js +7 -36
- package/dist/lib/failing-fe-resolver.d.ts +13 -58
- package/dist/lib/failing-fe-resolver.js +47 -132
- package/dist/lib/first-suite-hint.d.ts +16 -22
- package/dist/lib/first-suite-hint.js +38 -47
- package/dist/lib/gh-output.d.ts +76 -21
- package/dist/lib/gh-output.js +171 -90
- package/dist/lib/git-utils.d.ts +56 -0
- package/dist/lib/git-utils.js +212 -0
- package/dist/lib/github-context.d.ts +2 -0
- package/dist/lib/github-context.js +40 -8
- package/dist/lib/history-retention.d.ts +6 -2
- package/dist/lib/history-retention.js +10 -7
- package/dist/lib/http.d.ts +58 -134
- package/dist/lib/http.js +352 -271
- package/dist/lib/interrupt.d.ts +14 -8
- package/dist/lib/interrupt.js +28 -10
- package/dist/lib/junit-report.d.ts +60 -4
- package/dist/lib/junit-report.js +209 -32
- package/dist/lib/local-target.d.ts +3 -3
- package/dist/lib/local-target.js +3 -3
- package/dist/lib/output.d.ts +0 -29
- package/dist/lib/output.js +10 -33
- package/dist/lib/pagination.d.ts +2 -5
- package/dist/lib/pagination.js +2 -5
- package/dist/lib/presigned-url.d.ts +22 -0
- package/dist/lib/presigned-url.js +90 -0
- package/dist/lib/prompt.js +36 -2
- package/dist/lib/proxy.js +2 -1
- package/dist/lib/redact.d.ts +2 -2
- package/dist/lib/redact.js +3 -4
- package/dist/lib/removed-commands.d.ts +18 -0
- package/dist/lib/removed-commands.js +154 -0
- package/dist/lib/render-error.d.ts +31 -6
- package/dist/lib/render-error.js +88 -25
- package/dist/lib/response-schemas.d.ts +38 -30
- package/dist/lib/response-schemas.js +210 -207
- package/dist/lib/result/api.d.ts +24 -0
- package/dist/lib/result/api.js +28 -0
- package/dist/lib/result/evidence.d.ts +71 -0
- package/dist/lib/result/evidence.js +420 -0
- package/dist/lib/result/render.d.ts +20 -0
- package/dist/lib/result/render.js +194 -0
- package/dist/lib/result/types.d.ts +122 -0
- package/dist/lib/result/types.js +19 -0
- package/dist/lib/run-output.d.ts +275 -0
- package/dist/lib/run-output.js +227 -0
- package/dist/lib/run-render.d.ts +101 -0
- package/dist/lib/run-render.js +183 -0
- package/dist/lib/run-wait.d.ts +192 -0
- package/dist/lib/run-wait.js +452 -0
- package/dist/lib/runs.types.d.ts +134 -367
- package/dist/lib/runs.types.js +0 -14
- package/dist/lib/secret-file.d.ts +1 -1
- package/dist/lib/secret-file.js +11 -2
- package/dist/lib/skill-nudge.d.ts +7 -27
- package/dist/lib/skill-nudge.js +9 -37
- package/dist/lib/target-path.d.ts +15 -0
- package/dist/lib/target-path.js +35 -0
- package/dist/lib/target-url-advisory.d.ts +19 -0
- package/dist/lib/target-url-advisory.js +31 -0
- package/dist/lib/target-url-preflight.d.ts +9 -0
- package/dist/lib/target-url-preflight.js +214 -106
- package/dist/lib/target-url.d.ts +1 -1
- package/dist/lib/target-url.js +6 -16
- package/dist/lib/telemetry.d.ts +32 -12
- package/dist/lib/telemetry.js +39 -8
- package/dist/lib/terminal-text.d.ts +41 -0
- package/dist/lib/terminal-text.js +127 -0
- package/dist/lib/testlist.types.d.ts +16 -8
- package/dist/lib/testlist.types.js +1 -1
- package/dist/lib/text-equality.d.ts +2 -0
- package/dist/lib/text-equality.js +5 -0
- package/dist/lib/text-file.d.ts +16 -0
- package/dist/lib/text-file.js +41 -0
- package/dist/lib/text-table.d.ts +46 -0
- package/dist/lib/text-table.js +72 -4
- package/dist/lib/ticker.d.ts +9 -2
- package/dist/lib/ticker.js +16 -3
- package/dist/lib/transport-failure.d.ts +22 -0
- package/dist/lib/transport-failure.js +126 -0
- package/dist/lib/tunnel-session.d.ts +7 -1
- package/dist/lib/tunnel-session.js +22 -9
- package/dist/lib/update-check.js +3 -2
- package/dist/lib/url-template.d.ts +43 -0
- package/dist/lib/url-template.js +151 -0
- package/dist/lib/validate.d.ts +0 -64
- package/dist/lib/validate.js +2 -131
- package/dist/lib/version-notice.js +4 -3
- package/dist/lib/wait-exit.d.ts +37 -2
- package/dist/lib/wait-exit.js +88 -30
- package/dist/lib/workspace-status.js +10 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -4
- package/skills/testsprite-ci.skill.md +48 -18
- package/skills/testsprite-onboard.skill.md +66 -151
- package/skills/testsprite-verify.codex.md +54 -56
- package/skills/testsprite-verify.skill.md +194 -358
- package/dist/lib/browser.d.ts +0 -6
- package/dist/lib/browser.js +0 -54
- package/dist/lib/bundle.d.ts +0 -234
- package/dist/lib/bundle.js +0 -781
- package/dist/lib/deprecate.d.ts +0 -10
- package/dist/lib/deprecate.js +0 -13
- package/dist/lib/flaky.d.ts +0 -91
- package/dist/lib/flaky.js +0 -71
- package/dist/lib/plan-poll.d.ts +0 -171
- package/dist/lib/plan-poll.js +0 -441
- package/dist/lib/plans.types.d.ts +0 -130
- package/dist/lib/plans.types.js +0 -31
- package/dist/lib/poll.d.ts +0 -100
- package/dist/lib/poll.js +0 -290
- package/dist/lib/rate-throttle.d.ts +0 -49
- package/dist/lib/rate-throttle.js +0 -75
- package/dist/lib/run-progress.d.ts +0 -41
- package/dist/lib/run-progress.js +0 -56
- package/dist/lib/v3-advisory.d.ts +0 -55
- package/dist/lib/v3-advisory.js +0 -74
- package/schemas/plan.schema.json +0 -61
package/dist/lib/validate.js
CHANGED
|
@@ -1,107 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* JSON input). Implemented with valibot (tree-shakeable, ~1.5 KB gzipped)
|
|
5
|
-
* for structural detection; error envelope construction delegates to the
|
|
6
|
-
* existing `localValidationError` helper so wording and exit codes stay
|
|
2
|
+
* Validation helpers for caller-supplied values that commands share. Error
|
|
3
|
+
* envelopes come from `localValidationError`, so wording and exit codes stay
|
|
7
4
|
* consistent with the rest of the CLI.
|
|
8
|
-
*
|
|
9
|
-
* Design notes:
|
|
10
|
-
* - `kind` defaults to `'field'` on every helper because these are all
|
|
11
|
-
* JSON body paths, not CLI flags. Pass `kind: 'flag'` when validating
|
|
12
|
-
* a real `--flag` value (e.g. in runList / runCreate input guards).
|
|
13
|
-
* - These helpers are assertion-style (`asserts value is T`) so
|
|
14
|
-
* TypeScript narrows the type at the call site without a cast.
|
|
15
|
-
* - Valibot is used purely as the structural detector (safeParse). Custom
|
|
16
|
-
* message strings are composed here so error envelope text matches the
|
|
17
|
-
* legacy inline checks byte-for-byte — never valibot's built-in messages.
|
|
18
|
-
* - Implements dogfood L625 option 2: valibot adoption on the plan-input
|
|
19
|
-
* path. Future schemas can use raw `v.object({...})` directly when
|
|
20
|
-
* more complex shape validation is needed.
|
|
21
|
-
*
|
|
22
|
-
* Precedence rules (documented here to prevent ambiguity):
|
|
23
|
-
* - `allowEmpty: true` overrides `minLength` — if `allowEmpty` is set,
|
|
24
|
-
* a zero-length string is always accepted regardless of `minLength`.
|
|
25
|
-
* - `allowEmpty: true` and `minLength > 0` are mutually exclusive in
|
|
26
|
-
* intent; the type system permits both but `allowEmpty` wins.
|
|
27
5
|
*/
|
|
28
|
-
import * as v from 'valibot';
|
|
29
6
|
import { localValidationError } from './errors.js';
|
|
30
|
-
/**
|
|
31
|
-
* Assert that `value` is a string, throwing a typed VALIDATION_ERROR
|
|
32
|
-
* envelope on failure.
|
|
33
|
-
*
|
|
34
|
-
* @param field Field name (used in the error envelope `details.field`
|
|
35
|
-
* and the `nextAction` line).
|
|
36
|
-
* @param value The raw value to check.
|
|
37
|
-
* @param opts.kind `'field'` (default) or `'flag'`.
|
|
38
|
-
* @param opts.minLength When set, rejects strings shorter than this length
|
|
39
|
-
* (default: 1, i.e. non-empty unless allowEmpty).
|
|
40
|
-
* @param opts.maxLength When set, rejects strings longer than this length.
|
|
41
|
-
* @param opts.allowEmpty When `true`, a zero-length string is accepted.
|
|
42
|
-
* Overrides `minLength` — if both are set, the string
|
|
43
|
-
* is accepted as long as it is a string (length ≥ 0).
|
|
44
|
-
* Defaults to `false`. Whitespace-only strings (e.g.
|
|
45
|
-
* `" "`) are treated as empty when `allowEmpty` is
|
|
46
|
-
* false — they are rejected the same as `""` so junk
|
|
47
|
-
* records cannot reach the backend (dogfood P1 fix).
|
|
48
|
-
*/
|
|
49
|
-
export function requireString(field, value, opts = {}) {
|
|
50
|
-
const { kind = 'field', allowEmpty = false, minLength, maxLength } = opts;
|
|
51
|
-
// Structural check: must be a string.
|
|
52
|
-
const typeResult = v.safeParse(v.string(), value);
|
|
53
|
-
if (!typeResult.success) {
|
|
54
|
-
throw localValidationError(field, 'is required and must be a non-empty string', undefined, kind);
|
|
55
|
-
}
|
|
56
|
-
// Whitespace-only rejection: a string composed solely of spaces/tabs/
|
|
57
|
-
// newlines is treated as empty unless `allowEmpty` is set. This catches
|
|
58
|
-
// cases like `--name " "` that pass the type check but produce junk
|
|
59
|
-
// records in the backend (dogfood P1 fix #1).
|
|
60
|
-
if (!allowEmpty && typeof value === 'string' && value.trim().length === 0 && value.length > 0) {
|
|
61
|
-
throw localValidationError(field, 'is required and must be a non-empty string', undefined, kind);
|
|
62
|
-
}
|
|
63
|
-
// Length lower bound. `allowEmpty` overrides `minLength` per the
|
|
64
|
-
// documented precedence above.
|
|
65
|
-
const effectiveMin = allowEmpty ? 0 : (minLength ?? 1);
|
|
66
|
-
if (effectiveMin > 0) {
|
|
67
|
-
const minResult = v.safeParse(v.pipe(v.string(), v.minLength(effectiveMin)), value);
|
|
68
|
-
if (!minResult.success) {
|
|
69
|
-
throw localValidationError(field, 'is required and must be a non-empty string', undefined, kind);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Length upper bound.
|
|
73
|
-
if (maxLength !== undefined) {
|
|
74
|
-
const maxResult = v.safeParse(v.pipe(v.string(), v.maxLength(maxLength)), value);
|
|
75
|
-
if (!maxResult.success) {
|
|
76
|
-
throw localValidationError(field, `must be at most ${maxLength} characters`, undefined, kind);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Assert that `value` is one of the accepted enum members, throwing a
|
|
82
|
-
* typed VALIDATION_ERROR envelope on failure.
|
|
83
|
-
*
|
|
84
|
-
* The error message format is:
|
|
85
|
-
* `must be one of: "v1", "v2", ...`
|
|
86
|
-
*
|
|
87
|
-
* with each accepted value quoted, comma-separated. This is the canonical
|
|
88
|
-
* format for agent-facing JSON paths (dogfood L625 option 2).
|
|
89
|
-
*
|
|
90
|
-
* @param field Field name used in the error envelope.
|
|
91
|
-
* @param value The raw value to check.
|
|
92
|
-
* @param accepted Tuple/array of the accepted string literals.
|
|
93
|
-
* @param opts.kind `'field'` (default) or `'flag'`.
|
|
94
|
-
*/
|
|
95
|
-
export function requireEnum(field, value, accepted, opts = {}) {
|
|
96
|
-
const { kind = 'field' } = opts;
|
|
97
|
-
// Use valibot picklist for structural detection. Custom message is
|
|
98
|
-
// composed here so the envelope text is explicit and stable.
|
|
99
|
-
const result = v.safeParse(v.picklist(accepted), value);
|
|
100
|
-
if (!result.success) {
|
|
101
|
-
const acceptedList = accepted.map(a => `"${a}"`).join(', ');
|
|
102
|
-
throw localValidationError(field, `must be one of: ${acceptedList}`, [...accepted], kind);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
7
|
/**
|
|
106
8
|
* Validate a caller-supplied `--idempotency-key` value before it is sent as
|
|
107
9
|
* an HTTP header. The HTTP spec (RFC 7230) requires header values to be ASCII
|
|
@@ -131,35 +33,4 @@ export function assertIdempotencyKey(key) {
|
|
|
131
33
|
throw localValidationError('idempotencyKey', 'must be at most 256 characters', undefined, 'flag');
|
|
132
34
|
}
|
|
133
35
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Assert that `arr` is an Array and that its length is within the given
|
|
136
|
-
* bounds, throwing a typed VALIDATION_ERROR envelope on failure.
|
|
137
|
-
*
|
|
138
|
-
* @param field Field name used in the error envelope.
|
|
139
|
-
* @param arr The raw value to check.
|
|
140
|
-
* @param opts.min Minimum length (inclusive). Defaults to 0.
|
|
141
|
-
* @param opts.max Maximum length (inclusive). Omit for no upper cap.
|
|
142
|
-
* @param opts.kind `'field'` (default) or `'flag'`.
|
|
143
|
-
* @param opts.itemNoun Singular noun used in min/max messages (e.g. `'step'`).
|
|
144
|
-
* Defaults to `'item'`. The helper pluralises to `<noun>s`
|
|
145
|
-
* for the max message.
|
|
146
|
-
*/
|
|
147
|
-
export function requireArrayLength(field, arr, opts) {
|
|
148
|
-
const { kind = 'field', min = 0, max, itemNoun = 'item' } = opts;
|
|
149
|
-
// Structural check: must be an array.
|
|
150
|
-
const typeResult = v.safeParse(v.array(v.unknown()), arr);
|
|
151
|
-
if (!typeResult.success) {
|
|
152
|
-
throw localValidationError(field, 'is required and must be an array', undefined, kind);
|
|
153
|
-
}
|
|
154
|
-
const arrVal = arr;
|
|
155
|
-
// Lower bound.
|
|
156
|
-
if (arrVal.length < min) {
|
|
157
|
-
const minLabel = min === 1 ? `one ${itemNoun}` : `${min} ${itemNoun}s`;
|
|
158
|
-
throw localValidationError(field, `must contain at least ${minLabel}`, undefined, kind);
|
|
159
|
-
}
|
|
160
|
-
// Upper bound.
|
|
161
|
-
if (max !== undefined && arrVal.length > max) {
|
|
162
|
-
throw localValidationError(field, `must contain at most ${max} ${itemNoun}s (got ${arrVal.length})`, undefined, kind);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
36
|
//# sourceMappingURL=validate.js.map
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
*/
|
|
30
30
|
import { compareSemver, UPDATE_CHECK_OPT_OUT_ENV } from './update-check.js';
|
|
31
31
|
import { VERSION } from '../version.js';
|
|
32
|
+
import { terminalSafeLine, terminalSafeWriter } from './terminal-text.js';
|
|
32
33
|
/**
|
|
33
34
|
* The gates every advisory shares: opt-out env, dry-run, a present + parseable
|
|
34
35
|
* floor, and the running version strictly below it. Pure.
|
|
@@ -81,7 +82,7 @@ export function shouldWarnPinnedInActions(info, deps = {}) {
|
|
|
81
82
|
* update-notice is the single source of truth for the newest version.
|
|
82
83
|
*/
|
|
83
84
|
export function formatBelowFloorNotice(currentVersion, minVersion) {
|
|
84
|
-
return (`Your testsprite-cli (${currentVersion}) is below the minimum supported version ${minVersion}. ` +
|
|
85
|
+
return (`Your testsprite-cli (${currentVersion}) is below the minimum supported version ${terminalSafeLine(minVersion)}. ` +
|
|
85
86
|
`Upgrade: npm install -g @testsprite/testsprite-cli ` +
|
|
86
87
|
`(disable this notice with ${UPDATE_CHECK_OPT_OUT_ENV}=1).`);
|
|
87
88
|
}
|
|
@@ -94,7 +95,7 @@ export function formatBelowFloorNotice(currentVersion, minVersion) {
|
|
|
94
95
|
*/
|
|
95
96
|
export function formatPinnedVersionWarning(currentVersion, minVersion) {
|
|
96
97
|
return (`::warning title=TestSprite::testsprite-cli ${currentVersion} is pinned in this workflow ` +
|
|
97
|
-
`and is below the minimum supported version ${minVersion}. ` +
|
|
98
|
+
`and is below the minimum supported version ${terminalSafeLine(minVersion)}. ` +
|
|
98
99
|
`Regenerate with testsprite ci init github --force.`);
|
|
99
100
|
}
|
|
100
101
|
/** Module-level guard: at most one below-floor advisory per process. */
|
|
@@ -121,7 +122,7 @@ export function noteServerVersion(info, deps = {}) {
|
|
|
121
122
|
if (!minVersion)
|
|
122
123
|
return;
|
|
123
124
|
const currentVersion = deps.currentVersion ?? VERSION;
|
|
124
|
-
const stderr = deps.stderr
|
|
125
|
+
const stderr = terminalSafeWriter(deps.stderr);
|
|
125
126
|
stderr(inActions
|
|
126
127
|
? formatPinnedVersionWarning(currentVersion, minVersion)
|
|
127
128
|
: formatBelowFloorNotice(currentVersion, minVersion));
|
package/dist/lib/wait-exit.d.ts
CHANGED
|
@@ -8,7 +8,18 @@ import { ApiError, CLIError } from './errors.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export interface WaitMemberResult {
|
|
10
10
|
testId?: string;
|
|
11
|
+
/** The result id (wire name). Printed as `resultId`. */
|
|
12
|
+
resultId?: string;
|
|
13
|
+
/** The launch the result belongs to (wire name); absent on an older backend. Printed as `runId`. */
|
|
11
14
|
runId?: string;
|
|
15
|
+
/** True for a run this invocation joined instead of starting; see `RunRef.joined`. */
|
|
16
|
+
joined?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* What happened when the CLI tried to stop this run (a tunnel run it stopped
|
|
19
|
+
* waiting for). `'cancelled'` means the result is cancelled: result lists
|
|
20
|
+
* leave it out, so a later lookup has to name the result itself.
|
|
21
|
+
*/
|
|
22
|
+
cancel?: string;
|
|
12
23
|
status: string;
|
|
13
24
|
error?: {
|
|
14
25
|
code: string;
|
|
@@ -24,10 +35,34 @@ export interface WaitMemberResult {
|
|
|
24
35
|
export declare function waitMemberError(err: ApiError): NonNullable<WaitMemberResult['error']> & {
|
|
25
36
|
exitCode: number;
|
|
26
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Exit-code precedence for a `--wait` fan-out, highest first. Ordered
|
|
40
|
+
* batch-wide-non-retriable → per-run → transient → timeout → generic:
|
|
41
|
+
* - auth (3) and CLIENT_TOO_OLD (14): a bad credential / too-old client fails
|
|
42
|
+
* EVERY poll and retrying can never succeed — batch-wide, so they top the
|
|
43
|
+
* table (a transient `RATE_LIMITED` "retry later" must never outrank them).
|
|
44
|
+
* - INSUFFICIENT_CREDITS (12) / FEATURE_GATED (13): per-run, non-retriable.
|
|
45
|
+
* - NOT_FOUND (4) / VALIDATION_ERROR (5) / CONFLICT (6): per-run.
|
|
46
|
+
* - RATE_LIMITED (11) / UNAVAILABLE (10): transient — a retry may help.
|
|
47
|
+
* - timeout (7): outranks only a generic failure.
|
|
48
|
+
* - generic (1): the floor (genuine test-fail / INTERNAL).
|
|
49
|
+
* A code NOT in this table folds into the generic bucket (never surfaced as an
|
|
50
|
+
* operational error), so an out-of-contract exit (0, 99, a leaked signal code)
|
|
51
|
+
* can neither preempt a real verdict nor produce a printed-failure-green-exit.
|
|
52
|
+
*/
|
|
53
|
+
export declare const WAIT_EXIT_PRIORITY: readonly [3, 14, 12, 13, 4, 5, 6, 11, 10, 7, 1];
|
|
54
|
+
/**
|
|
55
|
+
* How to get back to results a wait let go of while they may still be
|
|
56
|
+
* running: `run wait` / `run cancel` take the launch, so each launch is
|
|
57
|
+
* named once. A result the CLI cancelled (an owned tunnel's, when the wait
|
|
58
|
+
* gave up) cannot be resumed: it is looked up itself. With no launch id from
|
|
59
|
+
* the backend neither command can be given; what can still be looked up is
|
|
60
|
+
* each test's own results.
|
|
61
|
+
*/
|
|
62
|
+
export declare function unfinishedHint(rows: readonly WaitMemberResult[]): string;
|
|
27
63
|
/**
|
|
28
64
|
* Resolve the process-level failure for a completed `--wait` fan-out, or `null`
|
|
29
|
-
* when every member passed. Shared by `
|
|
30
|
-
* `testlist run` so their exit-code semantics can't drift.
|
|
65
|
+
* when every member passed. Shared by `run --project` and `run --testlist` so their exit-code semantics can't drift.
|
|
31
66
|
*
|
|
32
67
|
* Precedence (see {@link WAIT_EXIT_PRIORITY}): auth / client-too-old → typed
|
|
33
68
|
* operational ApiError → timeout (7) → generic test-failure (1).
|
package/dist/lib/wait-exit.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApiError, CLIError, isAuthCode, isErrorCode } from './errors.js';
|
|
2
2
|
import { classifyBillingRefusal, isPausedReason } from './billing-refusal.js';
|
|
3
|
+
import { cancelCommand, checkLaterHint, launchIds, resultCount, waitCommand, } from './run-render.js';
|
|
3
4
|
/**
|
|
4
5
|
* Envelope metadata for a billing/feature-gate member error, keyed by the
|
|
5
6
|
* IDENTITY of the object `waitMemberError` returns. The enumerable shape of
|
|
@@ -13,7 +14,8 @@ import { classifyBillingRefusal, isPausedReason } from './billing-refusal.js';
|
|
|
13
14
|
*/
|
|
14
15
|
const memberEnvelopeMeta = new WeakMap();
|
|
15
16
|
export function waitMemberError(err) {
|
|
16
|
-
const
|
|
17
|
+
const { message } = err;
|
|
18
|
+
const memberError = { code: err.code, message, exitCode: err.exitCode };
|
|
17
19
|
if (err.code === 'FEATURE_GATED' || classifyBillingRefusal(err)) {
|
|
18
20
|
memberEnvelopeMeta.set(memberError, {
|
|
19
21
|
nextAction: err.nextAction,
|
|
@@ -57,7 +59,7 @@ function memberMeta(error) {
|
|
|
57
59
|
* operational error), so an out-of-contract exit (0, 99, a leaked signal code)
|
|
58
60
|
* can neither preempt a real verdict nor produce a printed-failure-green-exit.
|
|
59
61
|
*/
|
|
60
|
-
const WAIT_EXIT_PRIORITY = [3, 14, 12, 13, 4, 5, 6, 11, 10, 7, 1];
|
|
62
|
+
export const WAIT_EXIT_PRIORITY = [3, 14, 12, 13, 4, 5, 6, 11, 10, 7, 1];
|
|
61
63
|
/**
|
|
62
64
|
* A "typed operational" code is one that sits in the precedence table above the
|
|
63
65
|
* generic floor — known AND not the generic `1`. Everything else (unknown
|
|
@@ -74,10 +76,32 @@ function isOperationalCode(exitCode) {
|
|
|
74
76
|
function priorityOf(exitCode) {
|
|
75
77
|
return WAIT_EXIT_PRIORITY.indexOf(exitCode);
|
|
76
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* How to get back to results a wait let go of while they may still be
|
|
81
|
+
* running: `run wait` / `run cancel` take the launch, so each launch is
|
|
82
|
+
* named once. A result the CLI cancelled (an owned tunnel's, when the wait
|
|
83
|
+
* gave up) cannot be resumed: it is looked up itself. With no launch id from
|
|
84
|
+
* the backend neither command can be given; what can still be looked up is
|
|
85
|
+
* each test's own results.
|
|
86
|
+
*/
|
|
87
|
+
export function unfinishedHint(rows) {
|
|
88
|
+
const cancelled = rows.filter(r => r.cancel === 'cancelled');
|
|
89
|
+
const live = rows.filter(r => r.cancel !== 'cancelled');
|
|
90
|
+
const resume = waitCommand(live);
|
|
91
|
+
const cancel = cancelCommand(live);
|
|
92
|
+
const resumable = resume !== undefined && cancel !== undefined;
|
|
93
|
+
const later = checkLaterHint([...cancelled, ...(resumable ? [] : live)].map(r => ({
|
|
94
|
+
testId: r.testId,
|
|
95
|
+
resultId: r.resultId,
|
|
96
|
+
byResult: r.cancel === 'cancelled',
|
|
97
|
+
})));
|
|
98
|
+
return [...(resumable ? [`Resume: ${resume}`, `Cancel: ${cancel}`] : []), later]
|
|
99
|
+
.filter(line => line.length > 0)
|
|
100
|
+
.join('\n');
|
|
101
|
+
}
|
|
77
102
|
/**
|
|
78
103
|
* Resolve the process-level failure for a completed `--wait` fan-out, or `null`
|
|
79
|
-
* when every member passed. Shared by `
|
|
80
|
-
* `testlist run` so their exit-code semantics can't drift.
|
|
104
|
+
* when every member passed. Shared by `run --project` and `run --testlist` so their exit-code semantics can't drift.
|
|
81
105
|
*
|
|
82
106
|
* Precedence (see {@link WAIT_EXIT_PRIORITY}): auth / client-too-old → typed
|
|
83
107
|
* operational ApiError → timeout (7) → generic test-failure (1).
|
|
@@ -85,18 +109,19 @@ function priorityOf(exitCode) {
|
|
|
85
109
|
export function resolveWaitFailure(results, opts) {
|
|
86
110
|
const timedOut = results.filter(r => r.status === 'timeout');
|
|
87
111
|
const errored = results.filter((r) => r.status === 'error' && r.error !== undefined);
|
|
88
|
-
|
|
89
|
-
// timeout/typed-error members above.
|
|
90
|
-
const failed = results.filter(r => r.status !== 'passed' && r.status !== 'timeout' && !(r.status === 'error' && r.error));
|
|
91
|
-
// How many runs did NOT pass — used for the auth failure count so the message
|
|
92
|
-
// agrees with the "N failed/blocked" summary printed just above it.
|
|
93
|
-
const notPassed = results.filter(r => r.status !== 'passed').length;
|
|
112
|
+
const nonPassed = results.filter(r => r.status !== 'passed');
|
|
94
113
|
// 1) Auth wins over everything — the credential is bad, not the test.
|
|
95
114
|
// Classified via the single `isAuthCode` source (derived from `exitCodeFor`)
|
|
96
115
|
// rather than a local `=== 3` so a future AUTH_* code can't be missed here.
|
|
97
116
|
const authErr = errored.find(r => isAuthCode(r.error.code));
|
|
98
117
|
if (authErr) {
|
|
99
|
-
return new CLIError(`${
|
|
118
|
+
return new CLIError(`${resultCount(nonPassed.length)} did not pass — auth error (${authErr.error.code}): ${authErr.error.message}`, 3,
|
|
119
|
+
// Carry the member's real catalog code (AUTH_REQUIRED / AUTH_INVALID /
|
|
120
|
+
// AUTH_FORBIDDEN — `isAuthCode` above guarantees one of them) so the
|
|
121
|
+
// JSON envelope's `error.code` and telemetry's `errorCode` classify
|
|
122
|
+
// this as auth instead of falling into the generic 'CLI_ERROR'
|
|
123
|
+
// bucket — agreeing with the exit code and the message.
|
|
124
|
+
authErr.error.code);
|
|
100
125
|
}
|
|
101
126
|
// 2) Any other typed operational ApiError, highest-priority first. Only codes
|
|
102
127
|
// IN the precedence table qualify — an unknown / out-of-contract code folds
|
|
@@ -121,10 +146,10 @@ export function resolveWaitFailure(results, opts) {
|
|
|
121
146
|
if (operational) {
|
|
122
147
|
const meta = memberMeta(operational.error);
|
|
123
148
|
if (meta.details && isErrorCode(operational.error.code)) {
|
|
124
|
-
// Merge the server's own details with the local
|
|
125
|
-
//
|
|
126
|
-
//
|
|
127
|
-
//
|
|
149
|
+
// Merge the server's own details with the local ids (never the reverse)
|
|
150
|
+
// so automation reading `error.details.resultId`/`testId` keeps working
|
|
151
|
+
// for a billing refusal exactly as it does for any other typed error,
|
|
152
|
+
// while `reason` (billing_hold / rollout / …) survives untouched.
|
|
128
153
|
return new ApiError({
|
|
129
154
|
code: operational.error.code,
|
|
130
155
|
message: operational.error.message,
|
|
@@ -132,43 +157,76 @@ export function resolveWaitFailure(results, opts) {
|
|
|
132
157
|
requestId: meta.requestId ?? 'local',
|
|
133
158
|
details: {
|
|
134
159
|
...meta.details,
|
|
135
|
-
runId: operational.runId
|
|
160
|
+
...(operational.runId ? { runId: operational.runId } : {}),
|
|
161
|
+
resultId: operational.resultId ?? null,
|
|
136
162
|
testId: operational.testId ?? null,
|
|
137
163
|
},
|
|
138
164
|
}, undefined, undefined, meta.apiUrl, meta.serverNextAction);
|
|
139
165
|
}
|
|
166
|
+
// An outage that outlasted --timeout (UNAVAILABLE): the results not seen
|
|
167
|
+
// to finish keep executing, and billing, so the hint re-attaches to their
|
|
168
|
+
// runs. Without it the exit-10 advice is to retry, which starts and bills
|
|
169
|
+
// a second batch beside the first.
|
|
170
|
+
const unreachable = operational.error.code === 'UNAVAILABLE';
|
|
140
171
|
return ApiError.fromEnvelope({
|
|
141
172
|
error: {
|
|
142
173
|
code: operational.error.code,
|
|
143
174
|
message: operational.error.message,
|
|
144
|
-
nextAction:
|
|
175
|
+
nextAction: unreachable
|
|
176
|
+
? unfinishedHint(results.filter(r => r.status === 'timeout' ||
|
|
177
|
+
(r.status === 'error' && r.error?.code === 'UNAVAILABLE')))
|
|
178
|
+
: '',
|
|
145
179
|
requestId: 'local',
|
|
146
|
-
details: {
|
|
180
|
+
details: {
|
|
181
|
+
...(operational.runId ? { runId: operational.runId } : {}),
|
|
182
|
+
resultId: operational.resultId ?? null,
|
|
183
|
+
testId: operational.testId ?? null,
|
|
184
|
+
},
|
|
147
185
|
},
|
|
148
186
|
});
|
|
149
187
|
}
|
|
150
188
|
// 3) Timeout — outranks a generic failure so the operator gets resume/cancel
|
|
151
189
|
// guidance for the runs that didn't finish.
|
|
152
190
|
if (timedOut.length > 0) {
|
|
153
|
-
const
|
|
191
|
+
const resultIds = timedOut.map(r => r.resultId).filter((id) => Boolean(id));
|
|
192
|
+
const live = timedOut.filter(r => r.cancel !== 'cancelled');
|
|
193
|
+
const launches = launchIds(live);
|
|
194
|
+
const n = timedOut.length;
|
|
154
195
|
return ApiError.fromEnvelope({
|
|
155
196
|
error: {
|
|
156
197
|
code: 'UNSUPPORTED',
|
|
157
|
-
message:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
].join('\n'),
|
|
198
|
+
message: live.length === 0
|
|
199
|
+
? `${resultCount(n)} timed out and ${n === 1 ? 'was' : 'were'} cancelled.`
|
|
200
|
+
: `${resultCount(n)} timed out.`,
|
|
201
|
+
nextAction: unfinishedHint(timedOut),
|
|
162
202
|
requestId: 'local',
|
|
163
|
-
details: {
|
|
203
|
+
details: {
|
|
204
|
+
// The runs to resume, under the keys `run wait`'s own timeout uses.
|
|
205
|
+
runId: launches.length === 1 ? launches[0] : null,
|
|
206
|
+
runIds: launches,
|
|
207
|
+
timedOutResultIds: resultIds,
|
|
208
|
+
timeoutSeconds: opts.timeoutSeconds,
|
|
209
|
+
},
|
|
164
210
|
},
|
|
165
211
|
});
|
|
166
212
|
}
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
213
|
+
// The remaining rows are result verdicts or generic errors. Multiple
|
|
214
|
+
// results can belong to the same run.
|
|
215
|
+
if (nonPassed.length > 0) {
|
|
216
|
+
const failed = nonPassed.filter(row => row.status === 'failed').length;
|
|
217
|
+
const subject = resultCount(nonPassed.length);
|
|
218
|
+
if (failed === nonPassed.length)
|
|
219
|
+
return new CLIError(`${subject} failed.`, 1);
|
|
220
|
+
const blocked = nonPassed.filter(row => row.status === 'blocked').length;
|
|
221
|
+
const cancelled = nonPassed.filter(row => row.status === 'cancelled').length;
|
|
222
|
+
const other = nonPassed.length - failed - blocked - cancelled;
|
|
223
|
+
const detail = [
|
|
224
|
+
...(failed ? [`${failed} failed`] : []),
|
|
225
|
+
...(blocked ? [`${blocked} blocked`] : []),
|
|
226
|
+
...(cancelled ? [`${cancelled} cancelled`] : []),
|
|
227
|
+
...(other ? [`${other} unresolved`] : []),
|
|
228
|
+
].join(', ');
|
|
229
|
+
return new CLIError(`${subject} did not pass (${detail}).`, 1);
|
|
172
230
|
}
|
|
173
231
|
return null;
|
|
174
232
|
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workspace's billing standing, as `GET /me` reports it under
|
|
3
|
+
* `activeOrg.workspace` (backend `WorkspaceGateService.status`). `state` is
|
|
4
|
+
* what the FE banners key on; `notice` is the refusal every write will get
|
|
5
|
+
* while the workspace is paused, already worded — it is null while the
|
|
6
|
+
* workspace can be written to.
|
|
7
|
+
*/
|
|
8
|
+
import { terminalSafeLine } from './terminal-text.js';
|
|
1
9
|
/**
|
|
2
10
|
* One line for the text renderers (`auth status`, `usage`) — undefined when
|
|
3
11
|
* the workspace is simply on its plan, so the callers print nothing then.
|
|
@@ -7,9 +15,9 @@ export function formatWorkspaceStatus(ws) {
|
|
|
7
15
|
if (!ws || ws.state === 'ok')
|
|
8
16
|
return undefined;
|
|
9
17
|
if (ws.notice)
|
|
10
|
-
return `${ws.state} — ${ws.notice.message} ${ws.notice.cta}: ${ws.notice.billingUrl}`;
|
|
18
|
+
return `${terminalSafeLine(ws.state)} — ${terminalSafeLine(ws.notice.message)} ${terminalSafeLine(ws.notice.cta)}: ${terminalSafeLine(ws.notice.billingUrl)}`;
|
|
11
19
|
if (ws.state === 'pending')
|
|
12
20
|
return 'pending — a scheduled plan change or a payment retry is in progress; the workspace keeps working meanwhile';
|
|
13
|
-
return ws.state;
|
|
21
|
+
return terminalSafeLine(ws.state);
|
|
14
22
|
}
|
|
15
23
|
//# sourceMappingURL=workspace-status.js.map
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.17.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testsprite/testsprite-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Official TestSprite command-line interface",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
12
|
"skills",
|
|
13
|
-
"schemas",
|
|
14
13
|
"!dist/**/*.map"
|
|
15
14
|
],
|
|
16
15
|
"scripts": {
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
"dependencies": {
|
|
62
61
|
"@llmcode/yamux-ts": "0.0.2",
|
|
63
62
|
"commander": "^12.1.0",
|
|
64
|
-
"undici": "^7.
|
|
63
|
+
"undici": "^7.30.1",
|
|
65
64
|
"valibot": "^1.4.1"
|
|
66
65
|
},
|
|
67
66
|
"devDependencies": {
|
|
@@ -71,7 +70,7 @@
|
|
|
71
70
|
"ajv": "^8.20.0",
|
|
72
71
|
"eslint": "^10.7.0",
|
|
73
72
|
"eslint-config-prettier": "^9.1.0",
|
|
74
|
-
"eslint-plugin-security": "4.
|
|
73
|
+
"eslint-plugin-security": "4.2.1",
|
|
75
74
|
"globals": "^17.7.0",
|
|
76
75
|
"msw": "^2.14.3",
|
|
77
76
|
"prettier": "^3.3.3",
|
|
@@ -38,17 +38,28 @@ Decide from configuration. Read `.github/workflows/` and the repo root, in this
|
|
|
38
38
|
- No workflow deploys, and `vercel.json` / `.vercel/` / `netlify.toml` or the platform's
|
|
39
39
|
git integration is present: **A — the platform deploys every PR**. Trigger:
|
|
40
40
|
`on: deployment_status`.
|
|
41
|
+
- The platform is connected but writes **no deployment**, only a status or check on
|
|
42
|
+
the PR (Vercel with its `deployment_status` events switched off, Cloudflare Pages):
|
|
43
|
+
**C — wait for the check and derive the URL**. Trigger: `on: pull_request`.
|
|
41
44
|
- Neither is clear: ask the user who deploys their pull-request previews.
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
Tell A from C on a recent pull request (`<sha>` = its head commit):
|
|
44
47
|
|
|
45
48
|
```bash
|
|
46
|
-
gh api repos/{owner}/{repo}/deployments --jq '
|
|
49
|
+
gh api "repos/{owner}/{repo}/deployments?sha=<sha>" --jq 'length' # > 0 → A
|
|
50
|
+
gh api repos/{owner}/{repo}/commits/<sha>/status --jq '.statuses[].context' # the status name → C
|
|
51
|
+
gh api repos/{owner}/{repo}/commits/<sha>/check-runs --jq '.check_runs[].name' # or the check name → C
|
|
52
|
+
gh api repos/{owner}/{repo}/issues/<pr>/comments --jq '.[].body' | grep -o 'https://[a-z0-9.-]*' # the preview URL
|
|
47
53
|
```
|
|
48
54
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
For C, turn the URL the platform's bot posted into a pattern by replacing the per-PR
|
|
56
|
+
part: Vercel `https://<project>-git-{branch-slug}-<team>.vercel.app`, Cloudflare Pages
|
|
57
|
+
`https://{branch-slug}.<project>.pages.dev`, Netlify
|
|
58
|
+
`https://deploy-preview-{pr}--<site>.netlify.app` (`{branch-slug}` = the branch
|
|
59
|
+
lowercased, runs of other characters → `-`). Then `curl -sI` the real URL: a `302` to
|
|
60
|
+
`vercel.com/sso-api` is Deployment Protection — the user must disable it for previews
|
|
61
|
+
or create a Protection Bypass secret first. History is evidence, not configuration —
|
|
62
|
+
the proof is a real pull request (step 5).
|
|
52
63
|
|
|
53
64
|
Not linked but the user wants A: connect the repository to the platform's git
|
|
54
65
|
integration (Vercel: project → Settings → Git, or `npx vercel git connect` with the
|
|
@@ -82,13 +93,20 @@ This writes `.github/workflows/testsprite.yml` with one step marked `REPLACE ME`
|
|
|
82
93
|
- **B:** replace the placeholder's `run:` with the deploy commands, ending in
|
|
83
94
|
`echo "url=<preview address>" >> "$GITHUB_OUTPUT"`. The platform token goes in its
|
|
84
95
|
own repo secret.
|
|
96
|
+
- **C:** keep `pull_request:`, delete the placeholder step, add
|
|
97
|
+
`statuses: read` and `checks: read` under `permissions:`, and extend the `ci run`
|
|
98
|
+
line with `--wait-for-status "<name from step 1>" --target-url-template "<pattern>"`
|
|
99
|
+
(drop `--target-url "$PREVIEW_URL"`). `ci run` polls the status/check for up to
|
|
100
|
+
`--status-timeout` (default 900 s), skips with exit 0 when the build failed or was
|
|
101
|
+
ignored, and refuses a pattern it cannot fill — never a production fallback.
|
|
85
102
|
|
|
86
103
|
Keep what the template fixes: `testsprite ci run … --target-url "$PREVIEW_URL"
|
|
87
104
|
--fail-on-skipped --summary-file`, `npm i -g @testsprite/testsprite-cli@latest` (no
|
|
88
|
-
version pin — verdicts come from the backend), fork and draft PRs skipped,
|
|
89
|
-
step on `if: always()`, and `concurrency` on the **job** (keyed by
|
|
90
|
-
commit in A). Never re-judge pass/fail
|
|
91
|
-
is the gate. Regenerate with `--force`;
|
|
105
|
+
version pin — verdicts come from the backend), fork, Dependabot and draft PRs skipped,
|
|
106
|
+
the upload step on `if: always()`, and `concurrency` on the **job** (keyed by the
|
|
107
|
+
workflow's filename plus the PR number in B, the commit in A). Never re-judge pass/fail
|
|
108
|
+
in YAML (`jq` + `exit 1`): `ci run`'s exit code is the gate. Regenerate with `--force`;
|
|
109
|
+
the previous file is kept as `.bak`.
|
|
92
110
|
|
|
93
111
|
## 4. Secrets
|
|
94
112
|
|
|
@@ -113,7 +131,7 @@ actionlint .github/workflows/testsprite.yml # the file parses — or `gh wor
|
|
|
113
131
|
|
|
114
132
|
Commit and push the workflow on a branch, open a PR that is **not a draft** and has
|
|
115
133
|
**no merge conflicts**, and watch the `TestSprite / testsprite-tests` check. The log shows
|
|
116
|
-
`Dispatched N tests
|
|
134
|
+
`Dispatched N tests.`, `Run <runId>`, then `CI run: x/y passed …`; the job summary is the execution
|
|
117
135
|
report (the same content as the App's PR comment); a `testsprite-results` artifact
|
|
118
136
|
holds `testsprite-summary.json`. Then suggest making the check **required** in branch
|
|
119
137
|
protection. In shape A the workflow file runs **at the deployed commit**, so the PR
|
|
@@ -132,15 +150,26 @@ deployments are filtered out by the `if:`).
|
|
|
132
150
|
|
|
133
151
|
- The check is `ci run`'s exit code: 1 = a test failed, 7 = timeout or an unsupported
|
|
134
152
|
backend, 5 = configuration. A summary opening with a **CI gate** warning means the
|
|
135
|
-
CLI's own counts differ from the report (a
|
|
136
|
-
check is right, the report is the server's view of the
|
|
137
|
-
- `exit 7` with "did not confirm the single-
|
|
138
|
-
too old for `ci run`; the dispatched
|
|
139
|
-
-
|
|
153
|
+
CLI's own counts differ from the report (a test result it could not read, a timeout) —
|
|
154
|
+
the check is right, the report is the server's view of the run.
|
|
155
|
+
- `exit 7` with "did not confirm the single-run admission mode" = the backend is
|
|
156
|
+
too old for `ci run`; the dispatched tests were cancelled (the server attempts a refund).
|
|
157
|
+
- `exit 5` with `target-protected` = the preview is behind Vercel Deployment Protection,
|
|
158
|
+
so nothing was dispatched. Ask the user to turn off Vercel Authentication for previews,
|
|
159
|
+
or to add a Protection Bypass for Automation secret as a repo secret and append
|
|
160
|
+
`?x-vercel-protection-bypass=<secret>&x-vercel-set-bypass-cookie=true` to the URL.
|
|
161
|
+
- Screenshots in the report are capped at 12 per run; later rows show `—`.
|
|
140
162
|
- Shape A is per commit: a new push starts its own run against its own preview, and
|
|
141
|
-
cancelling the job only stops the CLI — the
|
|
142
|
-
|
|
143
|
-
-
|
|
163
|
+
cancelling the job only stops the CLI — the run keeps running and reports in the
|
|
164
|
+
Portal.
|
|
165
|
+
- Shape C: `No preview for this commit — tests not run` with exit 0 means the platform's
|
|
166
|
+
check failed or the build was ignored — not a TestSprite problem; `exit 7` naming the
|
|
167
|
+
checks it saw means `--wait-for-status` has the wrong name — copy one from that list.
|
|
168
|
+
- Backend tests follow `--target-url` only where their code reads the base URL from
|
|
169
|
+
`VAR_{url}` (`BASE_URL = "VAR_{url}"`, replaced server-side with the run's environment
|
|
170
|
+
URL) — which in a pull request is the preview, because `ci run --env X --target-url U`
|
|
171
|
+
runs in a `github-pr-<N>` clone of X at U. Outside a pull request they use the environment's
|
|
172
|
+
own URL (`--env`'s, or the default's). A hard-coded URL is left as is and always tests that address.
|
|
144
173
|
- Testing `ci run` locally: a shell that exports `TESTSPRITE_API_URL` or
|
|
145
174
|
`TESTSPRITE_API_KEY` overrides `--profile` — a `fetch failed` against a healthy API is
|
|
146
175
|
usually that. Check `env | grep TESTSPRITE_` first.
|
|
@@ -151,4 +180,5 @@ deployments are filtered out by the `if:`).
|
|
|
151
180
|
- Don't run `vercel link --yes`; don't pass secrets as arguments.
|
|
152
181
|
- Don't pin the CLI version in the workflow; don't parse the summary to decide the verdict.
|
|
153
182
|
- Don't commit a loopback or private `--target-url` (`ci run` refuses it).
|
|
183
|
+
- Don't script a production fallback for a missing preview; `ci run` skips, on purpose.
|
|
154
184
|
- Don't skip step 5: a workflow that has not run on a real PR is not onboarded.
|