diff --git a/lib/internal/test_runner/reporter/spec.js b/lib/internal/test_runner/reporter/spec.js index c768cde4b98018..2e3ba834351970 100644 --- a/lib/internal/test_runner/reporter/spec.js +++ b/lib/internal/test_runner/reporter/spec.js @@ -76,7 +76,7 @@ class SpecReporter extends Transform { color = gray; symbol = symbols['hyphen:minus']; } - return `${prefix}${indent}${color}${symbol}${title}${error}${white}`; + return `${prefix}${indent}${color}${symbol}${title}${white}${error}`; } #handleTestReportEvent(type, data) { const subtest = ArrayPrototypeShift(this.#stack); // This is the matching `test:start` event diff --git a/test/pseudo-tty/test_runner_default_reporter.js b/test/pseudo-tty/test_runner_default_reporter.js index 1c6cda0ebbdd51..1596603b217660 100644 --- a/test/pseudo-tty/test_runner_default_reporter.js +++ b/test/pseudo-tty/test_runner_default_reporter.js @@ -9,3 +9,7 @@ const test = require('node:test'); test('should pass', () => {}); test('should fail', () => { throw new Error('fail'); }); test('should skip', { skip: true }, () => {}); +test('parent', () => { + test('should fail', () => { throw new Error('fail'); }); + test('should pass but parent fail', () => {}); +}); diff --git a/test/pseudo-tty/test_runner_default_reporter.out b/test/pseudo-tty/test_runner_default_reporter.out index 9aa2fbefb9e3ac..f032cf0a291562 100644 --- a/test/pseudo-tty/test_runner_default_reporter.out +++ b/test/pseudo-tty/test_runner_default_reporter.out @@ -1,5 +1,5 @@ [32m* should pass [90m(*ms)[39m[39m -[31m* should fail [90m(*ms)[39m +[31m* should fail [90m(*ms)[39m[39m Error: fail at * [90m(*)[39m [90m at *[39m @@ -8,20 +8,34 @@ [90m at *[39m [90m at *[39m [90m at *[39m -** + [90m* should skip [90m(*ms)[39m # SKIP[39m -[34m* tests 3[39m +* parent + [31m* should fail [90m(*ms)[39m[39m + Error: fail + at * [90m(*)[39m + [90m at *[39m + [90m at *[39m + [90m at *[39m + [90m at *[39m + + [31m* should pass but parent fail [90m(*ms)[39m[39m + [32m'test did not finish before its parent and was cancelled'[39m + +[31m* [39mparent [90m(*ms)[39m + +[34m* tests 6[39m [34m* suites 0[39m [34m* pass 1[39m -[34m* fail 1[39m -[34m* cancelled 0[39m +[34m* fail 3[39m +[34m* cancelled 1[39m [34m* skipped 1[39m [34m* todo 0[39m [34m* duration_ms *[39m [31m* failing tests:[39m -[31m* should fail [90m(*ms)[39m +[31m* should fail [90m(*ms)[39m[39m Error: fail at * [90m(*)[39m [90m at *[39m @@ -30,4 +44,17 @@ [90m at *[39m [90m at *[39m [90m at *[39m -[39m + +[31m* should fail [90m(*ms)[39m[39m + Error: fail + at * [90m(*)[39m + [90m at *[39m + [90m at *[39m + [90m at *[39m + [90m at *[39m + +[31m* should pass but parent fail [90m(*ms)[39m[39m + [32m'test did not finish before its parent and was cancelled'[39m + +[31m* parent [90m(*ms)[39m[39m + [32m'2 subtests failed'[39m