gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 787 forks source link

I can't get Istanbul to work with Mocha (--delay) and ESM #913

Open jrgleason opened 5 years ago

jrgleason commented 5 years ago

I have the following mocha command that I run for my tests...

istanbul cover mocha --delay --exit ./test/suite.js

async function wire(){
    await import("./Class.spec");
    ...
    run();
}
wire();

When I run I get...

(node:20108) ExperimentalWarning: The ESM module loader is experimental. I:\Code\praesto-dna\packages\services\packages\callminer\node_modules.bin\mocha.CMD:1 (function (exports, require, module, filename, dirname) { @IF EXIST "%~dp0\node.exe" ( ^

SyntaxError: Invalid or unexpected token at new Script (vm.js:79:7)

How do I get this to work with my ESM mocha tests?

Aussie15 commented 5 years ago

Same here please assist?