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

Ensure we're not bypassing loc that should be covered #620

Merged
merged 1 commit into from Aug 14, 2016

Conversation

@jedireza
Copy link
Contributor

jedireza commented Aug 13, 2016

I experienced a strange case of unexpected 100% test coverage when transpiling (seen at nlf/lab-babel#9). This may also be relevant to hapijs/lab#459.

I found that if we place /* $lab:coverage:(off|on)$ */ in certain positions in the tree, we could accidentally bypass loc that should be covered. This happens because we only check if the node's starting range is in the bypass object without ensuring the entire node should be skipped.

By adding an additional check that the node's end range is also included in the bypass object, we allow annotate(...) to continue recursively processing.

My new test case doesn't use transpilation, but simply puts /* $lab:coverage:(off|on)$ */ in positions that reproduce the symptom as I found it.

Feedback is much appreciated.

@geek geek self-assigned this Aug 14, 2016
@geek geek added the bug label Aug 14, 2016
@geek geek added this to the 10.9.1 milestone Aug 14, 2016
@geek geek merged commit 06b57f9 into hapijs:master Aug 14, 2016
2 checks passed
2 checks passed
Node Security No known vulnerabilities found
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@geek

This comment has been minimized.

Copy link
Member

geek commented Aug 14, 2016

@jedireza nice find, sorry you ran into this bug :/

@jedireza jedireza deleted the jedireza:coverage-fix branch Aug 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.