You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constobj={a: 'a'}/* istanbul ignore if */if('b'inobj){console.log('this should not be instrumented')}
The output of nyc instrument --compact=false for this file is:
/* ...clipped... */constobj=(cov_2oqccc38jn.s[0]++,{a: 'a'/* istanbul ignore if */});cov_2oqccc38jn.s[1]++;if('b'inobj){cov_2oqccc38jn.b[0][0]++;cov_2oqccc38jn.s[2]++;console.log('this should not be instrumented');}else{cov_2oqccc38jn.b[0][1]++;}
Somehow the hint is getting moved up. I'm only able to reproduce this issue when the statement before the hint is a literal object assignment with at least one key and no semi-colons are used. Not sure yet if this is a bug in istanbul-lib-instrument or if babel is doing something unexpected.
The text was updated successfully, but these errors were encountered:
Additional detail, the above code results in the istanbul hint being seeing in node.trailingComments for node.type === 'VariableDeclaration'. Adding a semi-colon to the assignment const obj = {a: 'a'}; causes the comment to also be seen in node.leadingComments for node.type === 'IfStatement'.
This issue happens regardless of if the assignment is a variable declaration or not.
The output of
nyc instrument --compact=false
for this file is:Somehow the hint is getting moved up. I'm only able to reproduce this issue when the statement before the hint is a literal object assignment with at least one key and no semi-colons are used. Not sure yet if this is a bug in istanbul-lib-instrument or if babel is doing something unexpected.
The text was updated successfully, but these errors were encountered: