3

I have a typescript project that is using Mocha to generate coverage. I would like to convert the coverage back to the typescript files using remap-istanbul, however I keep on getting this error when I try to run remap-istanbul on my coverage:

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

I've googled the issue and the two options I've found are either changing the compliation to "ES5" rather than "ES6" (which I cannot do as my tests will fail if I change it to ES5) or adding "use strict"; inside the block of code (which I cannot do because it is not my project).

Are there any other ways of getting around this issue?

Tibrogargan
  • 4,508
  • 3
  • 19
  • 38
annedroiid
  • 6,267
  • 11
  • 31
  • 54
  • 3
    This has been answered fairly well by this question https://stackoverflow.com/questions/31391760/use-strict-needed-in-a-typescript-file – Jonathan Park Dec 20 '16 at 01:40
  • I want it set for the javascript project remap-instanbul that I'm trying to run though, not my own typescript project. – annedroiid Dec 20 '16 at 01:43
  • 1
    Oh I think I misread the question. You can run node with `--use_strict` to force strict mode http://stackoverflow.com/questions/33063206/proper-way-of-using-es6-classes-in-a-nodejs-project – Jonathan Park Dec 20 '16 at 01:54
  • Possible duplicate of ["Use Strict" needed in a TypeScript file?](http://stackoverflow.com/questions/31391760/use-strict-needed-in-a-typescript-file) – Tibrogargan Apr 30 '17 at 22:30

0 Answers0