Skip to content

Commit

Permalink
fix: fix missing test diagnostics
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node#46450
Fixes: nodejs/node#45911
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
(cherry picked from commit 1118db718c8429f5f343aca90ccb570244e282b4)
  • Loading branch information
MoLow committed Feb 8, 2023
1 parent d6f071a commit b5b3f0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/internal/test_runner/runner.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// https://github.com/nodejs/node/blob/61c65b066b098cf47f89206212864ec1cddb8782/lib/internal/test_runner/runner.js
// https://github.com/nodejs/node/blob/1118db718c8429f5f343aca90ccb570244e282b4/lib/internal/test_runner/runner.js
'use strict'
const {
ArrayFrom,
Expand Down Expand Up @@ -134,9 +134,12 @@ class FileTest extends Test {
ArrayPrototypeIncludes(kDiagnosticsFilterArgs, StringPrototypeSlice(comment, 0, firstSpaceIndex))
}

#handleReportItem ({ kind, node, nesting = 0 }) {
#handleReportItem ({ kind, node, comments, nesting = 0 }) {
nesting += 1

if (comments) {
ArrayPrototypeForEach(comments, (comment) => this.reporter.diagnostic(nesting, this.name, comment))
}
switch (kind) {
case TokenKind.TAP_VERSION:
// TODO(manekinekko): handle TAP version coming from the parser.
Expand Down
3 changes: 3 additions & 0 deletions test/message/test_runner_output_cli.out
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ TAP version 13
---
duration_ms: *
...
# this test should pass
# Subtest: sync throw fail
not ok 8 - sync throw fail
---
Expand Down Expand Up @@ -204,6 +205,7 @@ TAP version 13
*
*
...
# this subtest should make its parent test fail
1..1
not ok 21 - subtest sync throw fail
---
Expand Down Expand Up @@ -365,6 +367,7 @@ TAP version 13
---
duration_ms: *
...
# \#diagnostic
# Subtest: callback pass
ok 41 - callback pass
---
Expand Down

0 comments on commit b5b3f0b

Please sign in to comment.