karma-coverage-istanbul-reporter
A karma reporter that uses the latest istanbul 1.x APIs (with full sourcemap support) to report coverage.
About
This is a reporter only and does not perform the actual instrumentation of your code. Babel users should use the istanbul babel plugin to instrument your code and webpack + typescript users should use the coverage-istanbul-loader and then use this karma reporter to do the actual reporting. See the test config for an e2e example of how to combine them.
Installation
npm install karma-coverage-istanbul-reporter --save-dev
Configuration
const path = require('path');
module.exports = function(config) {
config.set({
plugins: ['karma-coverage-istanbul-reporter'],
reporters: ['coverage-istanbul'],
coverageIstanbulReporter: {
reports: ['html', 'lcovonly', 'text-summary'],
dir: path.join(__dirname, 'coverage'),
combineBrowserReports: true,
fixWebpackSourcePaths: true,
skipFilesWithNoCoverage: true,
'report-config': {
html: {
subdir: 'html'
}
},
thresholds: {
emitWarning: false,
global: {
statements: 100,
lines: 100,
branches: 100,
functions: 100
},
each: {
statements: 100,
lines: 100,
branches: 100,
functions: 100,
overrides: {
'baz/component/**/*.js': {
statements: 98
}
}
}
},
verbose: true
}
});
};
List of reporters and options
Credits
License
MIT