lcov-parse

Parse lcov results files and return JSON

BSD-3-Clause 11 个版本
安装
npm install lcov-parse
yarn add lcov-parse
pnpm add lcov-parse
bun add lcov-parse
README

LCOV file parser

Simple LCOV file parser

Installation

npm install lcov-parse

Usage

var parse = require('lcov-parse');

parse('./path/to/file.info', function(err, data) {
    //process the data here
});

or

parse(lcovString, function(err, data) {
    //process the data here
});

Formatting

Using this as a guide: http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php

It will return JSON like this:

 {
    "title": "Test #1",
    "file": "anim-base/anim-base-coverage.js",
    "functions": {
      "hit": 23,
      "found": 29,
      "details": [
        {
          "name": "(anonymous 1)",
          "line": 7,
          "hit": 6
        },
        {
          "name": "(anonymous 2)",
          "line": 620,
          "hit": 225
        },
        {
          "name": "_end",
          "line": 516,
          "hit": 228
        }
      ]
    }
    "lines": {
      "found": 181,
      "hit": 143,
      "details": [
        {
          "line": 7,
          "hit": 6
        },
        {
          "line": 29,
          "hit": 6
        }
      ]
    }
}

Cli Usage

lcov-parse ./lcov.info

or

cat lcov.info | xargs -0 lcov-parse

Tests

npm install && npm test

Build Status

Build Status

版本列表
1.0.0 2017-06-12
0.0.10 2015-06-03
0.0.9 2015-01-30
0.0.8 2014-06-17
0.0.7 2014-05-23
0.0.6 2014-01-20
0.0.5 2013-07-15
0.0.4 2013-04-07
0.0.3 2013-03-28
0.0.2 2013-01-15
0.0.1 2012-07-10