test: fix tests that fail under coverage
Make test runner capable of skipping tests, which makes it possible to skip the failing test/message/core_line_numbers.js test. Make nyc no longer generate compact instrumentation (this causes significantly different code output, which leads to failing test assertions). PR-URL: https://github.com/nodejs/node/pull/20794 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This commit is contained in:
parent
e316655468
commit
16377146b6
1
.nycrc
1
.nycrc
@ -2,5 +2,6 @@
|
|||||||
"exclude": [
|
"exclude": [
|
||||||
"**/internal/process/write-coverage.js"
|
"**/internal/process/write-coverage.js"
|
||||||
],
|
],
|
||||||
|
"compact": false,
|
||||||
"reporter": ["html", "text"]
|
"reporter": ["html", "text"]
|
||||||
}
|
}
|
||||||
|
4
Makefile
4
Makefile
@ -233,6 +233,7 @@ v8:
|
|||||||
.PHONY: jstest
|
.PHONY: jstest
|
||||||
jstest: build-addons build-addons-napi ## Runs addon tests and JS tests
|
jstest: build-addons build-addons-napi ## Runs addon tests and JS tests
|
||||||
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
|
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
|
||||||
|
--skip-tests=$(CI_SKIP_TESTS) \
|
||||||
$(CI_JS_SUITES) \
|
$(CI_JS_SUITES) \
|
||||||
$(CI_NATIVE_SUITES)
|
$(CI_NATIVE_SUITES)
|
||||||
|
|
||||||
@ -263,8 +264,7 @@ test-cov: all
|
|||||||
$(MAKE) build-addons
|
$(MAKE) build-addons
|
||||||
$(MAKE) build-addons-napi
|
$(MAKE) build-addons-napi
|
||||||
# $(MAKE) cctest
|
# $(MAKE) cctest
|
||||||
$(MAKE) jstest
|
CI_SKIP_TESTS=core_line_numbers.js $(MAKE) jstest
|
||||||
$(MAKE) lint
|
|
||||||
|
|
||||||
test-parallel: all
|
test-parallel: all
|
||||||
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) parallel
|
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) parallel
|
||||||
|
@ -1382,6 +1382,9 @@ def BuildOptions():
|
|||||||
result.add_option("--flaky-tests",
|
result.add_option("--flaky-tests",
|
||||||
help="Regard tests marked as flaky (run|skip|dontcare)",
|
help="Regard tests marked as flaky (run|skip|dontcare)",
|
||||||
default="run")
|
default="run")
|
||||||
|
result.add_option("--skip-tests",
|
||||||
|
help="Tests that should not be executed (comma-separated)",
|
||||||
|
default="")
|
||||||
result.add_option("--warn-unused", help="Report unused rules",
|
result.add_option("--warn-unused", help="Report unused rules",
|
||||||
default=False, action="store_true")
|
default=False, action="store_true")
|
||||||
result.add_option("-j", help="The number of parallel tasks to run",
|
result.add_option("-j", help="The number of parallel tasks to run",
|
||||||
@ -1424,6 +1427,7 @@ def ProcessOptions(options):
|
|||||||
options.arch = options.arch.split(',')
|
options.arch = options.arch.split(',')
|
||||||
options.mode = options.mode.split(',')
|
options.mode = options.mode.split(',')
|
||||||
options.run = options.run.split(',')
|
options.run = options.run.split(',')
|
||||||
|
options.skip_tests = options.skip_tests.split(',')
|
||||||
if options.run == [""]:
|
if options.run == [""]:
|
||||||
options.run = None
|
options.run = None
|
||||||
elif len(options.run) != 2:
|
elif len(options.run) != 2:
|
||||||
@ -1710,6 +1714,11 @@ def Main():
|
|||||||
|
|
||||||
result = None
|
result = None
|
||||||
def DoSkip(case):
|
def DoSkip(case):
|
||||||
|
# A list of tests that should be skipped can be provided. This is
|
||||||
|
# useful for tests that fail in some environments, e.g., under coverage.
|
||||||
|
if options.skip_tests != [""]:
|
||||||
|
if [ st for st in options.skip_tests if st in case.case.file ]:
|
||||||
|
return True
|
||||||
if SKIP in case.outcomes or SLOW in case.outcomes:
|
if SKIP in case.outcomes or SLOW in case.outcomes:
|
||||||
return True
|
return True
|
||||||
return FLAKY in case.outcomes and options.flaky_tests == SKIP
|
return FLAKY in case.outcomes and options.flaky_tests == SKIP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user