Skip to content
Browse files

Add summaries to lcov report, fixes #20

  • Loading branch information...
1 parent b3483fa commit 3f76fd7f7567ee74a1977865374b54950bb689dd @gotwarlost gotwarlost committed Dec 8, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/report/lcovonly.js
View
12 lib/report/lcovonly.js
@@ -6,7 +6,8 @@
var path = require('path'),
Writer = require('../util/file-writer'),
util = require('util'),
- Report = require('./index');
+ Report = require('./index'),
+ utils = require('../object-utils');
/**
* a `Report` implementation that produces an LCOV coverage file from coverage objects.
*
@@ -36,7 +37,8 @@ Report.mix(LcovOnlyReport, {
functionMap = fc.fnMap,
lines = fc.l,
branches = fc.b,
- branchMap = fc.branchMap;
+ branchMap = fc.branchMap,
+ summary = utils.summarizeFileCoverage(fc);
writer.println('TN:'); //no test name
writer.println('SF:' + fc.path);
@@ -45,6 +47,8 @@ Report.mix(LcovOnlyReport, {
var meta = functionMap[key];
writer.println('FN:' + [ meta.line, meta.name ].join(','));
});
+ writer.println('FNF:' + summary.functions.total);
+ writer.println('FNH:' + summary.functions.covered);
Object.keys(functions).forEach(function (key) {
var stats = functions[key],
@@ -56,6 +60,8 @@ Report.mix(LcovOnlyReport, {
var stat = lines[key];
writer.println('DA:' + [ key, stat ].join(','));
});
+ writer.println('LF:' + summary.lines.total);
+ writer.println('LH:' + summary.lines.covered);
Object.keys(branches).forEach(function (key) {
var branchArray = branches[key],
@@ -67,6 +73,8 @@ Report.mix(LcovOnlyReport, {
i += 1;
});
});
+ writer.println('BRF:' + summary.branches.total);
+ writer.println('BRH:' + summary.branches.covered);
writer.println('end_of_record');
},

0 comments on commit 3f76fd7

Please sign in to comment.
Something went wrong with that request. Please try again.