-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,7 +125,7 @@ function HTML(runner) { | |
|
||
runner.on('suite end', function(suite) { | ||
if (suite.root) { | ||
updateStats.call(this); | ||
updateStats(); | ||
return; | ||
} | ||
stack.shift(); | ||
|
@@ -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) { | ||
|
@@ -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) { | ||
|
@@ -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; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
AviVahl
Author
Contributor
|
||
if (progress) { | ||
progress.update(percent).draw(ctx); | ||
} | ||
|
Hey @AviVahl, I tried running this code and it looks like the calculation is lightly off - e.g. if you have a test suite of 3 tests, the final number turns out to be
66.6666%
percent becausestats.test
is 0-based (would have values of0
,1
,2
in each respective iteration, and2/3 * 100
!==100
. Have you seen this? Can be easy to miss with a lot of tests because99.9%
rounds up to100%
in the UI.