Skip to content

Commit de8d9df

Browse files
committed
make: add task to generate coverage report
1 parent 513f699 commit de8d9df

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.DS_Store
22
example/daemon/daemon
33
coverage.out
4-
coverage.tmp
4+
coverage.html

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,20 @@ format: ## Formats all Go code
1414
lint: ## Runs golangci-lint on source files
1515
golangci-lint run
1616

17+
.PHONY: coverage.out
18+
coverage.out: $(wildcard go.*) $(wildcard **/*.go)
19+
go test -race -covermode=atomic -coverprofile=$@ ./...
20+
21+
coverage.html: coverage.out
22+
go tool cover -html $< -o $@
23+
1724
.PHONY: test
18-
test: ## Run all Go tests (excluding integration tests)
19-
go test -race -covermode=atomic -coverprofile=coverage.out ./...
25+
test: coverage.out ## Run all Go tests (excluding integration tests)
2026

2127
.PHONY: integration
2228
integration: ## Run Go tests (integration tests only)
2329
go test -race -tags=integration -covermode=atomic -coverprofile=coverage.out ./...
30+
31+
.PHONY: clean
32+
clean:
33+
rm -rf coverage.*

0 commit comments

Comments
 (0)