Skip to content

Commit

Permalink
if to switch statement change (#155)
Browse files Browse the repository at this point in the history
'if' to 'switch' statement change for performance
  • Loading branch information
mkginfo authored and gkushang committed Aug 23, 2018
1 parent ac7f2f5 commit 0d16b97
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,21 +291,20 @@ var generateReport = function (options) {
}

if (step.result.duration) element.time += step.result.duration;

if (step.result.status === result.status.passed) {

switch (step.result.status) {
case result.status.passed:
return element.passed++;
}
if (step.result.status === result.status.failed) {
case result.status.failed:
return element.failed++;
}
if (step.result.status === result.status.undefined) {
return element.notdefined++;
}
if (step.result.status === result.status.pending) {
case result.status.undefined:
return element.undefined++;
case result.status.pending:
return element.pending++;
}
if (step.result.status === result.status.ambiguous) {
case result.status.ambiguous:
return element.ambiguous++;
default:
break;
}

element.skipped++;
Expand Down

0 comments on commit 0d16b97

Please sign in to comment.