karma-coverage
karma-coverage copied to clipboard
Karma coverage empty with a simple sample
sample project: https://github.com/njleonzhang/karma-study/tree/master/karma-2
Here is the config file:
// Karma configuration
module.exports = function(config) {
config.set({
// plugins
plugins: [
'karma-phantomjs-launcher',
'karma-coverage'
],
// list of files / patterns to load in the browser
files: [
'src/index.js',
'test/index.js'
],
reporters: ['coverage'],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/index.js': ['coverage']
},
coverageReporter: {
dir: './coverage',
// includeAllSources: true,
reporters: [
{ type: 'lcov', subdir: '.' },
{ type: 'text-summary' }
]
},
// enable / disable colors in the output (reporters and logs)
colors: true,
.....
}
result:
=============================== Coverage summary===============================
Statements : 100% ( 0/0 )
Branches : 100% ( 0/0 )
Functions : 100% ( 0/0 )
Lines : 100% ( 0/0 )
================================================================================
version: "karma": "^1.7.1", "karma-coverage": "^1.1.1",
I am too facing the same problem.
same problem here
Same problem here since webpack 4
just add babel-plugin-istanbul to my project in this commit https://github.com/njleonzhang/vue-data-tables/commit/51aab5a53ef5b36d5d4385b73e47e196058d77ec, and the coverage works now.
I am also dealing with that.
I am also dealing with that and I added babel-plugin-istanbul.
I am also dealing with that and I added babel-plugin-istanbul. My problem is solved because the 'include' path in 'babel-loader' is incorrect.
I am also having this issue. Would be great if the karma docs described how to actually add coverage reports... 😥
bump! 🙃
Try the debug logging, maybe that gives a hint.
Thanks @johnjbarton!
Unfortunately, the debug logging didn't give me any hints. 😥
For anyone else frustrated by these issues, I have started another thread about it here: https://github.com/karma-runner/karma/issues/3445