3.2.0 • Published 2 years ago

coverage-diff v3.2.0

Weekly downloads
1,462
License
MIT
Repository
github
Last release
2 years ago

coverage-diff

What it does

  • Accepts base-summary.json and head-summary.json
  • Diffs the two jsons and outputs info about
    • Percentage of changed coverage (in changed/added files)
    • Formatted as markdown table
  • Fail if coverage decreases on a file (check on percentage) for any of the lines/func/statements/branches. Can  be configured to only check some criteria.
  • Separate threshold for new files newFileCoverageThreshold, defaults to coverageThreshold if not passed
  • Written in Typescript.

Usage

import fs from 'fs';
import { diff as coverageDiff } from 'coverage-diff';

const base = JSON.parse(fs.readFileSync('./base-summary.json'));
const head = JSON.parse(fs.readFileSync('./head-summary.json'));
const diff = coverageDiff.diff(base, head);

console.log(diff.diff);
console.log(diff.results);
console.log(diff.regression);

Out:

OkFileLinesBranchesFunctionsStatements
🔴file180%(+10%)14%(-30%)3%(+20%)20%(-10%)
file220%(+10%)8%(-30%)2%(-20%)5%(-10%)

API at https://flaviusone.github.io/coverage-diff/

3.2.0

2 years ago

3.1.0

3 years ago

1.6.1

3 years ago

3.0.0

3 years ago

2.0.0

3 years ago

1.6.0

5 years ago

1.5.2

6 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago