node-covershot icon indicating copy to clipboard operation
node-covershot copied to clipboard

Report uncovered files

Open jperkelens opened this issue 12 years ago • 11 comments

Hey guys, great work with this package!

This pull request recursively iterates through all the files in the coverage folders and inserts a 0% coverage record for any that weren't hit during the test run.

jperkelens avatar Jan 13 '13 16:01 jperkelens

You added a dependency on underscore without adding it to package.json; aside from that I don't see an effect though (but it's possibly because my use of covershot is a little non-standard). I'm generating jscoverage files manually, then running mocha with the json-cov reporter and using those files as input to covershot. I'll see if that's the issue and what it would take to make that use case work as well. :)

My test was to add a small file to lib/, make sure that it existed in lib-cov/ after the coverage was generated, and then to check for that file in the covershot output with a 0% coverage but it didn't appear at all.

beaugunderson avatar Jan 22 '13 09:01 beaugunderson

Sorry about the underscore dependency, I'll fix that. The way this works is that it adds 0% coverage files to the data while running the tests. So if you're not using covershot's data generation during the tests, it wouldn't show up.

jperkelens avatar Jan 22 '13 12:01 jperkelens

Ah, that makes sense. :)

beaugunderson avatar Jan 22 '13 18:01 beaugunderson

Just added the underscore dependency, and some token data to display in uncovered files. I realized that having a 0% file, doesn't play nice with the sorting by coverage on the genereated .html file, looking into it. Also looking into generating uncovered file data in report generation over data generation, but maybe you want to pull this in and have the other changes as part of another pull request? Let me know.

jperkelens avatar Jan 26 '13 14:01 jperkelens

With a little research, I found that the sorting problem is due to a bug in the jquery.tablesort script. There's a pending pull request on the project but it's been open for 6 months.

https://github.com/kylefox/jquery-tablesort/pull/1

jperkelens avatar Jan 26 '13 14:01 jperkelens

Thanks for the pull request @jperkelens. One of the goals of covershot is to be able to consume coverage data from other tools and format it nicely for viewing. That might mean that coverage data is being pulled from a json file generated somewhere else. In such a case the source file directories would not be present and your pull request wouldn't work. I like the idea of reporting zero coverage for files not exercised although it makes the goal of supporting multiple input formats difficult.

kunklejr avatar Jan 28 '13 18:01 kunklejr

I'm confused by the above rationale. These changes do not interfere with the reporting/formatting process. They still allow you to format coverage data generated elsewhere, it just adds the uncovered files to the data when it's generated via covershot. If your intention is to remove the data generation capabilities of covershot, then I understand completely. If that is staying in, however, I'm not sure how these additions are interfering with the capability to support multiple formats.

jperkelens avatar Jan 28 '13 20:01 jperkelens

Actually, you're right. I was incorrectly thinking these changes were on the reporting side rather than the data generation side. Sorry about that.

kunklejr avatar Jan 28 '13 20:01 kunklejr

Great. Do you think you'll pull this in?

jperkelens avatar Jan 29 '13 13:01 jperkelens

Yes, likely. I just need to carve out some time to go through it and make sure I understand it. Do you need it urgently or is the end of the week okay?

kunklejr avatar Jan 29 '13 13:01 kunklejr

No worries. Take your time. I just wanted to make sure we left the conversation on the same page.

On Tue, Jan 29, 2013 at 8:53 AM, Jeff Kunkle [email protected]:

Yes, likely. I just need to carve out some time to go through it and make sure I understand it. Do you need it urgently or is the end of the week okay?

— Reply to this email directly or view it on GitHubhttps://github.com/nearinfinity/node-covershot/pull/8#issuecomment-12835252.

jperkelens avatar Jan 29 '13 14:01 jperkelens