Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
joyeecheung committed Nov 2, 2025
commit 8beff886a03c7ba4c7e3f5df9ff875eed02fc1d9
5 changes: 5 additions & 0 deletions test/testpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
LS_RE = re.compile(r'^test-.*\.m?js$')
ENV_PATTERN = re.compile(r"//\s+Env:(.*)")
NODE_TEST_PATTERN = re.compile(r"['\"]node:test['\"]")

class SimpleTestCase(test.TestCase):

Expand Down Expand Up @@ -98,6 +99,10 @@ def GetRunConfiguration(self):
else:
result += flags

if self.context.use_error_reporter and NODE_TEST_PATTERN.search(source):
result += ['--test-reporter=./test/common/test-error-reporter.js',
'--test-reporter-destination=stdout']

if self.additional_flags:
result += self.additional_flags

Expand Down
10 changes: 5 additions & 5 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ def __init__(self, workspace, verbose, vm, args, expect_fail,
self.abort_on_timeout = abort_on_timeout
self.v8_enable_inspector = True
self.node_has_crypto = True
self.use_error_reporter = False

def GetVm(self, arch, mode):
if self.vm is not None:
Expand Down Expand Up @@ -1461,7 +1462,7 @@ def BuildOptions():
help="Type of build (simple, fips, coverage)",
default=None)
result.add_argument("--error-reporter",
help="use error reporter",
help="use error reporter if the test uses node:test",
default=True, action="store_true")
return result

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

if options.error_reporter:
options.node_args.append('--test-reporter=./test/common/test-error-reporter.js')
options.node_args.append('--test-reporter-destination=stdout')

if options.worker:
run_worker = join(workspace, "tools", "run-worker.js")
options.node_args.append(run_worker)
Expand All @@ -1701,6 +1698,9 @@ def Main():
options.repeat,
options.abort_on_timeout)

if options.error_reporter:
context.use_error_reporter = True

# Get status for tests
sections = [ ]
defs = { }
Expand Down
Loading