Skip to content

Commit d5fc823

Browse files
committed
test_runner: hide failing tests title when all tests pass
PR-URL: #47370 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 1d453e4 commit d5fc823

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ class SpecReporter extends Transform {
124124
callback(null,this.#handleEvent({ type, data }));
125125
}
126126
_flush(callback){
127+
if(this.#failedTests.length===0){
128+
callback(null,'');
129+
return;
130+
}
127131
constresults=[`\n${colors['test:fail']}${symbols['test:fail']}failing tests:${white}\n`];
128132
for(leti=0;i<this.#failedTests.length;i++){
129133
ArrayPrototypePush(results,this.#formatTestReport(
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Flags: --no-warnings --test-reporter=spec
2+
'use strict';
3+
require('../common');
4+
const{ it }=require('node:test');
5+
6+
it('should pass',()=>{});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* should pass *(*ms)*
2+
*tests 1*
3+
*suites 0*
4+
*pass 1*
5+
*fail 0*
6+
*cancelled 0*
7+
*skipped 0*
8+
*todo 0*
9+
*duration_ms *

0 commit comments

Comments
 (0)