diff --git a/Makefile b/Makefile index c7c3a4908..5a7c1eac4 100644 --- a/Makefile +++ b/Makefile @@ -167,9 +167,7 @@ benchmark-go: .PHONY: test-go test-go: - GO111MODULE=on go test \ - -cover -coverprofile=coverage.txt -covermode=atomic \ - ./... + GO111MODULE=on scripts/gocover.sh .PHONY: test-js test-js: .build/deps-build-node.ok diff --git a/scripts/gocover.sh b/scripts/gocover.sh new file mode 100755 index 000000000..fd991473d --- /dev/null +++ b/scripts/gocover.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e + +echo "" > coverage.txt + +for d in $(go list ./... | grep -v github.com/prymitive/karma/internal/mapper); do + go test \ + -coverprofile=profile.out \ + -coverpkg=$(go list ./... | grep -v github.com/prymitive/karma/internal/mapper | tr '\n' ',') \ + $d 2>&1 | grep -v 'warning: no packages being tested depend on matches for pattern' + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done