Skip to content

Conversation

Copy link

Copilot AI commented Dec 13, 2025

Adds optional per-package coverage percentage display in the test summary table. When enabled via the coverprofile input, the action generates coverage data and displays it alongside test results.

Changes

Input handling

  • Added coverprofile input parameter to action.yml
  • Extended Inputs interface and parsing logic in inputs.ts

Coverage extraction

  • Modified runner.ts to pass -coverprofile flag when input is set
  • Updated parseTestEvents() to extract coverage from JSON output via regex: /coverage:\s*(\d+(?:\.\d+)?)%\s+of\s+statements/
  • Extended TestEvent interface with optional coverage field

Display logic

  • PackageResult stores coverage from package-level events
  • Renderer conditionally adds "📊 Coverage" column when any package has coverage data
  • Displays percentage as "X.X%" or "N/A" for packages without coverage

Usage

- uses: robherley/go-test-action@v0
  with:
    coverprofile: coverage.out

Results in:

📦 Package 🟢 Passed 🔴 Failed 🟡 Skipped ⏳ Duration 📊 Coverage
pkg/foo 5 0 0 123ms 85.5%
pkg/bar 3 0 0 45ms 92.3%
Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature] Option to add test coverage percentage to output</issue_title>
<issue_description>I currently have my tests output a covere-file to know how much Ive covered my code. It would be really cool to
1: Have an option to include that file getting generated automatically and or
2: Then parse that file for a coverage percentage to include in the top level output display data. (Passed, Failed, Skipped, Coverage% for each package/total)

It would require parsing the file to determine what percentage has been covered, but it would be helpful to know. That said, unsure if its THAT worth to spend time parsing the file.

Two asides.
1: This is the format of the output file,
<FILENAME>:<StartLine>.<StartCol>,<StopLIne>.<StopCol><Space><ReleventLines><Space><Covered/Not (1/0)>
2: There are also integration tests that have coverage support now, so it may be worth considering when implementing.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add option to include test coverage percentage in output Add coverage percentage display to test output Dec 13, 2025
Copilot AI requested a review from robherley December 13, 2025 04:55
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.

[Feature] Option to add test coverage percentage to output

2 participants