Skip to content

Commit 3b5a79a

Browse files
authored
Add total coverage to report (#1)
* Add total coverage to report Add total coverage to the generated report and output. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/teamniteo/go-coverage-report?shareId=XXXX-XXXX-XXXX-XXXX). * Fix wrong code * Update github-action.sh * Fix wrong code
1 parent c3951d5 commit 3b5a79a

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

cmd/go-coverage-report/report.go

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ func (r *Report) Markdown() string {
110110
)
111111
}
112112

113+
fmt.Fprintf(report, "| **Total** | **%.2f%%** | |\n", r.New.Percent())
114+
113115
report.WriteString("\n")
114116
r.addDetails(report)
115117

cmd/go-coverage-report/report_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ func TestReport_Markdown(t *testing.T) {
2727
| github.com/fgrosse/prioqueue | 90.20% (**-9.80%**) | :thumbsdown: |
2828
| github.com/fgrosse/prioqueue/foo/bar | 0.00% (ø) | |
2929
30+
| **Total** | **90.20%** | |
31+
3032
---
3133
3234
<details>
@@ -65,6 +67,8 @@ func TestReport_Markdown_OnlyChangedUnitTests(t *testing.T) {
6567
|-------------------|------------|---------|
6668
| github.com/fgrosse/prioqueue | 99.02% (**+8.82%**) | :thumbsup: |
6769
70+
| **Total** | **99.02%** | |
71+
6872
---
6973
7074
<details>

scripts/github-action.sh

100755100644
File mode changed.

0 commit comments

Comments
 (0)