Skip to content

Commit ac67ed4

Browse files
VanillaSpoonanishasthana
authored andcommitted
refactor: coverage report generation to test target
1 parent 024ed5d commit ac67ed4

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,17 @@ test: manifests generate fmt vet envtest ## Run tests.
7878
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
7979
grep -v -e "_moq.go" cover.out > coverage.out
8080

81-
test/output/coverage/report:
82-
@if [ -f coverage.out ]; then $(GO) tool cover -func=coverage.out; else echo "coverage.out file not found"; fi;
83-
.PHONY: test/output/coverage/report
81+
coverage.out: test
8482

85-
test/html/coverage/report:
86-
@if [ -f coverage.out ]; then $(GO) tool cover -html=coverage.out; else echo "coverage.out file not found"; fi;
87-
.PHONY: test/html/coverage/report
83+
coverage-report: coverage.out
84+
$(GO) tool cover -func=coverage.out
85+
.PHONY: coverage-report
8886

89-
##@ Build
87+
html-coverage-report: coverage.out
88+
$(GO) tool cover -html=coverage.out
89+
.PHONY: html-coverage-report
9090

91+
##@ Build
9192
.PHONY: build
9293
build: generate fmt vet ## Build manager binary.
9394
go build -o bin/manager main.go

0 commit comments

Comments
 (0)