Skip to content

test_runner: fix junit report on empty diagnostic - #65357

Open
lazerg wants to merge 1 commit into
nodejs:mainfrom
lazerg:fix/issue-65355-junit-empty-diagnostic
Open

test_runner: fix junit report on empty diagnostic#65357
lazerg wants to merge 1 commit into
nodejs:mainfrom
lazerg:fix/issue-65355-junit-empty-diagnostic

Conversation

@lazerg

@lazerg lazerg commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

context.diagnostic('') makes the junit reporter throw. treeToXML guards the comment branch with if (comment), so an empty message falls through to the element branch and ObjectEntries(attrs) gets called on undefined. The generator dies, the destination stream is destroyed, and the report is left without its closing </testsuites>.

Comment nodes are already identified by comment == null elsewhere in the reporter, so the guard now checks the same way and an empty diagnostic renders as an empty XML comment.

Fixes: #65355

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Aug 17, 2026

@atlowChemi atlowChemi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should be tested with a .snapshot (see example

// Test that the output of test-runner/output/abort_hooks.js matches test-runner/output/abort_hooks.snapshot
)

Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com>
@lazerg
lazerg force-pushed the fix/issue-65355-junit-empty-diagnostic branch from f70a693 to 0a00f28 Compare August 17, 2026 19:43
@lazerg

lazerg commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Switched to a snapshot in 0a00f28. test/test-runner/test-output-junit-empty-diagnostic.mjs now compares against junit_empty_diagnostic.snapshot, which pins both the empty <!-- --> comment and the closing </testsuites>. That replaced the assertion-based case I had in test-runner-reporters.js, so I squashed the branch back into one commit.

@benjamingr benjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 17, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 17, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@atlowChemi atlowChemi added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_runner: JUnit report is truncated when a failed test triggers empty context.diagnostic()

4 participants