JSPM

parse-lcov

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8030
  • Score
    100M100P100Q186008F
  • License MIT

Parse LCOV

Package Exports

  • parse-lcov

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parse-lcov) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

parse-lcov

NPM TypeScript Coverage Status GitHub Stars Twitter Follow

Parse LCOV.

Full specification: http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php

Installation

yarn add parse-lcov
npm install parse-lcov

API

Usage

import parseLCOV from "parse-lcov";

const lcov = `
TN:
SF:source/file.ts
FN:5,functionA
FN:8,functionB
...
`;

parseLCOV(lcov);

/* Sample Output:
[{
    title: "",
    file: "source/file.ts",
    functions: {
      found: 2,
      hit: 2,
      details: [{
        line: 5,
        hit: 2,
        name: "functionA"
      }, {
        hit: 16,
        line: 8,
        name: "functionB"
      }]
    },
    branches: {
      found: 3,
      hit: 3,
      details: [{
        block: 0,
        branch: 0,
        line: 5,
        taken: 1
      }, {
        block: 1,
        branch: 0,
        line: 9,
        taken: 0
      }]
    },
    lines: {
      found: 13,
      hit: 13,
      details: [{
        hit: 1,
        line: 1
      }]
    }
  }]);
*/

Types

import parseLCOV, { LCOVRecord, FunctionsDetails, BranchesDetails, LinesDetails } from "parse-lcov";

function parseLCOV(string?: string): LCOVRecord[];

type LCOVRecord = {
  title: string;
  file: string;
  functions: LCOVStats & {
    details: FunctionsDetails[];
  };
  branches: LCOVStats & {
    details: BranchesDetails[];
  };
  lines: LCOVStats & {
    details: LinesDetails[];
  };
}

type LCOVStats = {
  found: number;
  hit: number;
}

type FunctionsDetails = {
  name: string;
  line: number;
  hit?: number;
}

type BranchesDetails = {
  line: number;
  block: number;
  branch: number;
  taken: number;
};

type LinesDetails = {
  line: number;
  hit: number;
}

Dev DependenciesDavid


License license

MIT