karma-cov.conf.js 616 B

1234567891011121314151617181920212223
  1. const path = require('path');
  2. const baseConf = require('./karma.conf');
  3. module.exports = function(config) {
  4. baseConf(config);
  5. config.reporters = ['mocha', 'coverage-istanbul'];
  6. config.webpack.module.rules.push(
  7. // instrument only testing sources with Istanbul
  8. {
  9. test: /\.js$/,
  10. use: {
  11. loader: 'istanbul-instrumenter-loader',
  12. options: { esModules: true }
  13. },
  14. include: process.env.KARMA_COVER_FOLDER
  15. }
  16. );
  17. config.coverageIstanbulReporter = {
  18. reports: ['html', 'text-summary'],
  19. dir: path.join('.', 'coverage'),
  20. fixWebpackSourcePaths: true
  21. };
  22. };