@atakama/cover-diff

coverage reporter and enforcer for diffs only

Usage no npm install needed!

<script type="module">
  import atakamaCoverDiff from 'https://cdn.skypack.dev/@atakama/cover-diff';
</script>

README

Build Status codecov

cover-diff

Report & enforce diff coverage on diffs only.

Install:

npm install @atakama/cover-diff

Use:

Pipe in diffs, get an lcov file out.

git diff origin/master | cover-diff > diff-cover.lcov
genhtml diff-cover.lcov -o diff-cover

Note:

If you don't have genhtml, do this:

curl -O https://raw.githubusercontent.com/linux-test-project/lcov/master/bin/genhtml
chmod +x genhtml
./genhtml diff-cover.lcov -o diff-cover

That works in most bashifed environments (including Windows under git bash).

Options:

Options are located in the package.json for your project. The default lcov path is the same as the istanbul default output path.

"@atakama/cover-diff" : {
    "lines" : 80,
    "branches" : 70,
    "functions" : 100,
    "lcovFile" : "coverage/lcov.info",
    "diffFile" : \<stdin\>,
    "stripRoot" : [<project-home-dir>],
}

Notes:

  • Empty or invali diff : exit with an error, no stdout.
  • Valid diff, but no lines in the diff match: no error exit, no stdout

Changelog