title: Istanbul coverage unknown% after running mounted tests in container
body: <p>I am trying to set up coverage for unit tests that run in a docker container. However, the coverage reports fail generating as expected inside the container. But, they succeed generating when the command is run outside the container (on Mac OSX and CentOS).</p>
  
  <p>I mount my codebase to a pre-existing path in the image.</p>
  
  <p>The image is based on node:8.11.4<br>
  karma v3.1.4<br>
  karma-coverage v1.1.2<br>
  karma-coverage-istanbul-reporter v2.0.4<br>
  karma-webpack v4.0.0-rc.5<br>
  istanbul-instrumenter-loader v.3.0.1 . </p>
  
  <p>Attempts to tease out the issue:</p>
  
  <ul>
  <li>Setting basePath to <code>__dirname</code> in karma.conf.js</li>
  <li>Normalizing all paths with <code>path.join</code> in karma.conf.js and entry points used by webpack.</li>
  <li>Validate that the source is being bundled.</li>
  <li>Ran outside container on Mac OSX and CentOS (reports succeed)</li>
  <li>Set debug to true for the instrumenter (no errors)</li>
  <li>Reinstall mounted node_modules from inside container</li>
  <li>Use <code>coverage</code> and <code>istanbul-coverage</code> reporters.</li>
  <li>Turn off sandbox for Chrome v72.0.3626.81 (headless)</li>
  <li>Ran locally and in Jenkins (same results)</li>
  <li>removing <code>-u $(id -u):$(id -g)</code> doesn't make a difference</li>
  </ul>
  
  <p>What code would you like to see?</p>
  
  <pre><code>docker run --privileged \
  -u $(id -u):$(id -g) \
  --mount type=bind,source=$(pwd),dst=/home/node/test/ \
  -it $DOCKER_IMAGE \
  /bin/bash -c "npm test"
  </code></pre>
  
  <p>Expected:</p>
  
  <pre><code>=============================== Coverage summary ===============================
  Statements   : 22.71% ( 7684/33837 )
  Branches     : 15.17% ( 2887/19027 )
  Functions    : 21.85% ( 1384/6334 )
  Lines        : 21.45% ( 6719/31327 )
  ================================================================================
  </code></pre>
  
  <p>Actual:</p>
  
  <pre><code>17:40:18 =============================== Coverage summary ===============================
  17:40:18 Statements   : Unknown% ( 0/0 )
  17:40:18 Branches     : Unknown% ( 0/0 )
  17:40:18 Functions    : Unknown% ( 0/0 )
  17:40:18 Lines        : Unknown% ( 0/0 )
  17:40:18 ================================================================================
  </code></pre>