mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
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: https://github.com/nodejs/node/pull/25675 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
parent
0ff0af534e
commit
a861adde3b
15
Makefile
15
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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user