Skip to content

Commit 913e4b9

Browse files
MoLowtargos
authored andcommitted
test_runner: output errors of suites
PR-URL: #50361 Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent e20b272 commit 913e4b9

File tree

4 files changed

+584
-2
lines changed

4 files changed

+584
-2
lines changed

lib/internal/test_runner/reporter/spec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ class SpecReporter extends Transform {
7878
} else if (todo !== undefined) {
7979
title += ` # ${typeof todo === 'string' && todo.length ? todo : 'TODO'}`;
8080
}
81+
const error = this.#formatError(data.details?.error, indent);
8182
if (hasChildren) {
8283
// If this test has had children - it was already reported, so slightly modify the output
83-
return `${prefix}${indent}${color}${symbols['arrow:right']}${white}${title}\n`;
84+
const err = data.details?.error?.failureType === 'subtestsFailed' ? '' : error;
85+
return `${prefix}${indent}${color}${symbols['arrow:right']}${white}${title}\n${err}`;
8486
}
85-
const error = this.#formatError(data.details?.error, indent);
8687
if (skip !== undefined) {
8788
color = gray;
8889
symbol = symbols['hyphen:minus'];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
require('../../../common');
3+
const fixtures = require('../../../common/fixtures');
4+
const spawn = require('node:child_process').spawn;
5+
6+
const child = spawn(process.execPath,
7+
['--no-warnings', '--test-reporter', 'spec', fixtures.path('test-runner/output/hooks.js')],
8+
{ stdio: 'pipe' });
9+
// eslint-disable-next-line no-control-regex
10+
child.stdout.on('data', (d) => process.stdout.write(d.toString().replace(/[^\x00-\x7F]/g, '').replace(/\u001b\[\d+m/g, '')));
11+
child.stderr.pipe(process.stderr);

0 commit comments

Comments
 (0)