Skip to content

Commit

Permalink
Better style for directory names in coverage menu.
Browse files Browse the repository at this point in the history
Dirnames are offset in a darker color to make the
filename stand out.
  • Loading branch information
reid committed May 12, 2012
1 parent 526f036 commit f7afb1b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/vows/coverage/report-html.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var util = require('util'),
path = require('path'),
fs = require('fs'),
file = require('./file');

Expand Down Expand Up @@ -51,12 +52,21 @@ this.report = function (coverageMap) {

fs.writeSync(out, '<li><a href="#overview">overview</a></li>');
files.forEach(function (data) {
var coverageClass = getCoverageClass(data);
var file = data.filename,
dirname = path.dirname(file),
basename = file.substr(dirname.length + 1),
coverageClass = getCoverageClass(data);

if (dirname === ".") {
dirname = "";
basename = file;
}

fs.writeSync(out, '<li><span class="cov ' + coverageClass + '">' +
data.coverage.toFixed(0) + '</span>' +
'<a href="#' + data.filename + '"><span class="dirname">/</span>' +
'<span class="basename">' + data.filename +
'</a></li>');
'<a href="#' + file + '"><span class="dirname">' + dirname +
'/</span><span class="basename">' + basename +
'</span></a></li>');
});

fs.writeSync(out, '</div>');
Expand Down

0 comments on commit f7afb1b

Please sign in to comment.