Open char0n opened 7 years ago
I am having kind of same problem but for me a simple case like 2 ** 3
works but it will fail when using negative numbers.
Actually -2 ** 3
will natively never work in ES, which seems understandable because this syntax is not clear about wether the power is applied on 2 or on -2.
But this would work (-2) ** 3
because the syntax is now explicit.
The problem is that running istanbul, this syntax is simplified in -2 ** 3
which is no more valid.
I used babel to transpile before running istanbul and it worked like a charm after that. Your problem seems quite interesting too.
Okay, nice that you found a workaround. In my case, I am having the problem on backend using node.js so I am not passing through transpilation step.
It seems that istanbul cannot parse code like this.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Exponentiation
Processing file containing this operator throws:
Is there something to bypass this (except using Math.pow of course :) ?