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

fix cobertura report #571

Merged
merged 5 commits into from Oct 13, 2021
Merged

Conversation

bitcloud
Copy link
Contributor

The cobertura reporter currently only works if it generates coverage for script files in multiple folders. If all script files are in one folder there is no package which results in not generating the right xml structure in the reports file.

To fix this I add all files in a currently called main package to collect all files residing in a single folder project. I'm still unsure about the naming, cloud be root as well, but I think main works quite well.

This should fix #66

saboya added a commit to saboya/webpack-chrome-manifest-generator-plugin that referenced this pull request Jun 16, 2020
@bitcloud
Copy link
Contributor Author

Hey @coreyfarrell, who should I include here to move things forward? I know that the team is not that familiar with cobertura. I referenced the issue that should be closed by this.

@coderica perhaps you cloud have a look as well?

@bitcloud
Copy link
Contributor Author

Any updates here? It would be great to get that merged. :-)

@saboya
Copy link

saboya commented Sep 15, 2020

FYI I'm currently using this patch to provide Cobertura report in one of my projects, and it works correctly.

Link: https://dev.azure.com/saboya0915/webpack-chrome-manifest-generator-plugin/_build/results?buildId=35&view=codecoverage-tab

@bitcloud
Copy link
Contributor Author

Thanks for the input @saboya!

@Swiftwork
Copy link

I am suspecting that Jenkins is reporting 0% coverage due to the lack of <package> and <classes> tags. @bitcloud have you verified that issue #384 won't resurface with this change? The pull-request seems more tested compared to #382, per request in #382 (comment). Would you look at merging this @bcoe and @coreyfarrell?

@bitcloud
Copy link
Contributor Author

bitcloud commented Oct 9, 2020

I am pretty sure that I covered this case with my test cases as well.

But it is impossible to be certain as #382 did not include a test case or the code the issue was based on. ;-)

@bitcloud
Copy link
Contributor Author

bitcloud commented Oct 9, 2020

@Swiftwork I should have read your comment properly...
Yes, I specifically made a testcase for that to be sure this issue doesn't reappear.

@bitcloud
Copy link
Contributor Author

bitcloud commented Oct 9, 2020

@Swiftwork perhaps you could also test the merged code in your case and add the result to this discussion?

It would be nice to see if it really fixes your issue as well and would probably add even more confidence after the #382 issue.

@Swiftwork
Copy link

@bitcloud I might get a chance on Monday, but I can confirm that when I added another folder with tests and both packages/classes tags were added, Jenkins started reporting my coverage correctly.

@bitcloud
Copy link
Contributor Author

As you were just active, cloud you have a look here as well @coreyfarrell?

@coreyfarrell
Copy link
Member

I don't have the capability to review anything for cobertura. We simply don't have time to go back and forth - last fix we got to this report broke other users and we had to do a second release to revert the first fix.

I'm beginning to wonder if the best thing for this report is for it to be republished by the community in a stand-alone module. istanbul-reports supports loading npm modules. For example if someone were to publish an npm module cobertura-coverage-report then you could use it with nyc report -r cobertura-coverage-report (obviously you'd need to npm install -D cobertura-coverage-report on your project for this to work).

@bcoe
Copy link
Member

bcoe commented Oct 12, 2021

@bitcloud I'm pitching in and coming back to some old PRs. I've made it easier to release/rollback libraries from this mono-repo, so am more open to landing updates to some of these more finicky parts of the codebase.

Would you be open to rebasing?

@saboya
Copy link

saboya commented Oct 12, 2021

Not sure if @bitcloud is still interested in this, but I rebased his commits in a fork:

https://github.com/saboya/istanbuljs/tree/develop/fix-cobertura-report

@bitcloud
Copy link
Contributor Author

thx @saboya. To stay in this PR I just pushed your rebase in here as well.

const isWindows = require('is-windows');
const FileWriter = require('istanbul-lib-report/lib/file-writer');
const istanbulLibReport = require('istanbul-lib-report');
const istanbulLibCoverage = require('istanbul-lib-coverage');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for adding a test for cobertura 🎉

@bcoe
Copy link
Member

bcoe commented Oct 13, 2021

@saboya @bitcloud I'm going to go ahead and land this 👏 thank you for the contribution.

I'm not myself a cobergtura user, so would appreciate help testing once it goes out the door -- I'll update this thread accordingly.

@bitcloud
Copy link
Contributor Author

bitcloud commented Oct 13, 2021

Your welcome! Thanks for Maintaining!
I currently have not active project which is using cobertura as well, but I will try to set dust something off to verify ;-)

@bcoe bcoe merged commit 596f6ff into istanbuljs:master Oct 13, 2021
@bcoe
Copy link
Member

bcoe commented Oct 13, 2021

@saboya @bitcloud fixes are published.

@saboya
Copy link

saboya commented Oct 14, 2021

@bcoe Not a huge project, but a personal project of mine on Azure pipelines using cobertura to report code coverage, using the new instanbul-reports version:

https://dev.azure.com/saboya0915/webpack-chrome-manifest-generator-plugin/_build/results?buildId=49&view=codecoverage-tab

@github-actions github-actions bot mentioned this pull request Dec 1, 2021
@bitcloud bitcloud deleted the develop/fix-cobertura-report branch January 10, 2022 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Packages is N/A with cobertura report if test files is under one folder
5 participants