Skip to content

[jtest-unit reporter] Error: stackTrace.split is not a function with valid JUNIT XML #506

@ncocaign

Description

@ncocaign

Describe the bug

with valid JUNIT XML passing the XSD validation (https://github.com/behave/behave/blob/main/etc/junit.xml/junit-4.xsd).

To Reproduce

Steps to reproduce the behavior:
Use jtest-unit reporter an result XML with or tag with attribute "message"

Expected behavior

Error: stackTrace.split is not a function

Screenshots

Additional context

here a result which cannot be parsed:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" failures="1" disabled="0" errors="0" time="0.001" name="Failure">
  <testsuite name="Test" tests="6" failures="1" disabled="0" errors="0" time="0.001">
    <testcase name="Test" status="run" time="0" classname="Fails">
      <failure message="error" type=""><![CDATA[error.cpp:01
      Expected: true
      Which is: false >]]></failure>
    </testcase>
  </testsuite>
</testsuites>

Potential fix:

at

const details = tc.failure[0]

replace const details = tc.failure[0]; with const details = tc.failure[0] || tc.failure[0]._;

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions