Skip to content

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

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

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

CLAassistant commented May 16, 2026 •

Copy link
Copy Markdown

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!

@rtk-release-bot

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet.

@rtk-release-bot rtk-release-bot Bot added the stale label Sep 3, 2026
@rtk-release-bot

Copy link
Copy Markdown
Contributor

Closing this pull request after a prolonged period of inactivity. If this is still relevant, please ask for it to be reopened. Thank you!

@rtk-release-bot rtk-release-bot Bot closed this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants