title: Minimalistic nyc (istanbul) javascript coverage not working for es-modules (ESM)
body: <p>Trying to figure out why I get no coverage out of <code>nyc</code> whatsovever, I ended up with a file single file <code>./x.js</code> that only contains</p>
  <pre class="lang-js prettyprint-override"><code>#!/usr/bin/env node
  'use strict'
  console.log('======= starting tests =======');
  </code></pre>
  <p>In <code>package.json</code> I have</p>
  <pre class="lang-json prettyprint-override"><code>  ...
    &quot;scripts&quot;: {
      &quot;test&quot;: &quot;nyc ./x.js&quot;,
    }
    ...
  </code></pre>
  <p>and when I run <code>npm run test</code> I get the following</p>
  <ul>
  <li>console log from the one-liner</li>
  <li>a html coverage report as requested in the config (see below), yet the line is not market as covered</li>
  <li>despite configuring a cache directory, it stays empty which seems to indicate that on-the-fly instrumentation is not done.</li>
  </ul>
  <p>From all the examples on net I assumed that instrumentation is done on the fly and that <code>nyc instrument</code> is rather for special uses cases. Can anyone provide some inside what is going on and what not? Here is (one of the gazillion versions of) the config I tried:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;cache&quot;: true,
    &quot;cache-dir&quot;: &quot;./kkk&quot;,
    &quot;instrument&quot;: true,
    &quot;extension&quot;: [
      &quot;.ts&quot;,
      &quot;.js&quot;
    ],
    &quot;include&quot;: [
      &quot;**/x.js&quot;
    ],
    &quot;reporter&quot;: [
        &quot;html&quot;
    ],
    &quot;all&quot;: true
  }
  </code></pre>
  <p>I start getting coverage output when <strong>not</strong> using <code>&quot;type&quot;: &quot;module&quot;</code> in my <code>package.json</code>.</p>
  <p><strong>Versions</strong>:</p>
  <ul>
  <li>node: v16.13.2</li>
  <li>nyc: 15.1.0</li>
  </ul>