From dfd8145c2ad4fb8332457d866884337a825bcd46 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Mon, 26 Apr 2021 22:54:48 +0200 Subject: [PATCH] Add Makefile targets for coverage --- .gitignore | 1 + Makefile | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index c326f705e93..7cb1c45b521 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ /bin/golangci-lint /chezmoi /chezmoi.exe +/coverage.out /dist diff --git a/Makefile b/Makefile index ee4fc29eaf8..0051008e229 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,14 @@ test: $(GO) test -ldflags="-X github.com/twpayne/chezmoi/internal/chezmoitest.umaskStr=0o022" ./... $(GO) test -ldflags="-X github.com/twpayne/chezmoi/internal/chezmoitest.umaskStr=0o002" ./... +.PHONY: coverage-html +coverage-html: coverage + $(GO) tool cover -html=coverage.out + +.PHONY: coverage +coverage: + $(GO) test -test.coverprofile=coverage.out ./... + .PHONY: generate generate: completions assets/scripts/install.sh