Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #77 from Shopify/show_coverage
Browse files Browse the repository at this point in the history
Add a rule in makefile to show coverage in HTML format
  • Loading branch information
klautcomputing authored Jan 5, 2018
2 parents ecd2c49 + 8001fe9 commit e28a609
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ install:
test:
./test.sh

show-coverage: test
go tool cover -html=coverage.txt

clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
Expand Down
4 changes: 2 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash

set -e
echo "" > coverage.txt
touch coverage.txt

for d in $(go list ./... | grep -v vendor); do
go test -race -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
cat profile.out > coverage.txt
rm profile.out
fi
done

0 comments on commit e28a609

Please sign in to comment.