Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

karma-coverage

Package Overview
Dependencies
Maintainers
4
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-coverage

A Karma plugin. Generate code coverage.

  • 2.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7M
increased by3.26%
Maintainers
4
Weekly downloads
 
Created

What is karma-coverage?

The karma-coverage npm package is a plugin for the Karma test runner that generates code coverage reports. It uses Istanbul under the hood to instrument the code and then record the coverage data when the tests are run. The reports can be generated in various formats and can be integrated into continuous integration workflows to ensure code quality.

What are karma-coverage's main functionalities?

Coverage Reporting

This feature allows you to generate coverage reports in various formats such as HTML, LCOV, and JSON. The code sample shows how to configure Karma to use the karma-coverage plugin to generate an HTML coverage report.

module.exports = function(config) {
  config.set({
    // other Karma configuration...
    reporters: ['progress', 'coverage'],
    preprocessors: {
      '**/*.js': ['coverage']
    },
    coverageReporter: {
      type : 'html',
      dir : 'coverage/'
    }
  });
};

Threshold Enforcement

This feature allows you to enforce coverage thresholds. If the code does not meet the specified thresholds for statements, branches, functions, or lines, Karma will exit with an error. The code sample demonstrates how to set these thresholds in the Karma configuration.

module.exports = function(config) {
  config.set({
    // other Karma configuration...
    reporters: ['progress', 'coverage'],
    coverageReporter: {
      check: {
        global: {
          statements: 80,
          branches: 80,
          functions: 80,
          lines: 80
        }
      }
    }
  });
};

Other packages similar to karma-coverage

Keywords

FAQs

Package last updated on 23 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc