File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ function Jasmine(options) {
18
18
this . specFiles = [ ] ;
19
19
this . helperFiles = [ ] ;
20
20
this . env = this . jasmine . getEnv ( ) ;
21
+ this . reportersCount = 0 ;
21
22
this . exitCodeReporter = new ExitCodeReporter ( ) ;
22
23
this . onCompleteCallbackAdded = false ;
23
24
this . exit = exit ;
@@ -46,6 +47,7 @@ Jasmine.prototype.addSpecFile = function(filePath) {
46
47
47
48
Jasmine . prototype . addReporter = function ( reporter ) {
48
49
this . env . addReporter ( reporter ) ;
50
+ this . reportersCount ++ ;
49
51
} ;
50
52
51
53
Jasmine . prototype . provideFallbackReporter = function ( reporter ) {
@@ -65,7 +67,7 @@ Jasmine.prototype.configureDefaultReporter = function(options) {
65
67
}
66
68
var consoleReporter = new module . exports . ConsoleReporter ( options ) ;
67
69
this . provideFallbackReporter ( consoleReporter ) ;
68
- this . defaultReporterAdded = true ;
70
+ this . defaultReporterAdded = this . reportersCount === 0 ;
69
71
} ;
70
72
71
73
Jasmine . prototype . addMatchers = function ( matchers ) {
Original file line number Diff line number Diff line change @@ -85,12 +85,24 @@ describe('Jasmine', function() {
85
85
expect ( this . testJasmine . env . provideFallbackReporter ) . toHaveBeenCalledWith ( { someProperty : 'some value' } ) ;
86
86
} ) ;
87
87
88
- it ( 'sets the defaultReporterAdded flag' , function ( ) {
89
- var reporterOptions = { } ;
88
+ describe ( 'sets the defaultReportedAdded flag' , function ( ) {
89
+ it ( 'to true if the default reporter is used' , function ( ) {
90
+ var reporterOptions = { } ;
90
91
91
- this . testJasmine . configureDefaultReporter ( reporterOptions ) ;
92
+ this . testJasmine . configureDefaultReporter ( reporterOptions ) ;
93
+
94
+ expect ( this . testJasmine . defaultReporterAdded ) . toBe ( true ) ;
95
+ } ) ;
92
96
93
- expect ( this . testJasmine . defaultReporterAdded ) . toBe ( true ) ;
97
+ it ( 'to false if the default reporter is not used' , function ( ) {
98
+ var reporterOptions = { } ;
99
+ var dummyReporter = { } ;
100
+
101
+ this . testJasmine . addReporter ( dummyReporter ) ;
102
+ this . testJasmine . configureDefaultReporter ( reporterOptions ) ;
103
+
104
+ expect ( this . testJasmine . defaultReporterAdded ) . toBe ( false ) ;
105
+ } ) ;
94
106
} ) ;
95
107
96
108
describe ( 'passing in an onComplete function' , function ( ) {
You can’t perform that action at this time.
0 commit comments