@@ -366,6 +366,22 @@ describe('BaseClient', () => {
366366 // `captureException` should bail right away this second time around and not get as far as calling this again
367367 expect ( clientEventFromException ) . toHaveBeenCalledTimes ( 1 ) ;
368368 } ) ;
369+
370+ test ( 'captures logger message' , ( ) => {
371+ const logSpy = jest . spyOn ( loggerModule . logger , 'log' ) . mockImplementation ( ( ) => undefined ) ;
372+
373+ const options = getDefaultTestClientOptions ( { dsn : PUBLIC_DSN } ) ;
374+ const client = new TestClient ( options ) ;
375+
376+ client . captureException ( new Error ( 'test error here' ) ) ;
377+ client . captureException ( { } ) ;
378+
379+ expect ( logSpy ) . toHaveBeenCalledTimes ( 2 ) ;
380+ expect ( logSpy ) . toBeCalledWith ( 'Captured error event `test error here`' ) ;
381+ expect ( logSpy ) . toBeCalledWith ( 'Captured error event `<unknown>`' ) ;
382+
383+ logSpy . mockRestore ( ) ;
384+ } ) ;
369385 } ) ;
370386
371387 describe ( 'captureMessage' , ( ) => {
@@ -442,6 +458,20 @@ describe('BaseClient', () => {
442458 } ) ,
443459 ) ;
444460 } ) ;
461+
462+ test ( 'captures logger message' , ( ) => {
463+ const logSpy = jest . spyOn ( loggerModule . logger , 'log' ) . mockImplementation ( ( ) => undefined ) ;
464+
465+ const options = getDefaultTestClientOptions ( { dsn : PUBLIC_DSN } ) ;
466
E29B
+ const client = new TestClient ( options ) ;
467+
468+ client . captureMessage ( 'test error here' ) ;
469+
470+ expect ( logSpy ) . toHaveBeenCalledTimes ( 1 ) ;
471+ expect ( logSpy ) . toBeCalledWith ( 'Captured error event `test error here`' ) ;
472+
473+ logSpy . mockRestore ( ) ;
474+ } ) ;
445475 } ) ;
446476
447477 describe ( 'captureEvent() / prepareEvent()' , ( ) => {
@@ -1658,6 +1688,22 @@ describe('BaseClient', () => {
16581688 message : 'hello' ,
16591689 } ) ;
16601690 } ) ;
1691+
1692+ test ( 'captures logger message' , ( ) => {
1693+ const logSpy = jest . spyOn ( loggerModule . logger , 'log' ) . mockImplementation ( ( ) => undefined ) ;
1694+
1695+ const options = getDefaultTestClientOptions ( { dsn : PUBLIC_DSN } ) ;
1696+ const client = new TestClient ( options ) ;
1697+
1698+ client . captureEvent ( { message : 'hello' } ) ;
1699+ // transactions are ignored and not logged
1700+ client . captureEvent ( { type : 'transaction' , message : 'hello 2' } ) ;
1701+
1702+ expect ( logSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1703+ expect ( logSpy ) . toBeCalledWith ( 'Captured error event `hello`' ) ;
1704+
1705+ logSpy . mockRestore ( ) ;
1706+ } ) ;
16611707 } ) ;
16621708
16631709 describe ( 'integrations' , ( ) => {
0 commit comments