1.0.2 • Published 2 years ago

@types/lcov-parse v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Installation

npm install --save @types/lcov-parse

Summary

This package contains type definitions for lcov-parse (https://github.com/davglass/lcov-parse).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/lcov-parse.

index.d.ts

// Type definitions for lcov-parse 1.0
// Project: https://github.com/davglass/lcov-parse
// Definitions by: Rouslan Placella <https://github.com/roccivic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

declare namespace parse {
    /**
     * Line coverage detail
     */
    interface LcovLine {
        line: number;
        hit: number;
    }
    /**
     * Function coverage detail
     */
    interface LcovFunc {
        name: string;
        line: number;
        hit: number;
    }
    /**
     * Branch coverage detail
     */
    interface LcovBranch {
        line: number;
        block: number;
        branch: number;
        taken: number;
    }
    /**
     * Code coverage for lines, functions or branches in a file
     */
    interface LcovPart<T> {
        hit: number;
        found: number;
        details: T[];
    }
    /**
     * Code coverage for a file
     */
    interface LcovFile {
        title: string;
        file: string;
        lines: LcovPart<LcovLine>;
        functions: LcovPart<LcovFunc>;
        branches: LcovPart<LcovBranch>;
    }
    /**
     * Parses an LCOV code coverage string:
     * ```
     *  parse(lcovString, function(err, data) {
     *      //process the data here
     *  });
     * ```
     *
     * @param str LCOV string to parse
     * @param cb Callback: first arg is `null` or error string,
     *                     second arg is parsed data or `undefined` if an error occurred
     */
    function source(str: string, cb: (err: null | string, data: LcovFile[] | undefined) => void): void;
}

/**
 * Parses an LCOV code coverage file:
 * ```
 *  parse('./path/to/file.info', function(err, data) {
 *      //process the data here
 *  });
 * ```
 *
 * The first argument can also be an LCOV string to parse:
 * ```
 *  parse(lcovString, function(err, data) {
 *      //process the data here
 *  });
 * ```
 *
 * @param file Path to the LCOV file or string to parse
 * @param cb Callback: first arg is `null` or error string,
 *                     second arg is parsed data or `undefined` if an error occurred
 */
declare function parse(file: string, cb: (err: null | string, data: parse.LcovFile[] | undefined) => void): void;

export = parse;

Additional Details

  • Last updated: Mon, 28 Mar 2022 21:01:45 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Rouslan Placella.