Skip to content

Commit 6474015

Browse files
committed
fix test coverage check
1 parent a037c1c commit 6474015

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

wasp/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test_race:
88

99
.PHONY: test_benchspy_race
1010
test_benchspy_race:
11-
go test -v -race -coverprofile cover.out -count 1 `go list ./... | grep -v examples | grep benchspy` -run TestBenchSpy
11+
@./scripts/run_benchspy_tests.sh
1212

1313
.PHONY: test_bench
1414
test_bench:

wasp/scripts/run_benchspy_tests.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
go test -v -race -coverprofile cover.out -count 1 `go list ./... | grep -v examples | grep benchspy` -run TestBenchSpy
4+
coverage=$(go tool cover -func=cover.out | grep total | awk '{print substr($3, 1, length($3)-1)}')
5+
if [ -z "$coverage" ]; then
6+
echo "Error: Could not determine test coverage";
7+
exit 1
8+
fi
9+
10+
if [[ $(echo "$coverage < 85" | bc -l) -eq 1 ]]; then
11+
echo "Test coverage $coverage% is below minimum 85%"
12+
exit 1
13+
fi
14+
echo "Test coverage: $coverage%"

0 commit comments

Comments
 (0)