From 049b026da2cedbb9345260224d2a2da41dafaf16 Mon Sep 17 00:00:00 2001 From: indexzero Date: Fri, 21 Nov 2014 21:07:03 -0700 Subject: [PATCH] [fix] One significant digit for code coverage. Fixes #240. --- lib/vows/coverage/report-html.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/vows/coverage/report-html.js b/lib/vows/coverage/report-html.js index de0068c..a711698 100644 --- a/lib/vows/coverage/report-html.js +++ b/lib/vows/coverage/report-html.js @@ -47,7 +47,7 @@ this.report = function (coverageMap) { misses: 0, sloc: 0 }; - + try { out = fs.openSync("coverage.html", "w"); head = fs.readFileSync(__dirname + "/fragments/coverage-head.html", "utf8"); @@ -70,7 +70,7 @@ this.report = function (coverageMap) { } } - summary.coverage = Math.floor((summary.hits / summary.sloc) * 100); + summary.coverage = ((summary.hits / summary.sloc) * 100).toFixed(1); fs.writeSync(out, '

Coverage

"); + '
' + summary.coverage.toFixed(1) + "%
"); files.forEach(function (data) { var coverageClass = getCoverageClass(data); @@ -111,7 +111,7 @@ this.report = function (coverageMap) { '
' + data.hits + '
' + data.misses + '
' + data.sloc + - '
' + data.coverage.toFixed(0) + "%
"); + '
' + data.coverage.toFixed(1) + "%
"); fs.writeSync(out, '');
LineHitsSource