MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / triggerRun

Method triggerRun

src/lib/http.ts:234–248  ·  view source on GitHub ↗

* POST /api/cli/v1/tests/{testId}/runs * Trigger a run and return the queued-run envelope. * The caller must supply an `idempotencyKey` which is sent as the * `Idempotency-Key` header per M3.2 piece-1 §2 contract.

(
    testId: string,
    body: TriggerRunBody,
    options: { idempotencyKey: string; signal?: AbortSignal },
  )

Source from the content-addressed store, hash-verified

232 * `Idempotency-Key` header per M3.2 piece-1 §2 contract.
233 */
234 async triggerRun(
235 testId: string,
236 body: TriggerRunBody,
237 options: { idempotencyKey: string; signal?: AbortSignal },
238 ): Promise<TriggerRunResponse> {
239 return this.postWithMeta<TriggerRunResponse>(`/tests/${encodeURIComponent(testId)}/runs`, {
240 body,
241 headers: { 'idempotency-key': options.idempotencyKey },
242 signal: options.signal,
243 // 409 on POST /runs means "another run is already in flight" — a
244 // persistent condition, not a transient snapshot conflict. Retrying
245 // would enqueue a second run once the first finishes.
246 retryOnConflict: false,
247 }).then(r => r.body);
248 }
249
250 /**
251 * Like `triggerRun` but returns the full `RequestResult` so the caller

Callers 1

http.runs.spec.tsFile · 0.80

Calls 1

postWithMetaMethod · 0.95

Tested by

no test coverage detected