Skip to content

Commit

Permalink
chore: correctly calculate coverage ignoring mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
smlx committed Feb 16, 2024
1 parent f14cb5a commit 9ec0c3d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: |
go test -v -covermode=atomic -coverprofile=cover.out.raw -coverpkg=./... ./...
# remove generated code from coverage calculation
grep -Ev 'mock_|_enumer.go' cover.out.raw > cover.out
grep -Ev 'internal/mock|_enumer.go' cover.out.raw > cover.out
- name: Generage coverage badge
uses: vladopajic/go-test-coverage@bcd064e5ceef1ccec5441519eb054263b6a44787 # v2.8.2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/dist
/cover.out
/cover.out.raw
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ fuzz: mod-tidy generate

.PHONY: cover
cover: mod-tidy generate
go test -v -covermode=atomic -coverprofile=cover.out -coverpkg=./... ./...
go test -v -covermode=atomic -coverprofile=cover.out.raw -coverpkg=./... ./...
grep -Ev 'internal/mock|_enumer.go' cover.out.raw > cover.out
go tool cover -html=cover.out

0 comments on commit 9ec0c3d

Please sign in to comment.