★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/704a440d52Nouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files
test: allow coverage threshold to be enforced
If COV_ENFORCE_THRESHOLD is set, tests run in coverage mode will
exit with an error, if line coverage is below the percentage
threshold.

PR-URL: #25675
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
bcoe authored and addaleax committed Feb 1, 2019
1 parent 673e434 commit 704a440d522205534ebf59e5618a7b5b73ae7e7d
Showing with 10 additions and 5 deletions.
  1. +10 −5 Makefile
@@ -215,7 +215,7 @@ coverage-build: all
coverage-build-js:
mkdir -p node_modules
if [ ! -d node_modules/c8 ]; then \
$(NODE) ./deps/npm install c8@next --no-save --no-package-lock;\
$(NODE) ./deps/npm install c8 --no-save --no-package-lock;\
fi

.PHONY: coverage-test
@@ -240,12 +240,17 @@ coverage-test: coverage-build
@grep -A3 Lines coverage/cxxcoverage.html | grep style \
| sed 's/<[^>]*>//g'| sed 's/ //g'

COV_REPORT_OPTIONS = --reporter=html \
--temp-directory=out/$(BUILDTYPE)/.coverage --omit-relative=false \
--resolve=./lib --exclude="deps/" --exclude="test/" --exclude="tools/" \
--wrapper-length=0
ifdef COV_ENFORCE_THRESHOLD
COV_REPORT_OPTIONS += --check-coverage --lines=$(COV_ENFORCE_THRESHOLD)
endif

.PHONY: coverage-report-js
coverage-report-js:
$(NODE) ./node_modules/.bin/c8 report --reporter=html \
--temp-directory=out/$(BUILDTYPE)/.coverage --omit-relative=false \
--resolve=./lib --exclude="deps/" --exclude="test/" --exclude="tools/" \
--wrapper-length=0
$(NODE) ./node_modules/.bin/c8 report $(COV_REPORT_OPTIONS)

.PHONY: cctest
# Runs the C++ tests using the built `cctest` executable.

0 comments on commit 704a440

Please sign in to comment.