简体   繁体   中英

code coverage report for multiple browsers in Karma

How to create code coverage reports for all browsers present in Karma configuration file? My config.js looks like

module.exports = function (config) {
  config.set({
    frameworks: ['jasmine'],
    files: [...],
    browsers: ['IE', 'Firefox', 'Chrome'],
    reporters: ['progress', 'coverage'],
    preprocessors: { '*.js': ['coverage'] },
    coverageReporter: {
      type : 'html',
      dir : ...,
    },
    singleRun: true
     . . . .
});
};

All tests pass fine, but the report is generated only for the browser that finishes last. Json-formatted reports are generated normally for all browsers by the way.

I have

 npm of version 1.4.3 

and

node.js of version 0.10.26

installed on Win8 x64.

PS On Win7 x64 it seems to work: all reports are generated.

It happened to me too. Adding the next configuration will generate the coverage report for all browsers:

singleRun: true

Of course, the drawback is that tests will be ran only one time (the script will exit after that).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM