File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 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,
3131var Raven = {
3232 VERSION : '<%= pkg.version %>' ,
3333
34+ debug : true ,
35+
3436 /*
3537 * Allow multiple versions of Raven to be installed.
3638 * Strip Raven from the global context and returns the instance.
@@ -679,7 +681,7 @@ function makeRequest(data) {
679681function isSetup ( ) {
680682 if ( ! hasJSON ) return false ; // needs JSON support
681683 if ( ! globalServer ) {
682- if ( window . console && console . error ) {
684+ if ( window . console && console . error && Raven . debug ) {
683685 console . error ( "Error: Raven has not been configured." ) ;
684686 }
685687 return false ;
Original file line number Diff line number Diff line change @@ -215,11 +215,27 @@ describe('globals', function() {
215215 assert . isFalse ( isSetup ( ) ) ;
216216 } ) ;
217217
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 ( ) {
219219 hasJSON = true ; // be explicit
220220 globalServer = undefined ;
221221 this . sinon . stub ( console , 'error' ) ;
222222 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 ( ) ;
223239 assert . isTrue ( console . error . calledOnce ) ;
224240 } ) ;
225241
You can’t perform that action at this time.
0 commit comments