Skip to content

Commit

Permalink
Adds checking to avoid issues when fallback reporter is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricioborges committed Feb 22, 2016
1 parent 228ca55 commit 5666a0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ Jasmine.prototype.addReporter = function(reporter) {
};

Jasmine.prototype.provideFallbackReporter = function(reporter) {
this.env.provideFallbackReporter(reporter);
var reportHandler = this.env.addReporter;
if (this.env.provideFallbackReporter) {
reportHandler = this.env.provideFallbackReporter;
}
reportHandler(reporter);
this.defaultReporterAdded = true;
};

Jasmine.prototype.configureDefaultReporter = function(options) {
Expand All @@ -61,7 +66,6 @@ Jasmine.prototype.configureDefaultReporter = function(options) {
}
var consoleReporter = new module.exports.ConsoleReporter(options);
this.provideFallbackReporter(consoleReporter);
this.defaultReporterAdded = true;
};

Jasmine.prototype.addMatchers = function(matchers) {
Expand Down
1 change: 0 additions & 1 deletion spec/jasmine_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ describe('Jasmine', function() {
it('adds a default reporter as a fallback reporter', function() {
this.testJasmine.addReporter(new Jasmine.ConsoleReporter({}));

//spyOn(this.testJasmine, 'configureDefaultReporter');
spyOn(this.testJasmine, 'loadSpecs');

this.testJasmine.execute();
Expand Down

0 comments on commit 5666a0c

Please sign in to comment.