-
Notifications
You must be signed in to change notification settings - Fork 94
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
Feature: c8 --all #76
Comments
@coreyfarrell I don't hate the idea of |
As an approach to implementing –all for c8 I was considering the following:
Does this seem like a reasonable approach? I have a local prototype of this code that on the surface seems to do what I want. I get a coverage report with my unloaded local files from But, I was thinking perhaps there was a better/more efficient way to generate the empty coverage report? Or is there perhaps generally a better way? |
@j03m @coreyfarrell I had a thought about this, and it might be worth considering for nyc too ... should files that are never loaded by a separate section of the report, rather than us trying to guess as to how many lines weren't covered? |
I'm not sure. I worry about significantly expanding the options of
This is what I can think of now, potentially other stuff involved but |
I think it would be nice to highlight and visually call out a file in a report if it was not loaded. Right now in the fork I'm experimenting with (and in nyc's --all if I'm not mistaken) unloaded files are simply listed as though completely uncovered. There is no way to tell at initial glance that a file is completely uncovered because it was never loaded, which is arguably information we have at the time the report is generated. It would be nice to call that out in some way. I don't think it should be so separate however as to not factor into the aggregate total coverage numbers. I'm still very interested in knowing my project's or a folder's total coverage %. If files are loaded or unloaded, I only care so far as my investigation into whether or not I've missed some critical path in our testing and why. That said, still being fairly new to this code base, I worry a bit about possibly needing to change all the reports in |
This is actually never true for CJS files. Example: module.exports = undefined;
export default ['just', 'export', 'static', 'data']; Since Ultimately I would argue that 0% coverage is 0% coverage, regardless of the file being loaded or not it shows that your tests need work. So TBH I'm missing the benefit of being able to list files that were never loaded. |
My thinking is that we shouldn't jump through hoops to try to guess how many lines of code are in files that haven't been loaded, perhaps the reporter could just list lines as What I'd like to avoid in the Perhaps it's enough that we just take the line count of the file, and use this for the initial report, even though this might not be the true line count if the file is actually loaded? |
If we list the files that were never loaded, taking into account your exclude rules and not listing these files, than it's indicative of the fact that you haven't hit 100% coverage. We could exit with |
Sorry this comment was in the context of nyc which lists files that were never loaded as "0% covered". What I meant is I don't see the benefit for nyc to being able to list never loaded files separately from the files that were loaded when the details of what wasn't covered is reported. For c8 I can see it making sense to just count the number of lines in files that weren't loaded and use that to alter the "% total lines" statistic, maybe even have a separate list of files that weren't loaded at all. I think counting the total number of lines in the file as not covered is far more accurate than not counting the file. |
Can we get away from understanding the transpilation happening (via sourcemaps I guess)? Today we have to take that into account when generating reports for typescript, babel etc? |
@j03m I think we can get pretty far potentially:
|
Okay I will put up a draft PR sometime in the next day. |
Draft here: #158 Apologies for the delay. |
@j03m nothing to apologize for! thanks for taking this work on. I'll apologize in advance that it might take me a few days to review 😆 |
No rush! Thanks again for creating this! |
@j03m thank you for the contribution 👍 |
nyc --all
is widely used, an option for c8 to accomplish the same will be needed before many projects are willing to migrate.Half crazy though: should
all: true
be the default,c8 --no-all
to disable it?The text was updated successfully, but these errors were encountered: