karma coverage does not show any data
See original GitHub issueI have included the source files in the files & preprocessors section of my karma conf file. The tests run fine and the junit xml report shows the data. The html coverage just show 100% without any data. I have the similar structure for another project which is working fine but not this one. Not sure if i am missing something. Might be a very minor or silly thing i have missed.
karma.conf.js:
module.exports = function (config) {
config.set({
basePath: '../../',
frameworks: [
'jasmine'
],
// list of files / patterns to load in the browser
files: [
'app/js/**/*.js',
'test/spec/**/*.js'
],
preprocessors: {
'app/js/**/*.js': ['coverage']
},
exclude: [],
reporters: [ 'progress', 'junit', 'coverage' ],
coverageReporter: {
type: 'html',
dir: 'test/reports/unit/coverage'
},
junitReporter: {
outputFile: 'test/reports/unit/junit/junit.xml',
suite: 'unit'
},
port: 9876,
runnerPort: 9100,
colors: true,
logLevel: config.LOG_DEBUG,
autoWatch: false,
browsers: [ 'Chrome' ],
captureTimeout: 60000,
singleRun: true
});
};
my karma conf file is in test -> spec -> conf and source files are in app -> js -> controllers/directives/services
the debug log shows its loading all the files in preprocessors but the report does not show any data “No data to display”.
Issue Analytics
- State:
- Created 9 years ago
- Comments:53 (8 by maintainers)
Top Results From Across the Web
karma coverage does not show any data
1 Answer 1 · Append the basepath to the preprocessor path: ../../app/js/**/*.js': ['coverage'] · Restart karma · View the updated report.
Read more >Problem with karma-coverage
I have the last versions of Karma and karma-coverage and my problem is that when I run the tests with Karma in Windows...
Read more >Find out how much code you're testing
Code coverage reports show you any parts of your code base that might not be properly tested by your unit tests. If you'd...
Read more >Coverage - Karma test runner
This will create a coverage report for every browser that the tests are run in. In addition, it will create a JSON file...
Read more >Coverage no longer works for karma-coverage : WEB-10292
Coverage no longer works for karma-coverage ... From user feedback: I followed the instructions to get the karma plugin installed and had coverage...
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
I’ve had similar issue with browserify + babel + karma. Take a look here.
Key to my setup was to add [“istanbul”] into babel plugins.
I’m not totally sure how related this is but after running into the same issues as others on this thread I looked back into a project I worked on that had this working.
The vital config for me was to require browserify-istanbul in my karma.config.js:
and set this config:
Not totally sure what this points to other than a possible issue with karma-browserify perhaps, but maybe it can help someone…