-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
feat: exclude lines from processing #212
base: master
Are you sure you want to change the base?
feat: exclude lines from processing #212
Conversation
## Excluding Lines | ||
|
||
Sometimes you might find yourself wanting to exclude lines | ||
in your application (for example, perhaps you have your unit tests inside of a file | ||
you wish to check coverage of, but | ||
you don't want to include the tests in the report). | ||
|
||
To exclude lines, use the special comments `/* c8 exclude start */` and `/* c8 exclude stop */`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this different from /* c8 ignore start */
+ /* c8 ignore end */
? I guess the ignore
marks lines as covered, but this exclude
would not include them in the report at all - like istanbul
instrumented code does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. It excludes the lines from the report.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just my opinion but I think this will be complex for users. This would introduce a second set of ignore hint syntax where:
ignore
would mark lines as covered even if they are notexclude
would remove lines from coverage report - exactly asistanbul
instrumented coverage does for/* istanbul ignore ... */
hints
And this new exclude
hint does not cover all the same cases as ignore
does.
I'm not sure why exactly the ignore
syntax has been implemented so that it works differently when compared to istanbul
instrumented code. I would rather see it work like your exclude
hint here works so that it would completely remove the ignored parts from coverage report.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you about the fact that ignore should work as exclude does.
Sometimes you want to exclude part of the code from the code coverage.
For example, perhaps you have your unit tests inside of a file (because you don't want to export private functions hence,
we test them locally).