Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Cobertura as Code Coverage Report Format #2203

Open
3 tasks done
eizedev opened this issue Jun 30, 2022 · 4 comments · May be fixed by #2298
Open
3 tasks done

Support Cobertura as Code Coverage Report Format #2203

eizedev opened this issue Jun 30, 2022 · 4 comments · May be fixed by #2298

Comments

@eizedev
Copy link

eizedev commented Jun 30, 2022

Checklist

Summary of the feature request

Hi,

we are internally using Gitlab CI for all our powershell stuff. Gitlab only supports Cobertura as code coverage report format (See Gitlab Test Coverage). Pester internally only supports 'JaCoCo' or 'CoverageGutters'. I have read a few other issues like this #212 (comment) about the implementation of cobertura and other formats.

Could you please add a cobertura compatible Code Coverage Report format like JaCoCo in Pester?

(The TestResult Format JUnitXml is already supported in gitlab.)

Thanks,
René

How should it work?

No response

@nohwnd
Copy link
Member

nohwnd commented Jun 30, 2022

I don't have a capacity to implement this myself right now. Putting for adoption from community.

I think this a good first issue to solve even though the scope is a bit big if this is your first PR ever. There is already code that creates jacoco format and cobertura would be similar hopefully.

@joeskeen
Copy link

I found where the JaCoCo generation code is.

function Get-JaCoCoReportXml {

As Cobertura is another XML-based coverage format, I'm hoping it wouldn't be too hard to implement. I did find the Cobertura DTD files which describe the format: https://github.com/cobertura/cobertura/tree/master/cobertura/src/site/htdocs/xml

That being said, I'm not sure which version of Cobertura we would want to support. The Cobertura output I get from Jest JavaScript unit tests (via jest-junit) shows as coverage-04.dtd, so perhaps that would be a good place to start as I already know that it is supported by tools like ReportGenerator and Azure Pipelines. Thoughts? If I get a chance I may take a crack at it since I could really use this functionality.

@joeskeen joeskeen linked a pull request Feb 10, 2023 that will close this issue
5 tasks
@fflaten
Copy link
Collaborator

fflaten commented Feb 10, 2023

That being said, I'm not sure which version of Cobertura we would want to support. The Cobertura output I get from Jest JavaScript unit tests (via jest-junit) shows as coverage-04.dtd, so perhaps that would be a good place to start as I already know that it is supported by tools like ReportGenerator and Azure Pipelines. Thoughts? If I get a chance I may take a crack at it since I could really use this functionality.

Searching around the web it seems coverage-04.dtd is mostly the one referenced. Didn't look at what the differences would be. Looks like Cobertura isn't really maintained much lately, but I guess that means the DTD is kinda stable.

JaCoCo seems to be generally widely supported in CI and tools, so as long as the Cobertura-version is compliant with Gitlab which requires conversion atm, then it should be fine I guess. 🙂 Really weird how they keep delaying the JaCoCo-support (ETA Q2'24 for now).

@joeskeen
Copy link

Yeah, seems like Cobertura is still a preferred format in the JS world, as that's one of the most commonly referenced output formats when I'm looking into Jest code coverage. Unfortunately I haven't found any JaCoCo format plugin for Jest... It would be nice if all the code ecosystems could agree on some kind of uniform standard LOL!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants