clearlyip / code-coverage-report-action

Provides Code Coverage reports in Github Actions
MIT License
7 stars 5 forks source link

Error when no coverage data #67

Closed anu-tiernan closed 1 month ago

anu-tiernan commented 4 months ago

When using clearlyip/code-coverage-report-action@v4 and the cobertura xml file does not contain any coverage data the following error is encountered:

Error: Cannot destructure property '@_name' of 'undefined' as it is undefined.

Contents of an XML file that triggered the error:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage line-rate="NaN" branch-rate="0" version="" timestamp="1718248893625" lines-covered="0" lines-valid="0" branches-covered="0" branches-valid="0" complexity="0">
  <sources></sources>
  <packages></packages>
</coverage>

The XML was generated with https://github.com/boumenot/gocover-cobertura on a repo that did not have any unit tests, hence the empty coverage report. I'd expect the output should just indicate that there is no coverage at all.

tm1000 commented 3 months ago

@anu-tiernan Hi there.

I think in 5.x series this should be resolved as I ran into the same issue but let me know