From 5989948cafa5479f7bde23ddced2b8a3604d003a Mon Sep 17 00:00:00 2001 From: Mauricio Borges Silva Date: Wed, 30 Dec 2015 15:43:04 -0200 Subject: [PATCH] Replace method to add default report only when no custom reports are provided. Now uses fallback method --- lib/jasmine.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/jasmine.js b/lib/jasmine.js index b1aed93f..a4b4a4fc 100644 --- a/lib/jasmine.js +++ b/lib/jasmine.js @@ -18,7 +18,6 @@ function Jasmine(options) { this.specFiles = []; this.helperFiles = []; this.env = this.jasmine.getEnv(); - this.reportersCount = 0; this.exitCodeReporter = new ExitCodeReporter(); this.onCompleteCallbackAdded = false; this.exit = exit; @@ -43,7 +42,10 @@ Jasmine.prototype.addSpecFile = function(filePath) { Jasmine.prototype.addReporter = function(reporter) { this.env.addReporter(reporter); - this.reportersCount++; +}; + +Jasmine.prototype.provideFallbackReporter = function(reporter) { + this.env.provideFallbackReporter(reporter); }; Jasmine.prototype.configureDefaultReporter = function(options) { @@ -58,7 +60,7 @@ Jasmine.prototype.configureDefaultReporter = function(options) { this.printDeprecation('Passing in an onComplete function to configureDefaultReporter is deprecated.'); } var consoleReporter = new module.exports.ConsoleReporter(options); - this.addReporter(consoleReporter); + this.provideFallbackReporter(consoleReporter); this.defaultReporterAdded = true; }; @@ -131,10 +133,7 @@ Jasmine.prototype.stopSpecOnExpectationFailure = function(value) { Jasmine.prototype.execute = function(files, filterString) { this.loadHelpers(); - - if(this.reportersCount === 0) { - this.configureDefaultReporter({ showColors: this.showingColors }); - } + this.configureDefaultReporter({ showColors: this.showingColors }); if(filterString) { var specFilter = new ConsoleSpecFilter({