run_tests
Run the test suite for the detected project type. Go today; future plans extend the Detector interface to Node / Python / Rust.
Schema
Section titled “Schema”| Param | Type | Required | Default |
|---|---|---|---|
timeout | number | no | 300 (clamped to 1800) |
Behaviour
Section titled “Behaviour”verify.Detect(workspace root)picks the detector. No detector → error resultno supported project detected in workspace root.- Runs the detector’s
TestCmd(). For Go:go test -json -count=1 ./...— the-jsonflag emits test2json events so the companionlast_test_failurestool can surface structured failure records without re-parsing raw runner output.-count=1defeats the Go build cache so reruns actually rerun. - Executes via a shared
runVerifyCmdhelper that:Setpgid+ process-group kill on timeout (same as Bash).- Captures stdout and stderr separately.
- Caps each stream at 500 KiB with a
[TRUNCATED]marker.
- Formats output: stdout first, then
--- stderr ---section (if non-empty), then optional timeout marker, thenexit: N(always). - Parses the output through the detector’s
ParseTestFailuresmethod and stores the result in a session-scoped slot. Retrieve it vialast_test_failures. - For Go: augments the argv with
-coverprofile=<tempfile>, then parses the resulting profile into the session coverage index fortests_coveringqueries. The profile tempfile is removed after ingest. Other languages are unchanged.
Example output
Section titled “Example output”With -json, each line is a test2json event (Go projects):
{"Action":"run","Package":"example.com/my-module","Test":"TestFoo"}{"Action":"output","Package":"example.com/my-module","Test":"TestFoo","Output":"--- PASS: TestFoo\n"}{"Action":"pass","Package":"example.com/my-module","Test":"TestFoo","Elapsed":0}{"Action":"pass","Package":"example.com/my-module","Elapsed":0.123}exit: 0Agents who want the human-readable summary should call last_test_failures after run_tests; the raw JSON stream is still exposed here for debugging and for cases where an agent wants to replay the event stream itself.
Failure modes
Section titled “Failure modes”- No project detected → error result.
- Binary missing (e.g.,
gonot installed) → error result. - Non-zero exit → text result (NOT an error — test failures are legitimate results).
- Timeout → text result with
timed out after Nsmarker, exit 124.
Related
Section titled “Related”- last_test_failures — structured view of the most recent run’s failures.
- tests_covering — queries the coverage index this tool populates.
- run_lint
- run_typecheck
- Detector interface