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

istanbul cover hiding errors with octal literals #933

Open
Jimbly opened this issue May 10, 2020 · 0 comments
Open

istanbul cover hiding errors with octal literals #933

Jimbly opened this issue May 10, 2020 · 0 comments

Comments

@Jimbly
Copy link

Jimbly commented May 10, 2020

When running invalid Javascript through Istanbul, it is converting potentially unsupported numeric encodings (e.g. 0o1234 pre-ES2015) into decimal and hiding actual errors.

The npm module yazl has been passing it's Travis/Istanbul tests for years on Node v0.10.48, despite having ES2015-only octal literals in the code.

This line of code:

console.log(0o1234);

When run on Node v0.10.48 gives SyntaxError: Unexpected token ILLEGAL, but when sent through istanbul instrument I see this output:

__cov_iCMg9NRFTwMrHhpLiqgjqg.s['1']++;console.log(668);

Which suddenly has become valid Javascript, despite the original source not being such.

Pretty minor (I've recommended the YAZL author simply drop "support" for Node v0.10.48, since the module has not actually ran on that platform for many years), but was quite the head-scratcher to track down why an octal literal in the module was "ok" but was failing when used in the unit tests!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant