test_runner: hide failing tests title when all tests pass

PR-URL: https://github.com/nodejs/node/pull/47370
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Moshe Atlow 2023-04-02 10:05:53 +03:00
parent 102540aef9
commit af8ed02067
No known key found for this signature in database
GPG Key ID: CB1159A696865149
3 changed files with 19 additions and 0 deletions

View File

@ -124,6 +124,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(

View File

@ -0,0 +1,6 @@
// Flags: --no-warnings --test-reporter=spec
'use strict';
require('../common');
const { it } = require('node:test');
it('should pass', () => {});

View File

@ -0,0 +1,9 @@
* should pass *(*ms)*
*tests 1*
*suites 0*
*pass 1*
*fail 0*
*cancelled 0*
*skipped 0*
*todo 0*
*duration_ms *