Skip to content
This repository has been archived by the owner on Aug 8, 2020. It is now read-only.

Commit

Permalink
Fix divide by zero
Browse files Browse the repository at this point in the history
If no tests are found it would be nicer to display 0% than NaN%.
  • Loading branch information
relekang committed May 14, 2016
1 parent 8e79809 commit 4213e14
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Panel {

const summary = this.htmlRendererHelper.createContainer('summary');
const passed = results.pass - (results.skip ? results.skip : 0);
const percentage = Math.round((passed / results.count) * 100);
const percentage = results.count ? Math.round((passed / results.count) * 100) : 0;
summary.textContent = `${results.count} total - ${percentage}% passed`;

this.testsContainer.appendChild(summary);
Expand Down

0 comments on commit 4213e14

Please sign in to comment.