run_coverage
Start an execution-coverage run for a build/test target: TestVibe clones the connected repo, builds it, runs its tests with coverage instrumentation, and ingests the resulting report into the coverage snapshot. Returns immediately; the run executes in the background.
warning
Needs a connected source repo (Settings → Source Code) and at least one detected target (run scan_coverage first). One coverage run per project at a time — a second is rejected with 409 conflict.
Request
POST /api/v1/ops/projects/{project}/coverage/run
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
project | path | string | yes | The project's public id. |
target | body | integer | no | Coverage target id (see get_coverage → targets). Optional when the project has exactly one target. |
- cURL
- CLI
- MCP
curl -X POST -H "Authorization: Bearer $TESTVIBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"target": 5}' \
"$TESTVIBE_SERVER/api/v1/ops/projects/$PROJECT/coverage/run"
testvibe coverage run --target 5 --wait
Tool run_coverage — optional project and target. Poll list_coverage_runs (or get_coverage's runActive).
Response
202 Accepted
{ "coverageRunId": 12, "targetId": 5, "status": "running" }
Poll list_coverage_runs (or get_coverage's runActive) until it leaves running.
Errors
| HTTP | When |
|---|---|
400 invalid_request | Several targets exist and no target was given. |
404 not_found | No such coverage target in this project. |
409 conflict | A coverage run is already in progress, no targets detected, or no source repository is connected. |