karma-coverage

WebJar for karma-coverage

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

karma-coverage
Last Version

Last Version

1.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

karma-coverage
WebJar for karma-coverage
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/karma-runner/karma-coverage

Download karma-coverage

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/karma-coverage/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>karma-coverage</artifactId>
    <version>1.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/karma-coverage/
implementation 'org.webjars.npm:karma-coverage:1.1.2'
// https://jarcasting.com/artifacts/org.webjars.npm/karma-coverage/
implementation ("org.webjars.npm:karma-coverage:1.1.2")
'org.webjars.npm:karma-coverage:jar:1.1.2'
<dependency org="org.webjars.npm" name="karma-coverage" rev="1.1.2">
  <artifact name="karma-coverage" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='karma-coverage', version='1.1.2')
)
libraryDependencies += "org.webjars.npm" % "karma-coverage" % "1.1.2"
[org.webjars.npm/karma-coverage "1.1.2"]

Dependencies

compile (5)

Group / Artifact Type Version
org.webjars.npm : minimatch jar [3.0.0,4)
org.webjars.npm : source-map jar [0.5.1,0.6)
org.webjars.npm : istanbul jar [0.4.0,0.5)
org.webjars.npm : lodash jar [4.17.0,5)
org.webjars.npm : dateformat jar [1.0.6,2)

Project Modules

There are no modules declared in this project.

karma-coverage

js-standard-style npm version npm downloads

Build Status Dependency Status devDependency Status

Generate code coverage using Istanbul.

Installation

The easiest way is to install karma-coverage as a devDependency, by running

npm install karma karma-coverage --save-dev

Configuration

For configuration details see docs/configuration.

Examples

Basic

// 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/'
    }
  });
};

CoffeeScript

For an example on how to use with CoffeeScript see examples/coffee. For an example of how to use with CoffeeScript and the RequireJS module loader, see examples/coffee-requirejs (and also see the useJSExtensionForCoffeeScript option in docs/configuration.md).

Advanced, multiple reporters

// karma.conf.js
module.exports = function(config) {
  config.set({
    files: [
      'src/**/*.js',
      'test/**/*.js'
    ],
    reporters: ['progress', 'coverage'],
    preprocessors: {
      'src/**/*.js': ['coverage']
    },
    coverageReporter: {
      // specify a common output directory
      dir: 'build/reports/coverage',
      reporters: [
        // reporters not supporting the `file` property
        { type: 'html', subdir: 'report-html' },
        { type: 'lcov', subdir: 'report-lcov' },
        // reporters supporting the `file` property, use `subdir` to directly
        // output them in the `dir` directory
        { type: 'cobertura', subdir: '.', file: 'cobertura.txt' },
        { type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' },
        { type: 'teamcity', subdir: '.', file: 'teamcity.txt' },
        { type: 'text', subdir: '.', file: 'text.txt' },
        { type: 'text-summary', subdir: '.', file: 'text-summary.txt' },
      ]
    }
  });
};

FAQ

Don't minify instrumenter output

When using the istanbul instrumenter (default), you can disable code compaction by adding the following to your configuration.

// karma.conf.js
module.exports = function(config) {
  config.set({
    coverageReporter: {
      instrumenterOptions: {
        istanbul: { noCompact: true }
      }
    }
  });
};

For more information on Karma see the homepage.

org.webjars.npm

Karma

The Spectacular Test Runner for JavaScript.

Versions

Version
1.1.2
1.0.0
0.5.5
0.5.3
0.5.0