Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ test: go::test go::docs-check bats::test
| `unit` | Run unit tests |
| `unit-int` | Run integration tests (requires running service) |
| `unit-cov` | Run tests with coverage |
| `unit-cov-gaps` | Coverage gaps only with HTML heatmap |
| `unit-cov-map` | Coverage with HTML heatmap |
| `test` | Run all checks (mod, fmt, vet, coverage) |
| `fmt` | Auto-format with gofumpt + golines |
Expand Down
10 changes: 10 additions & 0 deletions go.just
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ unit-cov: _cov-deps
go tool github.com/boumenot/gocover-cobertura < {{ coverage_dir }}/cover.out > {{ coverage_dir }}/cobertura.xml
go tool cover -func={{ coverage_dir }}/cover.out

# Show files without 100% coverage and open heatmap of only those files
[group('test')]
unit-cov-gaps: unit-cov
#!/usr/bin/env bash
set -euo pipefail
gap_files=$(go tool cover -func={{ coverage_dir }}/cover.out | grep -v '100.0%' | grep -v '^total:' | awk -F: '{print $1}' | sort -u)
if [ -z "$gap_files" ]; then echo "No coverage gaps found."; exit 0; fi
{ head -1 {{ coverage_dir }}/cover.out; grep -F -f <(echo "$gap_files") {{ coverage_dir }}/cover.out; } > {{ coverage_dir }}/gaps.out
go tool cover -html={{ coverage_dir }}/gaps.out

# Generate coverage and show heatmap
[group('test')]
unit-cov-map: unit-cov
Expand Down
Loading