mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-07-04 08:56:50 +00:00
Adds compulsory test coverage, fix tests
This commit is contained in:
@ -1,7 +1,23 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
go test -json -cover -coverprofile="$DIR/../coverage.out" ./internal/... | tparse
|
||||
go tool cover -html="$DIR/../coverage.out" -o "$DIR/../coverage.html"
|
||||
rm -f "$DIR/../coverage.out"
|
||||
if ! command -v go-test-coverage &>/dev/null; then
|
||||
go install github.com/vladopajic/go-test-coverage/v2@latest
|
||||
fi
|
||||
if ! command -v tparse &>/dev/null; then
|
||||
go install github.com/mfridman/tparse@latest
|
||||
fi
|
||||
|
||||
rm -f "$DIR/coverage.html"
|
||||
|
||||
trap cleanup EXIT
|
||||
cleanup() {
|
||||
rm -f "$DIR/coverage.out"
|
||||
}
|
||||
|
||||
echo "Running go test suite ..."
|
||||
go test -json -cover ./... -coverprofile="$DIR/coverage.out" | tparse
|
||||
go tool cover -html="$DIR/coverage.out" -o "$DIR/coverage.html"
|
||||
go-test-coverage -c "$DIR/.testcoverage.yml"
|
||||
|
Reference in New Issue
Block a user