Skip to content

fix(go): preserve coverage output from go test -cover on passing runs#1906

Open
tylern91 wants to merge 1 commit into
rtk-ai:developfrom
tylern91:fix/go-test-cover-output
Open

fix(go): preserve coverage output from go test -cover on passing runs#1906
tylern91 wants to merge 1 commit into
rtk-ai:developfrom
tylern91:fix/go-test-cover-output

Conversation

@tylern91
Copy link
Copy Markdown

Summary

  • Detect coverage: lines in filter_go_test_json() and route them to a dedicated coverage field on PackageResult, not package_fail_output
  • Append per-package coverage lines below the passing summary when present
  • Preserves the compact format for runs without -cover

Root Cause

Coverage lines arrive as package-level output JSON events (no Test field). The handler previously pushed all package-level output to package_fail_output, which is only emitted when package_failed == true. On passing runs, coverage data was silently discarded.

Output Format

Go test: 348 passed in 9 packages
  foo: coverage: 80.1% of statements
  bar: coverage: 92.3% of statements

Test plan

  • Added test_filter_go_test_cover_output_preserved() verifying coverage lines appear in passing-run output
  • cargo fmt --all && cargo clippy --all-targets && cargo test --all — 1871 passed, 0 failures
  • Runs without -cover unchanged (coverage vec empty, indented block skipped)

Closes #1765

Coverage lines arrive as package-level output events with no Test field,
causing filter_go_test_json() to route them to package_fail_output which
is only emitted on failures. Add coverage Vec<String> to PackageResult,
detect starts_with("coverage:") in the output handler, and append
per-package coverage below the passing summary line.

Closes rtk-ai#1765
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 16, 2026

CLA assistant check
All committers have signed the CLA.

@tylern91
Copy link
Copy Markdown
Author

@aeppling friendly bump when you have a chance to take a look — thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: go test -cover didn't output test coverage

2 participants