Skip to content

Commit

Permalink
[fix] One significant digit for code coverage. Fixes #240.
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Nov 22, 2014
1 parent 9ee52a7 commit 049b026
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/vows/coverage/report-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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, '<h1 id="overview">Coverage</h1><div id="menu">');

Expand All @@ -89,7 +89,7 @@ this.report = function (coverageMap) {
}

fs.writeSync(out, '<li><span class="cov ' + coverageClass + '">' +
data.coverage.toFixed(0) + '</span>' +
data.coverage.toFixed(1) + '</span>' +
'<a href="#' + file + '"><span class="dirname">' + dirname +
'/</span><span class="basename">' + basename +
'</span></a></li>');
Expand All @@ -101,7 +101,7 @@ this.report = function (coverageMap) {
'<div class="hits">' + summary.hits +
'</div><div class="misses">' + summary.misses +
'</div><div class="sloc">' + summary.sloc +
'</div><div class="percentage">' + summary.coverage.toFixed(0) + "%</div></div>");
'</div><div class="percentage">' + summary.coverage.toFixed(1) + "%</div></div>");

files.forEach(function (data) {
var coverageClass = getCoverageClass(data);
Expand All @@ -111,7 +111,7 @@ this.report = function (coverageMap) {
'<div class="hits">' + data.hits +
'</div><div class="misses">' + data.misses +
'</div><div class="sloc">' + data.sloc +
'</div><div class="percentage">' + data.coverage.toFixed(0) + "%</div></div>");
'</div><div class="percentage">' + data.coverage.toFixed(1) + "%</div></div>");

fs.writeSync(out, '<table id="source"><thead><tr><th>Line</th><th>Hits</th><th>Source</th></tr></thead><tbody>');

Expand Down

0 comments on commit 049b026

Please sign in to comment.