Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b31aabb

Browse filesBrowse files
pulkit-30MylesBorins
authored andcommitted
test_runner: top-level diagnostics not ommited when running with --test
PR-URL: #46441 Fixes: #45910 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 2c8c9f9 commit b31aabb
Copy full SHA for b31aabb

File tree

Expand file treeCollapse file tree

3 files changed

+19
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+19
-3
lines changed
Open diff view settings
Collapse file

‎lib/internal/test_runner/runner.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/runner.js
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const {
1515
SafePromiseAllSettledReturnVoid,
1616
SafeMap,
1717
SafeSet,
18+
StringPrototypeIndexOf,
19+
StringPrototypeSlice,
1820
StringPrototypeStartsWith,
1921
} = primordials;
2022

@@ -51,6 +53,7 @@ const {
5153

5254
const kFilterArgs = ['--test', '--experimental-test-coverage', '--watch'];
5355
const kFilterArgValues = ['--test-reporter', '--test-reporter-destination'];
56+
const kDiagnosticsFilterArgs = ['tests', 'pass', 'fail', 'cancelled', 'skipped', 'todo', 'duration_ms'];
5457

5558
// TODO(cjihrig): Replace this with recursive readdir once it lands.
5659
function processPath(path, testFiles, options) {
@@ -130,6 +133,13 @@ function getRunArgs({ path, inspectPort }) {
130133

131134
class FileTest extends Test {
132135
#buffer = [];
136+
#checkNestedComment({ comment }) {
137+
const firstSpaceIndex = StringPrototypeIndexOf(comment, ' ');
138+
if (firstSpaceIndex === -1) return false;
139+
const secondSpaceIndex = StringPrototypeIndexOf(comment, ' ', firstSpaceIndex + 1);
140+
return secondSpaceIndex === -1 &&
141+
ArrayPrototypeIncludes(kDiagnosticsFilterArgs, StringPrototypeSlice(comment, 0, firstSpaceIndex));
142+
}
133143
#handleReportItem({ kind, node, nesting = 0 }) {
134144
nesting += 1;
135145

@@ -183,7 +193,7 @@ class FileTest extends Test {
183193
break;
184194

185195
case TokenKind.COMMENT:
186-
if (nesting === 1) {
196+
if (nesting === 1 && this.#checkNestedComment(node)) {
187197
// Ignore file top level diagnostics
188198
break;
189199
}
Collapse file

‎test/message/test_runner_output_cli.out‎

Copy file name to clipboardExpand all lines: test/message/test_runner_output_cli.out
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,12 @@ TAP version 13
629629
*
630630
...
631631
1..65
632+
# Warning: Test "unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event.
633+
# Warning: Test "async unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event.
634+
# Warning: Test "immediate throw - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event.
635+
# Warning: Test "immediate reject - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event.
636+
# Warning: Test "callback called twice in different ticks" generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event.
637+
# Warning: Test "callback async throw after done" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event.
632638
not ok 1 - *test_runner_output.js
633639
---
634640
duration_ms: *
Collapse file

‎test/message/test_runner_output_spec_reporter.out‎

Copy file name to clipboardExpand all lines: test/message/test_runner_output_spec_reporter.out
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858

5959
async assertion fail (*ms)
6060
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
61-
61+
6262
true !== false
63-
63+
6464
*
6565
*
6666
*

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.