Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix % always 0 in HTML reporter
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
Avi Vahl committed Jun 8, 2016
commit 966ab86017d469332e62aa501d1c8776ed47ef9d
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just use Function.prototype.bind() on updateStats instead?

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