2.2.1 • Published 1 year ago

karma-coverage v2.2.1

Weekly downloads
553,161
License
MIT
Repository
github
Last release
1 year ago

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.

neo-ui-template@jframe/iockarmafy@rock-kit/ui-karma-configak-gulpdialer-reportsexecutable_esm_aa_webcomponentsdebox-web-coresammenpeach-clies6-workflowangular-rx-ui@temporg/config-karma@temporg/ui-karma-config@dotedu/ivx-web-story-forgeeduihst-component-system@cvpcasada/nwbng2workspace-addon-webpack-karmavbteslint-config-helmng2-lib-projmost-dependencies@everything-registry/sub-chunk-2005plus.webclient.buildtable-generatortable-generator-testsynaptic-scoutsystem-canopy-scripttest-guanlecojawix-gruntfilewa.component.validatorwa.validator2web-modules-utilsweb-ui-depsvulcan-jslintervusion-clivx-workflow-engineweiler-electrode-archetype-react-app-devxdc-karmaxipcodexes-webpack-coresaguisamp_ravi_kumarrest-storage-editorrig-unit-testroc-plugin-test-mocha-karma-webpackspoonx-toolsrsc-testrunpackrgui-toolstestenvtest_gulu_leetestfullsusi-forgevue-click-to-editvue-color-tablevue-cli-plugin-ui-karmavue-buildvideojs-generate-karma-configvui-helpers@starpack/starpackmimosa-karma-enterprisemetal-karma-configlnpay-jslib-toolsliferay-karma-configliferay-forms-gulp-tasksliferay-forms-ui-testsgriptjnwbhulixhyperwireicx4jacks-angular4-climaiteamicropackleighton-gulplithium-sdkmpd-parser-1mozilla-neogrumbler-scriptsgrunt-niagaraguanlecojaguanlecoja-testguanlecoja_testgrunt-karma-coverallsgrunt-laxargs-clihw-javascript-sdkhornet-js-builderhornet-js-builder-newifetgulp-helpersgulp-component-helpergulp-config-apsisgulp-angular-library-buildergulp-angular-workflowgulp-core-build-karmagulp-fibre-tasks
2.2.1

1 year ago

2.2.0

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.3

4 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.2

7 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

9 years ago

0.5.5

9 years ago

0.5.4

9 years ago

0.5.3

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.7

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

11 years ago

0.2.3

11 years ago

0.2.2

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

12 years ago

0.0.1

12 years ago