title: mocha nyc and source maps
body: <p>So. I am trying to get my head around why this isn't working.</p>
  
  <p>I am writing source and test TypeScript code in files in the <code>src</code> and <code>tests</code> directory. These are <code>*.ts</code> and <code>*.spec.ts</code> files. </p>
  
  <p>I use <code>npx tsc</code> to transpile both the source and test files to the directory <code>build</code>. So this directory now contains <code>*.js.</code>, <code>*.spec.js</code>, <code>*.js.map</code> and <code>*.spec.js.map</code> file types. </p>
  
  <p><strong><em>How do I setup mocha and nyc to work with this now?</em></strong></p>
  
  <p>I have the following set.</p>
  
  <p>.nycrc.json</p>
  
  <pre><code>{
      "extends": "@istanbuljs/nyc-config-typescript",
      "all": true,
      "branches": 0,
      "lines": 0,
      "functions": 0,
      "statements": 0,
      "check-coverage": true,
      "exclude": [".ignore", "coverage"],
      "report-dir": "./coverage/",
      "cache": false,
      "source-map": true,
      "produce-source-map": true
  }
  </code></pre>
  
  <p>tsconfig.json:</p>
  
  <pre><code>{
      "compilerOptions": {
          "allowJs": true,
          "noImplicitAny": false,
          "strictNullChecks": true,
          "noImplicitThis": true,
          "alwaysStrict": true,
          "module": "commonjs",
          "target": "es2016",
          "lib": ["es2016"],
          "moduleResolution": "node",
          "types": ["mocha", "node"],
          "typeRoots": ["node_modules/@types"],
          "sourceMap": true,
          "outDir": "./build/",
          "skipLibCheck": true,
          "removeComments": false
      },
      "include": ["./**/*.ts", "./**/*.js"]
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>karl@karl-Dell-Precision-M3800:~/dev/escd$ NODE_ENV=test npx nyc --reporter=html --reporter=text mocha "./build/tests/**/*.js"
  mappedCoverage.addStatement is not a function
  </code></pre>
  
  <p>However if I set <code>all</code> to <code>false</code> in the <code>.nycrc.json</code> file, then it doesn't complain. What's up?</p>
  
  <p>I do not wish to use <code>ts-node</code> or anything similar, I have already transpiled the files.</p>