Permalink
Browse files

Show overall coverage in HTML reporter

  • Loading branch information...
1 parent b557cda commit 13f71314bc79522cb66cf84c78b767fc18194975 @kristjan kristjan committed Jul 11, 2012
Showing with 24 additions and 18 deletions.
  1. +15 −9 bin/cover
  2. +9 −9 templates/index.html
View
@@ -423,6 +423,18 @@
var templateDir = path.resolve(__dirname, "..", "templates");
var resourceDir = path.resolve(__dirname, "..", "resources");
+ function statsRow(name, stats) {
+ return [
+ name,
+ Math.floor(stats.percentage * 100) + "%",
+ stats.missing,
+ stats.total,
+ Math.floor(stats.blocks.percentage * 100) + "%",
+ stats.blocks.missing,
+ stats.blocks.total
+ ];
+ }
+
var htmls = {};
for(var i = 0; i < files.length; i++) {
var filename = files[i];
@@ -446,17 +458,11 @@
totalBlocks: stats.blocks.total,
};
- allStats.push([
- path.relative(CWD, filename),
- Math.floor(stats.percentage * 100) + "%",
- stats.missing,
- stats.total,
- Math.floor(stats.blocks.percentage * 100) + "%",
- stats.blocks.missing,
- stats.blocks.total
- ]);
+ allStats.push(statsRow(path.relative(CWD, filename), stats));
}
+ allStats.push(statsRow('Overall', coverageData.overall.stats()));
+
// Delete the HTML directory if necessary, and then create it
if (path.existsSync(htmlDirectory)) {
rmdirRecursiveSync(htmlDirectory);
View
@@ -19,15 +19,15 @@
html, body {
overflow-x: hidden;
}
-
+
.container {
width: 99%;
padding-top: 10px;
}
-
+
.content {
}
-
+
.container > footer p {
text-align: center; /* center align it with the container */
}
@@ -42,12 +42,12 @@
padding-left: 5px;
padding-right: 5px;
}
-
+
table#files-table td:first-child, table#files-table th:first-child {
width: 33%;
overflow-x: hidden;
}
-
+
table#files-table td:first-child:hover {
overflow-x: visible;
}
@@ -83,13 +83,13 @@
</tr>
</thead>
<tbody>
- <% _.each(data, function(fileData) { %>
+ <% _.each(data, function(fileData) { %>
<tr>
<% _.each(fileData, function(cell, index) { %>
- <% if (index === 0) { %>
- <td><a href='<%= fileUrls[cell] %>'><%= cell %></a<</td>
+ <% if (index === 0) { %>
+ <td><a href='<%= fileUrls[cell] %>'><%= cell %></a<</td>
<% } else { %>
- <td><%= cell %></td>
+ <td><%= cell %></td>
<% } %>
<% }); %>
</tr>

0 comments on commit 13f7131

Please sign in to comment.