1
0
Fork 0

chore: add test-coverage and test-show-coverage tasks to makefile

This commit is contained in:
Beatriz Vieira 2021-07-18 17:02:19 -03:00
parent a8139b4b26
commit 8c266a5a20

View file

@ -1,4 +1,4 @@
.PHONY: usage build test run tidy release release-all .PHONY: usage build test test-coverage test-show-coverage run tidy release release-all
OK_COLOR=\033[32;01m OK_COLOR=\033[32;01m
NO_COLOR=\033[0m NO_COLOR=\033[0m
@ -35,6 +35,16 @@ test:
@echo $(ECHOFLAGS) "$(OK_COLOR)==> Running tests...$(NO_COLOR)" @echo $(ECHOFLAGS) "$(OK_COLOR)==> Running tests...$(NO_COLOR)"
@go test $(PKGS) @go test $(PKGS)
## test-coverage: run tests with coverage
test-coverage:
@echo $(ECHOFLAGS) "$(OK_COLOR)==> Running tests with coverage...$(NO_COLOR)"
@go test -race -covermode=atomic -coverprofile coverage.out ./...
## test-show-coverage: show coverage
test-show-coverage: test-coverage
@echo $(ECHOFLAGS) "$(OK_COLOR)==> Show test coverage...$(NO_COLOR)"
@go tool cover -html coverage.out
## run: run git-sv ## run: run git-sv
run: run:
@echo $(ECHOFLAGS) "$(OK_COLOR)==> Running bin/$(BUILDOS)_$(BUILDARCH)/$(BIN)...$(NO_COLOR)" @echo $(ECHOFLAGS) "$(OK_COLOR)==> Running bin/$(BUILDOS)_$(BUILDARCH)/$(BIN)...$(NO_COLOR)"