@@ -802,7 +802,7 @@ describe('globals', function() {
802802 } ) ;
803803 } ) ;
804804
805- it ( "should create and append 'sentry' breadcrumb" , function ( ) {
805+ it ( "should create and append 'sentry' breadcrumb when `_globalOptions.autoBreadcrumbs.sentry` is truthy " , function ( ) {
806806 this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
807807 this . sinon . stub ( Raven , '_makeRequest' ) ;
808808 this . sinon . stub ( Raven , '_getHttpData' ) . returns ( {
@@ -813,7 +813,10 @@ describe('globals', function() {
813813 Raven . _globalProject = '2' ;
814814 Raven . _globalOptions = {
815815 logger : 'javascript' ,
816- maxMessageLength : 100
816+ maxMessageLength : 100 ,
817+ autoBreadcrumbs : {
818+ sentry : true
819+ }
817820 } ;
818821 Raven . _breadcrumbs = [
819822 {
@@ -903,6 +906,41 @@ describe('globals', function() {
903906 ] ) ;
904907 } ) ;
905908
909+ it ( "should not create nor append 'sentry' breadcrumb when `_globalOptions.autoBreadcrumbs.sentry` is falsy" , function ( ) {
910+ this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
911+ this . sinon . stub ( Raven , '_makeRequest' ) ;
912+ this . sinon . stub ( Raven , '_getHttpData' ) . returns ( {
913+ url : 'http://localhost/?a=b' ,
914+ headers : { 'User-Agent' : 'lolbrowser' }
915+ } ) ;
916+
917+ Raven . _globalProject = '2' ;
918+ Raven . _globalOptions = {
919+ logger : 'javascript' ,
920+ maxMessageLength : 100 ,
921+ autoBreadcrumbs : false
922+ } ;
923+
924+ Raven . _send ( { message : 'bar' } ) ;
925+
926+ assert . deepEqual ( Raven . _breadcrumbs , [ ] ) ;
927+
928+ Raven . _send ( { message : 'foo' , level : 'warning' } ) ;
929+ assert . deepEqual ( Raven . _breadcrumbs , [ ] ) ;
930+
931+ Raven . _send ( {
932+ exception : {
933+ values : [
934+ {
935+ type : 'ReferenceError' ,
936+ value : 'foo is not defined'
937+ }
938+ ]
939+ }
940+ } ) ;
941+ assert . deepEqual ( Raven . _breadcrumbs , [ ] ) ;
942+ } ) ;
943+
906944 it ( 'should build a good data payload with a User' , function ( ) {
907945 this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
908946 this . sinon . stub ( Raven , '_makeRequest' ) ;
@@ -2187,7 +2225,8 @@ describe('Raven (public API)', function() {
21872225 xhr : true ,
21882226 console : true ,
21892227 dom : true ,
2190- location : true
2228+ location : true ,
2229+ sentry : true
21912230 } ) ;
21922231 } ) ;
21932232
@@ -2208,6 +2247,7 @@ describe('Raven (public API)', function() {
22082247 xhr : true ,
22092248 console : true ,
22102249 dom : true ,
2250+ sentry : true ,
22112251 location : false /* ! */
22122252 } ) ;
22132253 } ) ;
0 commit comments