Skip to content

Commit 29c68a2

Browse files
MoLowUlisesGascon
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 08a0c6c commit 29c68a2

4 files changed

Lines changed: 584 additions & 2 deletions

File tree

‎lib/internal/test_runner/reporter/spec.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ class SpecReporter extends Transform {
7878
}elseif(todo!==undefined){
7979
title+=` # ${typeoftodo==='string'&&todo.length ? todo : 'TODO'}`;
8080
}
81+
consterror=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+
consterr=data.details?.error?.failureType==='subtestsFailed' ? '' : error;
85+
return`${prefix}${indent}${color}${symbols['arrow:right']}${white}${title}\n${err}`;
8486
}
85-
consterror=this.#formatError(data.details?.error,indent);
8687
if(skip!==undefined){
8788
color=gray;
8889
symbol=symbols['hyphen:minus'];
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
require('../../../common');
3+
constfixtures=require('../../../common/fixtures');
4+
constspawn=require('node:child_process').spawn;
5+
6+
constchild=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)