Error while processing JaCoCo reports generated by Pester (PowerShell)


The PowerShell unit-testing framework Pester can generate coverage reports in the JaCoCO xml format.
The file seems fine, but Codecov reports: “There was an error processing coverage reports.”

Any indication as to what the issue is?



Codecov uploader v2.0.15 (installed from pip)
Pester v4.7.3

Hi @Farwaykorse and apologies for the delay, would you be able to re-run the Appveyor build? I wanted to take a look at a recent build to see if I can debug the issue.


I’m trying to upload a JaCoCo file generated from Pester to. It uploads, but then nothing happens. I’m not sure if I can see what is going on either.

The file that is uploaded is the the container coverage here

The Azure Pipeline job that uploads the file is here

I’m curios if the file have the wrong format in some way. Do you have a known to work JaCoCo file I can use as a comparison to see if the file that is generated in my pipeline is wrong?

Hi @johlju is an example of a JaCoCo report from our repo.

Looking at yours, it appears our processor choked with the following error:

KeyError: 'mb'

Checking your report in detail, you do seem to be missing the mb attribute, which is missed branches and is required for us to parse the report.

  <!-- number of missed branches -->

You can view the full schema here:

1 Like

Thank you! Now I have something to work with. It seems Pester does not output according to the correct schema.

1 Like

I got it to parse and comment on the PR. Yay! Until a solution is in Pester the workaround I’m using is a PowerShell task that updates the ‘mb’ and ‘cb’ attribute to “0” (zero). I’m uncertain if Pester (PowerShell) can see branches. Also, the method Save() creates the file using the encoding UTF-8 with BOM and Codecov “parser” does not like that.

$xml = Select-Xml -Path './output/testResults/CodeCov*.xml' -XPath '.'
$nodes = $xml.Node.SelectNodes("/report/package/sourcefile/line");
foreach ($node in $nodes)
    $node.SetAttribute('mb', 0)
    $node.SetAttribute('cb', 0)
# This changes the encoding on the file to UTF-8 without BOM.
$fileContent = Get-Content -Path './output/testResults/JaCoCo_coverage.xml' -Encoding 'Unicode' -Raw
$fileContent | Out-File -FilePath './output/testResults/JaCoCo_coverage.xml' -Encoding 'ascii'
1 Like

That’s for the sharing the update! I’m sure this will help others running into these issues. Did you happen to create an issue against Pester we can keep an eye on?

Submitted issue

1 Like

The change was merged in Pester and will be part of next release (not sure when though).

1 Like

Pester 4.10 has been released that solves this issue by providing the missing attributes and also adds a parameter to set the encoding the JaCoCo XML is saved with (default on Windows is UTF8 with BOM which does not work with, I use the 'ascii' encoding which works.

1 Like

Super! Thanks for the update and the work on this.