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
Prev Previous commit
Alternative method to achieve a cleaner syntax.
  • Loading branch information
Avi Vahl committed Jun 11, 2016
commit 85ffb51cfb0957a485b75d5c1198ecb9e4f33b86
10 changes: 5 additions & 5 deletions lib/reporters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function HTML(runner) {

runner.on('suite end', function(suite) {
if (suite.root) {
updateStats.call(this);
updateStats();
return;
}
stack.shift();
Expand All @@ -138,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.call(this);
updateStats();
});

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

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

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

function appendToStack(el) {
Expand All @@ -196,7 +196,7 @@ function HTML(runner) {

function updateStats() {
// TODO: add to stats
var percent = stats.tests / this.total * 100 | 0;
var percent = stats.tests / runner.total * 100 | 0;
if (progress) {
progress.update(percent).draw(ctx);
}
Expand Down