From 8c64eea1f8e0592f4631bd34d7b76bc91bc6541c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Thu, 6 Feb 2020 12:23:19 +0000 Subject: [PATCH] fix(tests): try to get code coverage from all packages --- Makefile | 4 +--- scripts/gocover.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100755 scripts/gocover.sh 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