Skip to content

Commit

Permalink
Improve make test-coverage
Browse files Browse the repository at this point in the history
 - When run in CI, the coverage dir is missing for some reason, so
   gotestsum won't run properly

 - Emit junit output from make test-coverage
  • Loading branch information
ddl-ebrown committed May 26, 2024
1 parent 30b7d21 commit c2f8c49
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ test: fmt lint test-all
.PHONY: test-coverage
test-coverage: build ## Run all tests and generate a coverage report
$(touch .env)
gotestsum --format=pkgname-and-test-fails --format-hivis -- -covermode=count -coverpkg=./... -coverprofile=coverage/cover.out.tmp -v ./... --tags="unit"
mkdir -p $(SRC_DIR)coverage
gotestsum --format=pkgname-and-test-fails --format-hivis --junitfile test/unit-tests.xml -- -covermode=count -coverpkg=./... -coverprofile=coverage/cover.out.tmp -v ./... --tags="unit"

# Stripping out API docs and internal/app/mocks from the coverage report
cat coverage/cover.out.tmp | grep -v "api/docs.go" | grep -v "mock_" > coverage/cover.out
Expand Down

0 comments on commit c2f8c49

Please sign in to comment.