-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix % always 0 in HTML reporter #2299
Conversation
updateStats() accesses this.total, but this === the global object (window) if not specified explicitly. Also added a missing update when all tests end.
@@ -125,6 +125,7 @@ function HTML(runner) { | |||
|
|||
runner.on('suite end', function(suite) { | |||
if (suite.root) { | |||
updateStats.call(this); |
There was a problem hiding this comment.
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?
@boneskull Thanks for reviewing. You could bind |
@AviVahl It looks like |
Calling |
@boneskull new patch allows calling updateStats() directly (without specifying this), as it binds runner to extract the value of |
@boneskull Can we get this small bug-fix reviewed again? |
@AviVahl looks good, thanks! |
Hi mocha team.
This is a small fix for the progress bar staying consistently at 0 when using the HTML reporter.
Seems like a regression that happened due to the "double-error" fix/refactor.
Reasoning for the changes:
updateStats() accesses this.total, but this === the global object (window) if not specified explicitly here.
Also added a missing update when all tests end.