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
JUnit reporter: distinguish thrown errors from assertion failures #39193
This proposal does not change default JUnit output.
Existing consumers that rely on <failure> will not be affected.
Only users who explicitly enable the flag will get:
<error> elements
errors++ counters
Why this matters
CI systems such as Jenkins, Xray and TestRail
treat <failure> and <error> differently.
Currently, a thrown runtime exception:
increments failures
produces no <error> node
This makes it impossible to distinguish assertion failures
from infrastructure / test crashes.
Example
Example:
Given a test that throws a runtime error:
test('example', () => {
throw new Error('Boom');
});
Current JUnit output:
The test is reported as <failure>
errors="0" and failures="1"
Proposed behavior:
The test is reported as <error>
errors="1" and failures="0"
Assertion failures (expect(...)) would remain reported as <failure>.
Motivation
JUnit distinguishes between assertion failures and runtime errors,
and many CI and test-reporting systems rely on this distinction
(e.g. Jenkins, Xray, TestRail).
When all failures are serialized as <failure>, these systems cannot
correctly classify test outcomes, making it harder to reason about
test health and failure modes.
Aligning Playwright’s JUnit reporter with standard JUnit semantics
would improve interoperability without changing assertion behavior.
The JUnit reporter now distinguishes between assertion failures and thrown errors:
expect() failures → <failure> element (with matcher name in type="")
Thrown runtime errors → <error> element (with error class in type="")
errors="" counter is properly tracked at both <testsuite> and <testsuites> levels
This is implemented without an opt-in flag — it directly aligns the output with JUnit XML semantics. Existing consumers that parse <failure> for assertion failures will see no change; only thrown errors move to <error>.
This PR also fixes #12944 (the message="" attribute now contains the actual error message instead of the test title).
Activity
fix(junit): use actual error message in failure attributes and distin…
vazidmansuri005 commentedon Feb 22, 2026
Hey aviavi16 👋
I've opened a PR that addresses this: #39350
The JUnit reporter now distinguishes between assertion failures and thrown errors:
expect()failures →<failure>element (with matcher name intype="")<error>element (with error class intype="")errors=""counter is properly tracked at both<testsuite>and<testsuites>levelsThis is implemented without an opt-in flag — it directly aligns the output with JUnit XML semantics. Existing consumers that parse
<failure>for assertion failures will see no change; only thrown errors move to<error>.This PR also fixes #12944 (the
message=""attribute now contains the actual error message instead of the test title).fix(junit): use actual error message in failure attributes and distin…
fix(junit): use actual error message in failure attributes and distin…
aviavi16 commentedon Mar 4, 2026
vazidmansuri005 thanks. the issue is solved.