gotwarlost / istanbul-middleware

Connect middleware for server side code coverage using istanbul
Other
179 stars 96 forks source link

Failure instrumenting specific code #35

Open Dhashin opened 7 years ago

Dhashin commented 7 years ago

Instrumentation failing on js files that have keywords "export" and/or "import". Error: Line 1: Unexpected token

Trying to instrument a program and provide code coverage for selenium tests. Currently struggling with this.

AlbanMinassian commented 7 years ago

same error with this code

const im = require('istanbul-middleware'),
im.hookLoader(currentpath); // cover all files except under node_modules

no error if you write

const im = require('istanbul-middleware'); // <== ``;`` here, not ``,``
im.hookLoader(currentpath); // cover all files except under node_modules

you can close

Dhashin commented 7 years ago

I'm not experiencing the issue during execution of the driver. Experiencing the issue during instrumentation. So when i run : istanbul instrument "path_to_code" --output "output_path" --embed-source-true

then only do I experience this issue. I think it has to do with support for ES6 and typescript, because I've seen similar problems experienced by other users for ISTANBUL, however i cant be sure