3.0.3 • Published 4 years ago

karma-coverage-istanbul-reporter v3.0.3

Weekly downloads
1,250,236
License
MIT
Repository
github
Last release
4 years ago

karma-coverage-istanbul-reporter

Sponsorship Build Status codecov npm version npm Twitter Follow

A karma reporter that uses the latest istanbul 1.x APIs (with full sourcemap support) to report coverage.

About

This is a reporter only and does not perform the actual instrumentation of your code. Babel users should use the istanbul babel plugin to instrument your code and webpack + typescript users should use the coverage-istanbul-loader and then use this karma reporter to do the actual reporting. See the test config for an e2e example of how to combine them.

Installation

npm install karma-coverage-istanbul-reporter --save-dev

Configuration

// karma.conf.js
const path = require('path');

module.exports = function(config) {
  config.set({
    // ... rest of karma config

    // anything named karma-* is normally auto included so you probably dont need this
    plugins: ['karma-coverage-istanbul-reporter'],

    reporters: ['coverage-istanbul'],

    coverageIstanbulReporter: {
      // reports can be any that are listed here: https://github.com/istanbuljs/istanbuljs/tree/73c25ce79f91010d1ff073aa6ff3fd01114f90db/packages/istanbul-reports/lib
      reports: ['html', 'lcovonly', 'text-summary'],

      // base output directory. If you include %browser% in the path it will be replaced with the karma browser name
      dir: path.join(__dirname, 'coverage'),

      // Combines coverage information from multiple browsers into one report rather than outputting a report
      // for each browser.
      combineBrowserReports: true,

      // if using webpack and pre-loaders, work around webpack breaking the source path
      fixWebpackSourcePaths: true,

      // Omit files with no statements, no functions and no branches covered from the report
      skipFilesWithNoCoverage: true,

      // Most reporters accept additional config options. You can pass these through the `report-config` option
      'report-config': {
        // all options available at: https://github.com/istanbuljs/istanbuljs/blob/73c25ce79f91010d1ff073aa6ff3fd01114f90db/packages/istanbul-reports/lib/html/index.js#L257-L261
        html: {
          // outputs the report in ./coverage/html
          subdir: 'html'
        }
      },

      // enforce percentage thresholds
      // anything under these percentages will cause karma to fail with an exit code of 1 if not running in watch mode
      thresholds: {
        emitWarning: false, // set to `true` to not fail the test command when thresholds are not met
        // thresholds for all files
        global: {
          statements: 100,
          lines: 100,
          branches: 100,
          functions: 100
        },
        // thresholds per file
        each: {
          statements: 100,
          lines: 100,
          branches: 100,
          functions: 100,
          overrides: {
            'baz/component/**/*.js': {
              statements: 98
            }
          }
        }
      },

      verbose: true // output config used by istanbul for debugging
    }
  });
};

List of reporters and options

Credits

License

MIT

@eui/deps-base@jframe/iocng-horocom.d3sd1.angular.multiplaformangular-multiplatformkelvin-id-generator-aws-xrayotel-aws-xray-id-generatormost-dependencies@everything-registry/sub-chunk-2005angular-international-phone-input-appennummenilee-chartsembreadbxshark-testfest-skuy-skox@instructure/ui-karma-configfhir2@infinitebrahmanuniverse/nolb-karma-c@fs-tw/theme-alain@evan.network/angular-gulpethnobotany@infglef/ngrx-state@jiatuan/yunhan-cliflavorsomeoo@kengic/ng.testkarma-jasmine-istanbul-webpack-angularjs@rebelcon/dev-depsvue-cli-plugin-ui-karma@jsdevtools/karma-configslides-finderslides-render-angularslides-render-angular-tailwindcsssymbionet-frontend@ngx-elasticsearch/test-utils@mrbuilder/plugin-karma@skblab/angular-defaultsweb-ui-deps@saritasa/react-scripts@samsid032/testing@samsid032/testing-module@skyux-sdk/builderihg-ng-common-pagesjinxiaalong@rkemathew/the-libraryjust-spajpamelddd@nonlux/webpack-configtestlogintestlogin1testlogin2testlogin3testlogin4@ncwade01/makr-frontend-sharedtgframework2.0@leofavre/agargradualisttk@markthree/utilsgss-consumer-qa-automationsunilogin2sumlogin2@openbfs/imis3gisxes-webpack-core@tylertech/forge-cliangular-onscreen-keyboard-newangular-nest-starterangular2-example-http-loginangular-devkit-web3angular-graphql-dev-kit@webank/fes-cliangular-virtual-keysmrbuilder-plugin-karmang2-button-loaderng2-charts-extendedng2-charts-momentlessng2-charts-base-label-updateng2-preloaderng2-accordionswxmcawwnkoux-sooc-scedwebdevkit-gugloading-infomathcalculator@trinitymirrordigital/karma-webpack-setupzoef-essxinxinwoalong@vidal-community/vidal-ngx-sesamemultichain-gas-price-comparator@vue2do/testmyapp19n2wangular-international-phone-inputangular-library-seed-og-test@zalastax/nolb-karma-cngwpngx-classificationaria-testaria-toolsavaility-workflow-angular@aws-crypto/example-browserbuilder-victory-component-dev
3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.1.1

4 years ago

2.1.0

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.1-alpha.0

6 years ago

2.0.0

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.3

6 years ago

1.3.1

6 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago