Skip to content

Vijayasingam/lcov-parser

Repository files navigation

lcov-parser

To Parse LCOV file and print in the console

Build Status codecov contributions welcome

LCOV Parser for monitoring code coverage on changed files.

Usage

Install:

yarn add lcov-parser --dev

At a glance:

// Post-Test script
import { reportCoverage } from "lcov-parser"

reportCoverage({
  // How to sort the entries in the table
  entrySortMethod: "alphabetical", // || "least-coverage" || "most-coverage" || "largest-file-size" ||"smallest-file-size" || "uncovered-lines"
  // The location of the istanbul coverage file.
  coveragePath: "./coverage/coverage-summary.json",
  // Alternatively, if you have multiple coverage summaries, you can merge them into one report
  coveragePaths: ["./dir1/coverage-summary.json", "./dir2/coverage-summary.json"],
  // You can also specify the format, instead of letting it be inferred from the file name
  coveragePath: { path: "./coverage/lcov.info", type: "lcov" /* ||  "json-summary" */},

  // Which set of files to summarise from the coverage file.
  reportFileSet: "all", // || "modified" || "created" || "createdOrModified"

  // Minimum coverage threshold percentages. Compared against the cumulative coverage of the reportFileSet.
  threshold: {
    statements: 100,
    branches: 100,
    functions: 100,
    lines: 100,
  }
})

Inspiration

Inspired by danger-plugin-istanbul-coverage

About

To Parse LCOV file and print in the console

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published