@@ -1212,6 +1212,32 @@ describe('raven.Client', function() {
1212
1212
} ) ;
1213
1213
} ) ;
1214
1214
1215
+ it ( 'should captureBreadcrumb with processed exception' , function ( done ) {
1216
+ var calls = 0 ;
1217
+ client = new raven . Client ( dsn , {
1218
+ shouldSendCallback : function ( data ) {
1219
+ // Don't test first call, as there's no breadcrumbs there
1220
+ if ( calls === 0 ) {
1221
+ calls += 1 ;
1222
+ return false ;
1223
+ }
1224
+
1225
+ if ( calls === 1 ) {
1226
+ data . breadcrumbs . values . length . should . equal ( 1 ) ;
1227
+ data . breadcrumbs . values [ 0 ] . category . should . equal ( 'sentry' ) ;
1228
+ data . breadcrumbs . values [ 0 ] . message . should . equal ( 'Error: foo' ) ;
1229
+ data . breadcrumbs . values [ 0 ] . level . should . equal ( 'error' ) ;
1230
+ client . uninstall ( ) ;
1231
+ done ( ) ;
1232
+ }
1233
+ }
1234
+ } ) ;
1235
+
1236
+ client . install ( ) ;
1237
+ client . captureException ( new Error ( 'foo' ) ) ;
1238
+ client . captureException ( new Error ( 'bar' ) ) ;
1239
+ } ) ;
1240
+
1215
1241
describe ( '#setContext' , function ( ) {
1216
1242
afterEach ( function ( ) {
1217
1243
process . domain && process . domain . exit ( ) ;
@@ -1517,7 +1543,7 @@ describe('raven.Client', function() {
1517
1543
} ) ;
1518
1544
} ) ;
1519
1545
1520
- it ( 'should not capture breadcrumbs for requests to sentry' , function ( done ) {
1546
+ it ( 'should not capture breadcrumbs for requests to sentry, but should capture exception call itself ' , function ( done ) {
1521
1547
var scope = nock ( 'https://app.getsentry.com' )
1522
1548
. filteringRequestBody ( / .* / , '*' )
1523
1549
. post ( '/api/269/store/' , '*' )
@@ -1527,7 +1553,8 @@ describe('raven.Client', function() {
1527
1553
client . captureException ( new Error ( 'test' ) , function ( ) {
1528
1554
// need to wait a tick because the response handler that captures the breadcrumb might run after this one
1529
1555
setTimeout ( function ( ) {
1530
- client . getContext ( ) . should . not . have . key ( 'breadcrumbs' ) ;
1556
+ client . getContext ( ) . breadcrumbs . length . should . equal ( 1 ) ;
1557
+ client . getContext ( ) . breadcrumbs [ 0 ] . category . should . equal ( 'sentry' ) ;
1531
1558
scope . done ( ) ;
1532
1559
done ( ) ;
1533
1560
} , 0 ) ;
0 commit comments