Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ae91a6c

Browse filesBrowse files
joyeecheungaduh95
authored andcommitted
tools: only add test reporter args when node:test is used
If the test does not use node:test, don't append the unnecessary arguments to avoid cluttering the command line printed by the test runner when the test fails. PR-URL: #60551 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 6e1b23d commit ae91a6c
Copy full SHA for ae91a6c

File tree

Expand file treeCollapse file tree

2 files changed

+10
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-5
lines changed
Open diff view settings
Collapse file

‎test/testpy/__init__.py‎

Copy file name to clipboardExpand all lines: test/testpy/__init__.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
3636
LS_RE = re.compile(r'^test-.*\.m?js$')
3737
ENV_PATTERN = re.compile(r"//\s+Env:(.*)")
38+
NODE_TEST_PATTERN = re.compile(r"('|`|\")node:test\1")
3839

3940
class SimpleTestCase(test.TestCase):
4041

@@ -98,6 +99,10 @@ def GetRunConfiguration(self):
9899
else:
99100
result += flags
100101

102+
if self.context.use_error_reporter and NODE_TEST_PATTERN.search(source):
103+
result += ['--test-reporter=./test/common/test-error-reporter.js',
104+
'--test-reporter-destination=stdout']
105+
101106
if self.additional_flags:
102107
result += self.additional_flags
103108

Collapse file

‎tools/test.py‎

Copy file name to clipboardExpand all lines: tools/test.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,7 @@ def __init__(self, workspace, verbose, vm, args, expect_fail,
969969
self.abort_on_timeout = abort_on_timeout
970970
self.v8_enable_inspector = True
971971
self.node_has_crypto = True
972+
self.use_error_reporter = False
972973

973974
def GetVm(self, arch, mode):
974975
if self.vm is not None:
@@ -1461,7 +1462,7 @@ def BuildOptions():
14611462
help="Type of build (simple, fips, coverage)",
14621463
default=None)
14631464
result.add_argument("--error-reporter",
1464-
help="use error reporter",
1465+
help="use error reporter if the test uses node:test",
14651466
default=True, action="store_true")
14661467
return result
14671468

@@ -1679,10 +1680,6 @@ def Main():
16791680
options.node_args.append("--trace-file-names")
16801681
options.progress = "deopts"
16811682

1682-
if options.error_reporter:
1683-
options.node_args.append('--test-reporter=./test/common/test-error-reporter.js')
1684-
options.node_args.append('--test-reporter-destination=stdout')
1685-
16861683
if options.worker:
16871684
run_worker = join(workspace, "tools", "run-worker.js")
16881685
options.node_args.append(run_worker)
@@ -1701,6 +1698,9 @@ def Main():
17011698
options.repeat,
17021699
options.abort_on_timeout)
17031700

1701+
if options.error_reporter:
1702+
context.use_error_reporter = True
1703+
17041704
# Get status for tests
17051705
sections = [ ]
17061706
defs = { }

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.