Better coverage output, removing unnecessary unit scripts.

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
This commit is contained in:
Silvin Lubecki 2019-01-28 10:27:35 +01:00
parent 3bd3996f72
commit 277f61415e
3 changed files with 3 additions and 27 deletions

View File

@ -11,15 +11,15 @@ clean: ## remove build artifacts
rm -rf ./build/* cli/winresources/rsrc_* ./man/man[1-9] docs/yaml/gen rm -rf ./build/* cli/winresources/rsrc_* ./man/man[1-9] docs/yaml/gen
.PHONY: test-unit .PHONY: test-unit
test-unit: ## run unit test test-unit: ## run unit tests, to change the output format use: GOTESTSUM_FORMAT=(dots|short|standard-quiet|short-verbose|standard-verbose) make test-unit
./scripts/test/unit $(shell go list ./... | grep -vE '/vendor/|/e2e/') gotestsum -- $(shell go list ./... | grep -vE '/vendor/|/e2e/')
.PHONY: test .PHONY: test
test: test-unit ## run tests test: test-unit ## run tests
.PHONY: test-coverage .PHONY: test-coverage
test-coverage: ## run test coverage test-coverage: ## run test coverage
./scripts/test/unit-with-coverage $(shell go list ./... | grep -vE '/vendor/|/e2e/') gotestsum -- -coverprofile=coverage.txt $(shell go list ./... | grep -vE '/vendor/|/e2e/')
.PHONY: fmt .PHONY: fmt
fmt: fmt:

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
set -eu -o pipefail
gotestsum -- "$@"

View File

@ -1,20 +0,0 @@
#!/usr/bin/env bash
set -eu -o pipefail
# install test dependencies once before running tests for each package. This
# reduces the runtime from 200s down to 23s
go test -i "$@"
echo "mode: atomic" > coverage.txt
for pkg in "$@"; do
./scripts/test/unit \
-cover \
-coverprofile=profile.out \
-covermode=atomic \
"${pkg}"
if test -f profile.out; then
grep -v "^mode:" < profile.out >> coverage.txt || true
rm profile.out
fi
done