Karma coverage empty with a simple sample
See original GitHub issuesample 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”,
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Karma coverage always coming empty - Stack Overflow
So I solved it in the following HARD but VERY SIMPLE way: Create a new folder, or delete all the content of the...
Read more >karma-coverage - npm
A Karma plugin. Generate code coverage.. Latest version: 2.2.0, last published: a year ago. Start using karma-coverage in your project by ...
Read more >Karma coverage using Instabul - Medium
In this post I am going to create some simple tests, run them on Karma using Jasmine and finally, show some code coverage...
Read more >Coverage - Karma test runner
For example if all your code lives in lib/ you need to add this to your configuration file. preprocessors = { '**/lib/*.js': 'coverage'...
Read more >Front-End Unit Testing Using Karma Test Runner
This tutorial explains how to setup Karma & automate Front-End Unit Testing ... For example, to publish code test coverage to coveralls.io; ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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