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

danger-plugin-coverage

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

danger-plugin-coverage

A Danger plugin to report code coverage.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2K
decreased by-35.08%
Maintainers
1
Weekly downloads
 
Created
Source

danger-plugin-coverage

npm version semantic-release .github/workflows/deploy.yml

A Danger plugin to report code coverage.

This plugin reads coverage report in the clover.xml format. This format is output by various JavaScript testing libraries, such as Jest, as well as testing libraries for other languages, such as PHPUnit.

Usage

Install:

yarn add danger-plugin-coverage --dev

At a glance:

// dangerfile.js
import coverage from 'danger-plugin-coverage';

schedule(coverage());

Note that the coverage report output by your test runner must exist before Danger is run. By default we will look for the report at coverage/clover.xml, which is the default output location for Jest.

Coverage will be reported as in the example below.


Coverage Report

Test coverage is looking a little low for the files created or modified in this PR, perhaps we need to improve this.

Coverage threshold for branches (80%) not met: 33.33%
Coverage threshold for functions (80%) not met: 66.67%
Impacted Files% Stmts% Branch% Funcs
src/module-one.js100100100:white_check_mark:
src/module-two.js95.2433.3366.67:x:
src/module-three.js82.3310044.55:x:
src/module-four.js95.2482.5581.55:white_check_mark:

Settings

The function accepts a settings object with the following properties:

namedescription
successMessageA custom message to show when coverage is above the threshold.
failureMessageA custom message to show when coverage is bellow the threshold.
cloverReportPathThe relative path to the clover.xml file.
maxRowsThe number of rows to show (additional rows will be collapsed within a <details> element).

Example:

import coverage from 'danger-plugin-coverage';

schedule(coverage({
  successMessage: ':+1: Test coverage is looking good.',
  failureMessage: ':-1: Test coverage is not looking so good.',
  cloverReportPath: './coverage/clover.xml',
  maxRows: 5,
}));

Keywords

FAQs

Package last updated on 31 Oct 2020

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