You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_runner: JUnit report is truncated when a failed test triggers empty context.diagnostic() #65355
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
The JUnit reporter should gracefully handle empty diagnostic messages (e.g., context.diagnostic('')). It should format them as empty XML comments (<!-- -->) without throwing errors, aligning with the default spec reporter which successfully prints empty lines for empty diagnostic events. The generated XML report must remain valid and fully closed with the </testsuites> tag.
What do you see instead?
When a failed test contains an empty diagnostic call, the internal XML formatter (treeToXML) evaluates the falsy empty string if (comment) as false and mistakenly tries to read ObjectEntries(attrs) from an undefined object. This causes an unhandled TypeError inside the stream generator, silently destroying the stream and leaving the JUnit XML report truncated and broken.
Stack trace:
TypeError: Cannot convert undefined or null to object
at entries (<anonymous>)
at treeToXML (node:internal/test_runner/reporter/junit:46:7)
at junitReporter (node:internal/test_runner/reporter/junit:160:11)
Activity
test_runner: fix junit report on empty diagnostic
test_runner: fix junit report on empty diagnostic
test_runner: fix junit report on empty diagnostic
test_runner: fix junit report on empty diagnostic
test_runner: fix junit report on empty diagnostic
test_runner: fix junit report on empty diagnostic