test_runner: hide new line when no error in spec reporter

PR-URL: https://github.com/nodejs/node/pull/52297
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
Moshe Atlow authored and marco-ippolito committed 2024-05-03 08:30:27 +02:00
1 parent 379535abe3
commit 34ab1a36ee
6 files changed
+2 -30

No files matched your search

+2 -2
View File
@@ -83,8 +83,8 @@ class SpecReporter extends Transform {
const error = this.#formatError(data.details?.error, indent);
if (hasChildren) {
// If this test has had children - it was already reported, so slightly modify the output
const err = data.details?.error?.failureType === 'subtestsFailed' ? '' : error;
return `${prefix}${indent}${color}${symbols['arrow:right']}${colors.white}${title}\n${err}`;
const err = !error || data.details?.error?.failureType === 'subtestsFailed' ? '' : `\n${error}`;
return `${prefix}${indent}${color}${symbols['arrow:right']}${colors.white}${title}${err}`;
}
if (skip !== undefined) {
color = colors.gray;
@@ -28,7 +28,6 @@
[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
@@ -6,9 +6,7 @@
nested 1 (*ms)
nested 2 (*ms)
nested (*ms)
describe hooks (*ms)
describe hooks - no subtests (*ms)
before throws
1
@@ -96,7 +94,6 @@
*
beforeEach throws (*ms)
afterEach throws
1 (*ms)
Error: afterEach
@@ -124,7 +121,6 @@
*
afterEach throws (*ms)
afterEach when test fails
1 (*ms)
Error: test
@@ -141,7 +137,6 @@
2 (*ms)
afterEach when test fails (*ms)
afterEach throws and test fails
1 (*ms)
Error: test
@@ -169,7 +164,6 @@
*
afterEach throws and test fails (*ms)
test hooks
1 (*ms)
2 (*ms)
@@ -177,9 +171,7 @@
nested 1 (*ms)
nested 2 (*ms)
nested (*ms)
test hooks (*ms)
test hooks - no subtests (*ms)
t.before throws
1 (*ms)
@@ -293,7 +285,6 @@
*
t.beforeEach throws (*ms)
t.afterEach throws
1 (*ms)
Error: afterEach
@@ -322,7 +313,6 @@
*
t.afterEach throws (*ms)
afterEach when test fails
1 (*ms)
Error: test
@@ -338,11 +328,9 @@
2 (*ms)
afterEach when test fails (*ms)
afterEach context when test passes
1 (*ms)
afterEach context when test passes (*ms)
afterEach context when test fails
1 (*ms)
Error: test
@@ -352,7 +340,6 @@
*
afterEach context when test fails (*ms)
afterEach throws and test fails
1 (*ms)
Error: test
@@ -380,7 +367,6 @@
*
afterEach throws and test fails (*ms)
t.after() is called if test body throws (*ms)
Error: bye
*
@@ -107,7 +107,6 @@
this subtest should make its parent test fail
subtest sync throw fail (*ms)
sync throw non-error fail (*ms)
Symbol(thrown symbol from sync throw non-error fail)
@@ -117,7 +116,6 @@
level 1c (*ms)
level 1d (*ms)
level 0a (*ms)
top level
+long running (*ms)
'test did not finish before its parent and was cancelled'
@@ -125,9 +123,7 @@
+short running
++short running (*ms)
+short running (*ms)
top level (*ms)
invalid subtest - pass but subtest fails (*ms)
sync skip option (*ms) # SKIP
sync skip option with message (*ms) # this is skipped
@@ -197,7 +193,6 @@
'only' and 'runOnly' require the --test-only command-line option.
running subtest 4 (*ms)
only is set but not in only mode (*ms)
'only' and 'runOnly' require the --test-only command-line option.
custom inspect symbol fail (*ms)
customized
@@ -231,7 +226,6 @@
*
subtest sync throw fails (*ms)
timed out async test (*ms)
'test timed out after *ms'
@@ -107,7 +107,6 @@
this subtest should make its parent test fail
subtest sync throw fail (*ms)
sync throw non-error fail (*ms)
Symbol(thrown symbol from sync throw non-error fail)
@@ -117,7 +116,6 @@
level 1c (*ms)
level 1d (*ms)
level 0a (*ms)
top level
+long running (*ms)
'test did not finish before its parent and was cancelled'
@@ -125,9 +123,7 @@
+short running
++short running (*ms)
+short running (*ms)
top level (*ms)
invalid subtest - pass but subtest fails (*ms)
sync skip option (*ms) # SKIP
sync skip option with message (*ms) # this is skipped
@@ -197,7 +193,6 @@
'only' and 'runOnly' require the --test-only command-line option.
running subtest 4 (*ms)
only is set but not in only mode (*ms)
'only' and 'runOnly' require the --test-only command-line option.
custom inspect symbol fail (*ms)
customized
@@ -231,7 +226,6 @@
*
subtest sync throw fails (*ms)
timed out async test (*ms)
'test timed out after *ms'
@@ -13,7 +13,6 @@ AFTER 2
﹣ should not run (*ms) # SKIP
✔ should run 2 (*ms)
▶ suite runs with mixture of skipped tests (*ms)
ℹ tests 4
ℹ suites 2
ℹ pass 2