Skip to content

Commit

Permalink
test_runner: hide failing tests title when all tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLow committed Apr 2, 2023
1 parent 85705a4 commit 87a38b5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/internal/test_runner/reporter/spec.js
Expand Up @@ -121,6 +121,10 @@ class SpecReporter extends Transform {
callback(null, this.#handleEvent({ type, data }));
}
_flush(callback) {
if (this.#failedTests.length === 0) {
callback(null, '');
return;
}
const results = [`\n${colors['test:fail']}${symbols['test:fail']}failing tests:${white}\n`];
for (let i = 0; i < this.#failedTests.length; i++) {
ArrayPrototypePush(results, this.#formatTestReport(
Expand Down
6 changes: 6 additions & 0 deletions test/message/test_runner_spec_reporter_successful.js
@@ -0,0 +1,6 @@
// Flags: --no-warnings --test-reporter=spec
'use strict';
require('../common');
const { it } = require('node:test');

it('should pass', () => {});
9 changes: 9 additions & 0 deletions test/message/test_runner_spec_reporter_successful.out
@@ -0,0 +1,9 @@
* should pass *(*ms)*
*ℹ tests 1*
*ℹ suites 0*
*ℹ pass 1*
*ℹ fail 0*
*ℹ cancelled 0*
*ℹ skipped 0*
*ℹ todo 0*
*ℹ duration_ms *

0 comments on commit 87a38b5

Please sign in to comment.