Skip to content

Commit 87a38b5

Browse files
committed
test_runner: hide failing tests title when all tests pass
1 parent 85705a4 commit 87a38b5

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
@@ -121,6 +121,10 @@ class SpecReporter extends Transform {
121121
callback(null, this.#handleEvent({ type, data }));
122122
}
123123
_flush(callback) {
124+
if (this.#failedTests.length === 0) {
125+
callback(null, '');
126+
return;
127+
}
124128
const results = [`\n${colors['test:fail']}${symbols['test:fail']}failing tests:${white}\n`];
125129
for (let i = 0; i < this.#failedTests.length; i++) {
126130
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)