File tree 2 files changed +20
-2
lines changed
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ var _Raven = window.Raven,
31
31
var Raven = {
32
32
VERSION : '<%= pkg.version %>' ,
33
33
34
+ debug : true ,
35
+
34
36
/*
35
37
* Allow multiple versions of Raven to be installed.
36
38
* Strip Raven from the global context and returns the instance.
@@ -679,7 +681,7 @@ function makeRequest(data) {
679
681
function isSetup ( ) {
680
682
if ( ! hasJSON ) return false ; // needs JSON support
681
683
if ( ! globalServer ) {
682
- if ( window . console && console . error ) {
684
+ if ( window . console && console . error && Raven . debug ) {
683
685
console . error ( "Error: Raven has not been configured." ) ;
684
686
}
685
687
return false ;
Original file line number Diff line number Diff line change @@ -215,11 +215,27 @@ describe('globals', function() {
215
215
assert . isFalse ( isSetup ( ) ) ;
216
216
} ) ;
217
217
218
- it ( 'should return false when Raven is not configured and write to console.error ' , function ( ) {
218
+ it ( 'should return false when Raven is not configured' , function ( ) {
219
219
hasJSON = true ; // be explicit
220
220
globalServer = undefined ;
221
221
this . sinon . stub ( console , 'error' ) ;
222
222
assert . isFalse ( isSetup ( ) ) ;
223
+ } ) ;
224
+
225
+ it ( 'should not write to console.error when Raven is not configured and Raven.debug is false' , function ( ) {
226
+ hasJSON = true ; // be explicit
227
+ globalServer = undefined ;
228
+ Raven . debug = false ;
229
+ this . sinon . stub ( console , 'error' ) ;
230
+ isSetup ( ) ;
231
+ assert . isFalse ( console . error . calledOnce ) ;
232
+ } ) ;
233
+
234
+ it ( 'should write to console.error when Raven is not configured and Raven.debug is true' , function ( ) {
235
+ hasJSON = true ; // be explicit
236
+ globalServer = undefined ;
237
+ this . sinon . stub ( console , 'error' ) ;
238
+ isSetup ( ) ;
223
239
assert . isTrue ( console . error . calledOnce ) ;
224
240
} ) ;
225
241
You can’t perform that action at this time.
0 commit comments