Skip to content

Conversation

@HCanber
Copy link
Contributor

@HCanber HCanber commented Oct 26, 2015

Fixes #470

Do not add tracking code before var in for(var x of xs)
This occurs when this is true:

node.type == "VariableDeclaration"
node.parent.type == "ForOfStatement"

This PR includes new code in partial.js (as this was where I found for(var x in xs)) which is used in a test in coverage.js.
I hope this was the correct place to add it.

Håkan Canberger added 2 commits October 26, 2015 08:56
…e for-of

I got numbers in test/coverage.js (percent, sloc & hits) by first adding
another for-in loop into partial.js below the existing one:
    for (var o in j) {
        ++l;
    }

When the test worked and 100% code coverage was achieved, the loop was
changed to for (var o of j)
This occurs when this is true:
node.type == "VariableDeclaration"
node.parent.type == "ForOfStatement"

Fixes issue hapijs#470
@Marsup
Copy link
Contributor

Marsup commented Oct 26, 2015

LGTM. As for CI, maybe next lab should be node 4+.

@geek
Copy link
Member

geek commented Oct 26, 2015

@Marsup I think you are onto a good plan. I will work on ironing out the details and see about making lab 7 be node 4+

@geek geek added the bug Bug or defect label Oct 27, 2015
@geek geek added this to the 7.0.0 milestone Oct 27, 2015
@geek geek self-assigned this Oct 27, 2015
geek added a commit that referenced this pull request Oct 27, 2015
Do not add tracking code before "var" in "for(var x of xs)"
@geek geek merged commit cb999c1 into hapijs:master Oct 27, 2015
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Bug or defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

for(var x of xs) is not handled correctly when coverage is turned on

3 participants