Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions lib/internal/test_runner/reporter/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ class SpecReporter extends Transform {
} else if (todo !== undefined) {
title += ` # ${typeof todo === 'string' && todo.length ? todo : 'TODO'}`;
}
const error = this.#formatError(data.details?.error, indent);
if (hasChildren) {
// If this test has had children - it was already reported, so slightly modify the output
return `${prefix}${indent}${color}${symbols['arrow:right']}${white}${title}\n`;
const err = data.details?.error?.failureType === 'subtestsFailed' ? '' : error;
return `${prefix}${indent}${color}${symbols['arrow:right']}${white}${title}\n${err}`;
}
const error = this.#formatError(data.details?.error, indent);
if (skip !== undefined) {
color = gray;
symbol = symbols['hyphen:minus'];
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/test-runner/output/hooks_spec_reporter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';
require('../../../common');
const fixtures = require('../../../common/fixtures');
const spawn = require('node:child_process').spawn;

const child = spawn(process.execPath,
['--no-warnings', '--test-reporter', 'spec', fixtures.path('test-runner/output/hooks.js')],
{ stdio: 'pipe' });
// eslint-disable-next-line no-control-regex
child.stdout.on('data', (d) => process.stdout.write(d.toString().replace(/[^\x00-\x7F]/g, '').replace(/\u001b\[\d+m/g, '')));
child.stderr.pipe(process.stderr);
Loading