karma-spec-reporter
Advanced tools
Comparing version 0.0.32 to 0.0.33
51
index.js
@@ -19,2 +19,3 @@ var colors = require('colors'); | ||
this.USE_COLORS = false; | ||
this.slowPokes = []; | ||
@@ -50,2 +51,5 @@ // colorize output of BaseReporter functions | ||
} | ||
if (this.reportSlowerThan) { | ||
this.logFinalSlow(this.slowPokes); | ||
} | ||
} | ||
@@ -56,2 +60,3 @@ | ||
this.currentSuite = []; | ||
this.slowPokes = []; | ||
}; | ||
@@ -84,2 +89,31 @@ | ||
this.logFinalSlow = function(slowPokes) { | ||
this.writeCommonMsg('\n\n'); | ||
this.WHITESPACE = ' '; | ||
slowPokes | ||
.sort(function(next, prev) { | ||
if (next.time > prev.time) { | ||
return -1; | ||
} else if (next.time < prev.time) { | ||
return 1; | ||
} else { | ||
return 0; | ||
} | ||
}) | ||
.forEach(function(slowPoke, index) { | ||
// Only show the top 5 | ||
if (index > 4) { | ||
return; | ||
} | ||
index = index + 1; | ||
if (index == 1) { | ||
this.writeCommonMsg(('SLOW: ' + slowPokes.length + '\n\n').yellow); | ||
this.writeCommonMsg(('5 Slowest: ' + '\n').yellow); | ||
} | ||
this.writeCommonMsg((index + ') ' + slowPoke.fullName + ' (' + slowPoke.time + ')' + '\n').yellow); | ||
}, this); | ||
}; | ||
this.currentSuite = []; | ||
@@ -108,2 +142,6 @@ this.writeSpecMessage = function (status) { | ||
if (this.reportSlowerThan && result.time > config.reportSlowerThan) { | ||
this.logSlowPoke(result); | ||
} | ||
if (this.USE_COLORS) { | ||
@@ -153,7 +191,16 @@ if (result.skipped) specName = specName.cyan; | ||
this.specSuccess = reporterCfg.suppressPassed ? noop : this.writeSpecMessage(this.USE_COLORS ? this.prefixes.success.green : this.prefixes.success); | ||
this.specSkipped = reporterCfg.suppressSkipped ? noop : this.writeSpecMessage(this.USE_COLORS ? this.prefixes.skipped.cyan : this.prefixes.skipped); | ||
this.logSlowPoke = function(result) { | ||
this.slowPokes.push(result); | ||
}; | ||
this.specSuccess = reporterCfg.suppressPassed | ||
? noop | ||
: this.writeSpecMessage(this.USE_COLORS ? this.prefixes.success.green : this.prefixes.success); | ||
this.specSkipped = reporterCfg.suppressSkipped | ||
? noop | ||
: this.writeSpecMessage(this.USE_COLORS ? this.prefixes.skipped.cyan : this.prefixes.skipped); | ||
this.specFailure = reporterCfg.suppressFailed ? noop : this.onSpecFailure; | ||
this.suppressErrorSummary = reporterCfg.suppressErrorSummary || false; | ||
this.showSpecTiming = reporterCfg.showSpecTiming || false; | ||
this.reportSlowerThan = config.reportSlowerThan || false; | ||
}; | ||
@@ -160,0 +207,0 @@ |
{ | ||
"name": "karma-spec-reporter", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"description": "A Karma plugin. Report all spec-results to console (like mocha's spec reporter).", | ||
@@ -22,3 +22,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"colors": "^1.1.2" | ||
"colors": "1.4.0" | ||
}, | ||
@@ -25,0 +25,0 @@ "peerDependencies": { |
@@ -41,3 +41,8 @@ # karma-spec-reporter | ||
showSpecTiming: false, // print the time elapsed for each spec | ||
failFast: true // test would finish with error when a first fail occurs. | ||
failFast: true, // test would finish with error when a first fail occurs | ||
prefixes: { | ||
success: ' OK: ', // override prefix for passed tests, default is '✓ ' | ||
failure: 'FAILED: ', // override prefix for failed tests, default is '✗ ' | ||
skipped: 'SKIPPED: ' // override prefix for skipped tests, default is '- ' | ||
} | ||
}, | ||
@@ -44,0 +49,0 @@ plugins: ["karma-spec-reporter"], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12653
173
61
Updatedcolors@1.4.0