lcov-parse
Advanced tools
Comparing version 0.0.1 to 0.0.2
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
15578
191
0
1
4
1