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

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

lib/internal/test_runner/reporter/spec.js

+4
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
const results = [`\n${colors['test:fail']}${symbols['test:fail']}failing tests:${white}\n`];
128132
for (let i = 0; i < this.#failedTests.length; i++) {
129133
ArrayPrototypePush(results, this.#formatTestReport(
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', () => {});
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)