title: How to configure code coverage for .vue files?
body: <p>I'm using mocha for unit testing and want to add code coverage. For that I added nyc, istanbul-instrumenter-loader and babel-plugin-istanbul and it works for js files but for .vue files an error occurs: &quot;TypeError: Cannot read property 'fileCoverage' of undefined&quot;. Please help me</p>
  <p>package.json</p>
  <pre><code>{
  &quot;name&quot;: &quot;ZINGUI&quot;,
  &quot;version&quot;: &quot;1.0.0&quot;,
  &quot;description&quot;: &quot;ZINGWHEEEE&quot;,
  &quot;author&quot;: &quot;John Matos &lt;rDr4g0n@gmail.com&gt;&quot;,
  &quot;private&quot;: true,
  &quot;browserslist&quot;: [
      &quot;defaults&quot;
  ],
  &quot;workspaces&quot;: [
      &quot;packages/z-common&quot;,
      &quot;packages/z-search&quot;,
      &quot;packages/z-ui&quot;,
      &quot;packages/z-admin-module&quot;,
      &quot;packages/z-smartviewz-module&quot;,
      &quot;packages/z-theme&quot;,
      &quot;packages/z-dashboard-module&quot;,
      &quot;packages/z-dashboard-base-tiles&quot;,
      &quot;packages/z-events-module&quot;,
      &quot;packages/z-user-module&quot;,
      &quot;packages/z-mock-client&quot;,
      &quot;packages/z-catalog&quot;
  ],
  &quot;scripts&quot;: {
      &quot;dev&quot;: &quot;yarn run z-ui&quot;,
      &quot;z-ui&quot;: &quot;yarn run --cwd=packages/z-ui dev&quot;,
      &quot;watch&quot;: &quot;node scripts/watch.js&quot;,
      &quot;build&quot;: &quot;npm-run-all lint test build-ui&quot;,
      &quot;build-ui&quot;: &quot;yarn run --cwd=packages/z-ui build&quot;,
      &quot;lint&quot;: &quot;yarn workspaces run lint&quot;,
      &quot;test&quot;: &quot;yarn workspaces run test&quot;,
      &quot;test:coverage&quot;: &quot;nyc yarn run test&quot;,
      &quot;bootstrap&quot;: &quot;yarn install&quot;,
      &quot;clean&quot;: &quot;yarn workspaces run clean &amp;&amp; rm -rf node_modules&quot;,
      &quot;add-package&quot;: &quot;cd packages &amp;&amp; vue init ../scripts/package-template&quot;,
      &quot;playground&quot;: &quot;yarn run --cwd=playground playground&quot;,
  
  },
  &quot;dependencies&quot;: {
      &quot;@vue/composition-api&quot;: &quot;^0.3.4&quot;,
      &quot;atob&quot;: &quot;^2.1.0&quot;,
      &quot;cryptiles&quot;: &quot;^4.1.2&quot;,
      &quot;dot-prop&quot;: &quot;^4.2.1&quot;,
      &quot;fstream&quot;: &quot;^1.0.12&quot;,
      &quot;graphql&quot;: &quot;^0.13.2&quot;,
      &quot;sshpk&quot;: &quot;^1.13.2&quot;,
      &quot;stringstream&quot;: &quot;^0.0.6&quot;,
      &quot;vue&quot;: &quot;^2.6.6&quot;,
      &quot;vue-router&quot;: &quot;3.0.1&quot;,
      &quot;vuetify&quot;: &quot;2.4.0&quot;,
      &quot;vuex&quot;: &quot;^3.5.1&quot;,
      &quot;clone&quot;: &quot;^2.1.2&quot;,
      &quot;cookies-js&quot;: &quot;^1.2.3&quot;,
      &quot;d3&quot;: &quot;^5.7.0&quot;,
      &quot;d3-format&quot;: &quot;^1.4.3&quot;,
      &quot;deep-equal&quot;: &quot;^2.0.1&quot;,
      &quot;deepmerge&quot;: &quot;^4.2.2&quot;,
      &quot;graphql-tag&quot;: &quot;^2.10.3&quot;,
      &quot;humanize&quot;: &quot;^0.0.9&quot;,
      &quot;humanize-duration&quot;: &quot;^3.22.0&quot;,
      &quot;moment&quot;: &quot;^2.24.0&quot;,
      &quot;throttle-debounce&quot;: &quot;^2.2.1&quot;,
      &quot;yamr-js&quot;: &quot;zenoss/yamr-js#4.6.2&quot;,
      &quot;z-admin-module&quot;: &quot;^1.0.0&quot;,
      &quot;z-catalog&quot;: &quot;^1.0.0&quot;,
      &quot;z-common&quot;: &quot;^1.0.0&quot;,
      &quot;z-dashboard-module&quot;: &quot;^1.0.0&quot;,
      &quot;z-events-module&quot;: &quot;^1.0.0&quot;,
      &quot;z-mock-client&quot;: &quot;^1.0.0&quot;,
      &quot;z-search&quot;: &quot;^1.0.0&quot;,
      &quot;z-smartviewz-module&quot;: &quot;^1.0.0&quot;,
      &quot;z-theme&quot;: &quot;^1.0.0&quot;,
      &quot;z-user-module&quot;: &quot;^1.0.0&quot;,
      &quot;z-in-time&quot;: &quot;zenoss/z-in-time#1.1.7&quot;
  },
  &quot;devDependencies&quot;: {
      &quot;chai-sorted&quot;: &quot;^0.2.0&quot;,
      &quot;backstopjs&quot;: &quot;^4.5.0&quot;,
      &quot;babel-plugin-istanbul&quot;: &quot;^6.0.0&quot;,
      &quot;chai&quot;: &quot;^4.1.2&quot;,
      &quot;core-js&quot;: &quot;3&quot;,
      &quot;chokidar&quot;: &quot;^2.0.1&quot;,
      &quot;eslint&quot;: &quot;^4.19.1&quot;,
      &quot;eslint-config-airbnb-base&quot;: &quot;^13.0.0&quot;,
      &quot;eslint-friendly-formatter&quot;: &quot;^3.0.0&quot;,
      &quot;eslint-import-resolver-webpack&quot;: &quot;^0.8.3&quot;,
      &quot;eslint-loader&quot;: &quot;^2.0.0&quot;,
      &quot;eslint-plugin-import&quot;: &quot;^2.20.0&quot;,
      &quot;eslint-plugin-vue&quot;: &quot;^6.2.2&quot;,
      &quot;eslint-plugin-vuetify&quot;: &quot;^1.0.0-beta.7&quot;,
      &quot;inject-loader&quot;: &quot;^4.0.1&quot;,
      &quot;istanbul-instrumenter-loader&quot;: &quot;^3.0.1&quot;,
      &quot;jsdom&quot;: &quot;^11.12.0&quot;,
      &quot;jsdom-global&quot;: &quot;^3.0.2&quot;,
      &quot;mocha&quot;: &quot;^5.2.0&quot;,
      &quot;mocha-webpack&quot;: &quot;2.0.0-beta.0&quot;,
      &quot;npm-run-all&quot;: &quot;^4.1.2&quot;,
      &quot;nyc&quot;: &quot;^15.1.0&quot;,
      &quot;sinon&quot;: &quot;^6.1.4&quot;,
      &quot;sinon-chai&quot;: &quot;^3.2.0&quot;,
      &quot;webpack-merge&quot;: &quot;^4.1.0&quot;,
      &quot;webpack-node-externals&quot;: &quot;^1.7.2&quot;,
      &quot;yargs&quot;: &quot;^15.1.0&quot;
  }
  </code></pre>
  <p>}</p>
  <p>.babelrc</p>
  <pre><code>{
    &quot;env&quot;: {
      &quot;development&quot;: {
        &quot;presets&quot;: [
          [&quot;env&quot;, { &quot;modules&quot;: false }],
          &quot;stage-3&quot;
        ]
      },
      &quot;production&quot;: {
        &quot;presets&quot;: [
          [&quot;env&quot;, { &quot;modules&quot;: false }],
          &quot;stage-3&quot;
        ]
      },
      &quot;test&quot;: {
        &quot;presets&quot;: [
          [&quot;env&quot;, {
            &quot;modules&quot;: false,
            &quot;targets&quot;: { &quot;node&quot;: &quot;current&quot; }
          }],
          &quot;stage-3&quot;
        ],
          &quot;plugins&quot;: [
              [&quot;istanbul&quot;, {
                  &quot;exclude&quot;: [
                      &quot;**/*.spec.js&quot;
                  ]
              }]
          ]
      }
    }
  }
  </code></pre>
  <p>webpack.base.conf.js</p>
  <pre><code>            {
              test: /\.js$|\.vue$/,
              use: {
                  loader: &quot;istanbul-instrumenter-loader&quot;,
                  options: { esModules: true }
              },
              enforce: 'post',
              exclude: /node_modules|\.spec\.js$/
          }
  </code></pre>