@@ -1212,6 +1212,32 @@ describe('raven.Client', function() {
12121212 } ) ;
12131213 } ) ;
12141214
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+
12151241 describe ( '#setContext' , function ( ) {
12161242 afterEach ( function ( ) {
12171243 process . domain && process . domain . exit ( ) ;
@@ -1517,7 +1543,7 @@ describe('raven.Client', function() {
15171543 } ) ;
15181544 } ) ;
15191545
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 ) {
15211547 var scope = nock ( 'https://app.getsentry.com' )
15221548 . filteringRequestBody ( / .* / , '*' )
15231549 . post ( '/api/269/store/' , '*' )
@@ -1527,7 +1553,8 @@ describe('raven.Client', function() {
15271553 client . captureException ( new Error ( 'test' ) , function ( ) {
15281554 // need to wait a tick because the response handler that captures the breadcrumb might run after this one
15291555 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' ) ;
15311558 scope . done ( ) ;
15321559 done ( ) ;
15331560 } , 0 ) ;
0 commit comments