From f7afb1b57c28d8b5b3e3a6f68d55536255ea4e80 Mon Sep 17 00:00:00 2001 From: Reid Burke Date: Fri, 11 May 2012 17:05:18 -0700 Subject: [PATCH] Better style for directory names in coverage menu. Dirnames are offset in a darker color to make the filename stand out. --- lib/vows/coverage/report-html.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/vows/coverage/report-html.js b/lib/vows/coverage/report-html.js index 18a693b..198636f 100644 --- a/lib/vows/coverage/report-html.js +++ b/lib/vows/coverage/report-html.js @@ -1,4 +1,5 @@ var util = require('util'), + path = require('path'), fs = require('fs'), file = require('./file'); @@ -51,12 +52,21 @@ this.report = function (coverageMap) { fs.writeSync(out, '
  • overview
  • '); 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, '
  • ' + data.coverage.toFixed(0) + '' + - '/' + - '' + data.filename + - '
  • '); + '' + dirname + + '/' + basename + + ''); }); fs.writeSync(out, '');