Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lcov-parse

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lcov-parse - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

39

lib/index.js
var fs = require('fs'),
path = require('path'),
exists = fs.exists || path.exists;
var results = {};
var walkFile = function(str, cb) {
var data = [], item = {};
var walkFile = function(str, cb) {
var data = [];
str = str.split('\n');
var item = {};
str.forEach(function(line) {
line = line.trim();
var parts = line.split(':');
var parts = line.split(':'), lines, fn;
switch (parts[0].toUpperCase()) {

@@ -42,3 +41,3 @@ case 'TN':

}
var lines = parts[1].split(',');
lines = parts[1].split(',');
item.lines.details.push({

@@ -57,3 +56,3 @@ line: Number(lines[0]),

}
var fn = parts[1].split(',');
fn = parts[1].split(',');
item.functions.details.push({

@@ -65,3 +64,3 @@ name: fn[1],

case 'FNDA':
var fn = parts[1].split(',');
fn = parts[1].split(',');
item.functions.details.some(function(i, k) {

@@ -74,2 +73,24 @@ if (i.name === fn[1] && i.hit === undefined) {

break;
case 'BRDA':
if (!item.branches) {
item.branches = {
hit: 0,
found: 0,
details: []
};
}
fn = parts[1].split(',');
item.branches.details.push({
line: Number(fn[0]),
block: Number(fn[1]),
branch: Number(fn[2]),
taken: ((fn[3] === '-') ? 0 : Number(fn[3]))
});
break;
case 'BRF':
item.branches.found = Number(parts[1]);
break;
case 'BRH':
item.branches.hit = Number(parts[1]);
break;
}

@@ -76,0 +97,0 @@

{
"name": "lcov-parse",
"description": "Parse lcov results files and return JSON",
"version": "0.0.1",
"version": "0.0.2",
"author": "Dav Glass <davglass@gmail.com>",

@@ -15,6 +15,10 @@ "bugs": { "url" : "http://github.com/davglass/lcov-parse/issues" },

"devDependencies": {
"vows": "*"
"yui-lint": "~0.1.1",
"jshint": "~0.9.0",
"istanbul": "~0.1.8",
"vows": "*"
},
"scripts": {
"test": "./node_modules/.bin/vows ./tests/*.js"
"pretest": "jshint --config ./node_modules/yui-lint/jshint.json ./lib/",
"test": "istanbul cover --print both vows -- --spec ./tests/*.js"
},

@@ -21,0 +25,0 @@ "licenses":[

var vows = require('vows'),
path = require('path'),
assert = require('assert'),
parse = require(path.join(__dirname, '../lib')),
parse = require('../lib'),
yuiFile = path.join(__dirname, 'info/parts.info');
vows.describe('Test Loading and Bindings').addBatch({
var tests = {
'Should be loaded': {

@@ -55,2 +54,8 @@ topic: function() {

},
'verify number of branches': function(err, data) {
assert.equal(data[1].branches.found, 23);
assert.equal(data[1].branches.hit, 22);
assert.equal(data[1].branches.found, data[1].branches.details.length);
assert.equal(data[1].branches.details[data[1].branches.details.length - 1].taken, 0);
},
'verify function details': function(err, data) {

@@ -85,3 +90,5 @@ assert.equal(data[0].functions.details.length, 29);

}
}).export(module);
};
vows.describe('Test Loading and Bindings').addBatch(tests)['export'](module);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc