@@ -802,7 +802,7 @@ describe('globals', function() {
802
802
} ) ;
803
803
} ) ;
804
804
805
- it ( "should create and append 'sentry' breadcrumb" , function ( ) {
805
+ it ( "should create and append 'sentry' breadcrumb when `_globalOptions.autoBreadcrumbs.sentry` is truthy " , function ( ) {
806
806
this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
807
807
this . sinon . stub ( Raven , '_makeRequest' ) ;
808
808
this . sinon . stub ( Raven , '_getHttpData' ) . returns ( {
@@ -813,7 +813,10 @@ describe('globals', function() {
813
813
Raven . _globalProject = '2' ;
814
814
Raven . _globalOptions = {
815
815
logger : 'javascript' ,
816
- maxMessageLength : 100
816
+ maxMessageLength : 100 ,
817
+ autoBreadcrumbs : {
818
+ sentry : true
819
+ }
817
820
} ;
818
821
Raven . _breadcrumbs = [
819
822
{
@@ -903,6 +906,41 @@ describe('globals', function() {
903
906
] ) ;
904
907
} ) ;
905
908
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
+
906
944
it ( 'should build a good data payload with a User' , function ( ) {
907
945
this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
908
946
this . sinon . stub ( Raven , '_makeRequest' ) ;
@@ -2187,7 +2225,8 @@ describe('Raven (public API)', function() {
2187
2225
xhr : true ,
2188
2226
console : true ,
2189
2227
dom : true ,
2190
- location : true
2228
+ location : true ,
2229
+ sentry : true
2191
2230
} ) ;
2192
2231
} ) ;
2193
2232
@@ -2208,6 +2247,7 @@ describe('Raven (public API)', function() {
2208
2247
xhr : true ,
2209
2248
console : true ,
2210
2249
dom : true ,
2250
+ sentry : true ,
2211
2251
location : false /* ! */
2212
2252
} ) ;
2213
2253
} ) ;
0 commit comments