Skip to content

Commit

Permalink
Fix % always 0 in HTML reporter
Browse files Browse the repository at this point in the history
updateStats() accesses this.total, but this === the global object (window) if not specified explicitly.
Also added a missing update when all tests end.
  • Loading branch information
AviVahl committed Jun 8, 2016
1 parent e939d8e commit 966ab86
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/reporters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ function HTML(runner) {

runner.on('suite end', function(suite) {
if (suite.root) {
updateStats.call(this);
return;
}
stack.shift();
Expand All @@ -137,7 +138,7 @@ function HTML(runner) {
var el = fragment(markup, test.speed, test.title, test.duration, url);
self.addCodeToggle(el, test.body);
appendToStack(el);
updateStats();
updateStats.call(this);
});

runner.on('fail', function(test) {
Expand Down Expand Up @@ -177,13 +178,13 @@ function HTML(runner) {

self.addCodeToggle(el, test.body);
appendToStack(el);
updateStats();
updateStats.call(this);
});

runner.on('pending', function(test) {
var el = fragment('<li class="test pass pending"><h2>%e</h2></li>', test.title);
appendToStack(el);
updateStats();
updateStats.call(this);
});

function appendToStack(el) {
Expand Down

0 comments on commit 966ab86

Please sign in to comment.