karma-coverage travis-ci npm

A Karma plugin. Generate code coverage.

karma-coverage Build Status

Generate code coverage using Istanbul.

Installation

The easiest way is to keep karma-coverage as a devDependency in your package.json.

{
  "devDependencies": {
    "karma": "~0.10",
    "karma-coverage": "~0.1"
  }
}

You can simple do it by:

npm install karma-coverage --save-dev

Configuration

Following code shows the default configuration…

// karma.conf.js
module.exports = function(config) {
  config.set({
    files: [
      'src/**/*.js',
      'test/**/*.js'
    ],

    // coverage reporter generates the coverage
    reporters: ['progress', 'coverage'],

    preprocessors: {
      // source files, that you wanna generate coverage for
      // do not include tests or libraries
      // (these files will be instrumented by Istanbul)
      'src/*.js': ['coverage']
    },

    // optionally, configure the reporter
    coverageReporter: {
      type : 'html',
      dir : 'coverage/'
    }
  });
};

Options

type

Type: String

Possible Values: * html (default) * lcov (lcov and html) * lcovonly * text * text-summary * cobertura (xml format supported by Jenkins) * teamcity (code coverage System Messages for TeamCity)

If you set type to text or text-summary, you may set the file option, like this.

coverageReporter = {
  type : 'text',
  dir : 'coverage/',
  file : 'coverage.txt'
}

If no filename is given, it will write the output to the console.

dir

Type: String

Description: This will be used to output coverage reports. When you set a relative path, the directory is resolved against the basePath.

multiple reporters

You can use multiple reporters, by providing array of options.

coverageReporter: {
  reporters:[
    {type: 'html', dir:'coverage/'},
    {type: 'teamcity'},
    {type: 'text-summary'}
  ],
}

For more information on Karma see the homepage.

Related Repositories

karma-coverage

karma-coverage

A Karma plugin. Generate code coverage. ...

vulgar

vulgar

A simple and scalable MEAN stack development kit featuring Angular 2 (Router, Http, Forms, Services, Tests, E2E, Coverage, Dev/Prod), Express, MongoDB, Mongoose, Node, Redux, @ngrx/store, PassportJS, Socket.io, Karma, Protractor, Jasmine, Istanbul, SASS ...

ng2-mean-webpack

ng2-mean-webpack

A MEAN stack development kit featuring Angular 2 (Router, Http, Forms, Services, Tests, E2E, Coverage, Dev/Prod), Express, MongoDB, Mongoose, Node, PassportJS, Socket.io, Karma, Protractor, Jasmine, Istanbul, SASS Support, TypeScript, TSLint, NG2Lint, Hot ...

es6-karma-jasmine-webpack-boilerplate

es6-karma-jasmine-webpack-boilerplate

Boilerplate for ES6 client-based library. Uses Babel and webpack for transpiling and building, Karma and Jasmine for unit testing, and Istanbul/Isparta for code coverage. ...

babel-jspm-karma-jasmine-istanbul

babel-jspm-karma-jasmine-istanbul

Babel JSPM Karma Jasmine Istanbul Coverage example and tutorial ...


Top Contributors

vojtajina dignifiedquire abierbaum juliemr can3p chrisgladd mrzepinski manevpe kombucha Constellation aprooks

Releases

-   v0.1.5 zip tar
-   v0.1.4 zip tar
-   v0.1.3 zip tar
-   v0.1.2 zip tar
-   v0.1.1 zip tar
-   v0.1.0 zip tar
-   v0.0.5 zip tar
-   v0.0.4 zip tar
-   v0.0.3 zip tar