MishaKav / jest-coverage-comment

Comments a pull request or commit with the jest code coverage badge, full report and tests summary
MIT License
80 stars 34 forks source link

Handle case when testsuites is not the root element of the JUnit xml file #85

Closed JakeFDev closed 5 months ago

JakeFDev commented 5 months ago

Updates the junit parsing to account for cases where tools may not utilize <testsuites> as the root element.

Without this change, trying to parse a junit xml file that omits the root testsuites element results in this error:

Parse JUnit report. Cannot read properties of undefined (reading '$')

As explained on this page, the JUnit xml format has no official specification and many tools and projects have minor variations such as this. Common JUnit XML Format & Examples

MishaKav commented 5 months ago

Great improvement, I will merge it soon and release a new version. Thank you.