File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -292,7 +292,20 @@ test:
292
292
# # cover: Run unit test with coverage.
293
293
.PHONY : cover
294
294
cover : test
295
- @$(GO ) test -cover
295
+ @echo " Running tests with coverage..."
296
+ @$(GO ) test -coverprofile=coverage.out ./...
297
+ @echo " Checking coverage..."
298
+ @$(GO ) tool cover -func=coverage.out | grep total: | awk ' {print $$3}' | sed ' s/%//g' | { \
299
+ read coverage; \
300
+ echo " Total coverage: $$ coverage%" ; \
301
+ minCoverage=75; \
302
+ if [ ` echo " $$ coverage < $$ minCoverage" | bc` -eq 1 ]; then \
303
+ echo " Coverage ($$ coverage%) is below the minimum required ($$ minCoverage%). Failing." ; \
304
+ exit 1; \
305
+ else \
306
+ echo " Coverage meets minimum requirement ($$ minCoverage%)." ; \
307
+ fi ; \
308
+ }
296
309
297
310
# # start: Start the chat all service.
298
311
.PHONY : start
You can’t perform that action at this time.
0 commit comments