diff --git a/README.md b/README.md index b9dad059..ae4b4482 100644 --- a/README.md +++ b/README.md @@ -26,14 +26,15 @@ You can customize the output of the reporter yourself: [see how](docs/customize- ```js { - displayStacktrace: 'none', // display stacktrace for each failed assertion, values: (all|specs|summary|none) - displayFailuresSummary: true, // display summary of all failures after execution - displayPendingSummary: true, // display summary of all pending specs after execution - displaySuccessfulSpec: true, // display each successful spec - displayFailedSpec: true, // display each failed spec - displayPendingSpec: false, // display each pending spec - displaySpecDuration: false, // display each spec duration - displaySuiteNumber: false, // display each suite number (hierarchical) + displayStacktrace: 'none', // display stacktrace for each failed assertion, values: (all|specs|summary|none) + displaySuccessesSummary: false, // display summary of all successes after execution + displayFailuresSummary: true, // display summary of all failures after execution + displayPendingSummary: true, // display summary of all pending specs after execution + displaySuccessfulSpec: true, // display each successful spec + displayFailedSpec: true, // display each failed spec + displayPendingSpec: false, // display each pending spec + displaySpecDuration: false, // display each spec duration + displaySuiteNumber: false, // display each suite number (hierarchical) colors: { success: 'green', failure: 'red', diff --git a/example/run-example.js b/example/run-example.js index da262362..6ed4639c 100644 --- a/example/run-example.js +++ b/example/run-example.js @@ -10,6 +10,7 @@ jasmine.getEnv().addReporter(new SpecReporter({ displayStacktrace: 'none', displayFailuresSummary: true, displayPendingSummary: true, + displaySuccessesSummary: true, displaySuccessfulSpec: true, displayFailedSpec: true, displayPendingSpec: true, diff --git a/src/spec-display.js b/src/spec-display.js index 890015b7..791040fd 100644 --- a/src/spec-display.js +++ b/src/spec-display.js @@ -3,9 +3,11 @@ var SpecDisplay = function (options, displayProcessors) { this.currentIndent = ''; this.suiteHierarchy = []; this.suiteHierarchyDisplayed = []; + this.successfulSpecs = []; this.failedSpecs = []; this.pendingSpecs = []; this.lastWasNewLine = false; + this.displaySuccessesSummary = options.displaySuccessesSummary || false; this.displayFailuresSummary = options.displayFailuresSummary !== false; this.displayPendingSummary = options.displayPendingSummary !== false; this.displaySuccessfulSpec = options.displaySuccessfulSpec !== false; @@ -39,6 +41,9 @@ SpecDisplay.prototype = { this.resetIndent(); this.newLine(); + if (this.displaySuccessesSummary && metrics.successfulSpecs > 0) { + this.successesSummary(); + } if (this.displayFailuresSummary && metrics.failedSpecs > 0) { this.failuresSummary(); } @@ -48,6 +53,23 @@ SpecDisplay.prototype = { this.log(execution + successful.success + failed.failure + pending.pending + skipped + duration); }, + successesSummary: function () { + this.log("**************************************************"); + this.log("* Successes *"); + this.log("**************************************************"); + this.newLine(); + for (var i = 0 ; i < this.successfulSpecs.length ; i++) { + this.successfulSummary(this.successfulSpecs[i], i + 1); + this.newLine(); + } + this.newLine(); + this.resetIndent(); + }, + + successfulSummary: function (spec, index) { + this.log(index + ') ' + spec.fullName); + }, + failuresSummary: function () { this.log("**************************************************"); this.log("* Failures *"); @@ -99,6 +121,7 @@ SpecDisplay.prototype = { }, successful: function (spec) { + this.successfulSpecs.push(spec); if (this.displaySuccessfulSpec) { this.ensureSuiteDisplayed(); var log = null;