--output json and exit codes.
The JSON contract
--output json is machine-readable and changes only additively: new fields may appear, existing fields and exit codes won’t change within a major version. --output text may change freely, so script against JSON.
--dry-run emits canned data in the live response shape, so you can test a script before wiring up auth (see global flags):
Piping into jq
Branching on exit codes
Timeouts still leave a result
On a--wait timeout (exit 7) the CLI prints a partial object to stdout first, so you keep the runId:
{ "runId": "...", "status": "running" } for an ordinary run and for a --local run adopted with --tunnel-client. A run on a tunnel the CLI opened itself is cancelled by default and reports status: "cancelled"; don’t resume it. See Cancelling a Run and Exit Codes.
A local batch prints one { tunnel, maxConcurrency, results, skipped, summary } object. results lists every requested test in input order (not-run if never started); tunnel is absent if none opened; summary is { total, passed, failed, timedOut, notRun } and excludes backend tests, which appear in skipped. The --summary-file JSON differs: { total, passed, failed, skipped, timedOut, runs[] }, with not-run tests counted as skipped. See Test an app on your machine.
A minimal CI gate
testsprite agent install writes skill files that encode these patterns (Agent Integration).
Debugging a script
--verbose: retry, backoff and polling messages.--debug: HTTP method, path, request id, latency and retry decisions. The API key is never included.
--output json and under --dry-run; disable it with TESTSPRITE_NO_UPDATE_NOTIFIER=1.