File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
packages/integrations/test Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,26 @@ describe('CaptureConsole setup', () => {
64
64
expect ( global . console . table ) . toBe ( originalConsole . table ) ;
65
65
} ) ;
66
66
67
+ it ( 'should not wrap any functions with an empty levels option' , ( ) => {
68
+ const captureConsoleIntegration = new CaptureConsole ( { levels : [ ] } ) ;
69
+ captureConsoleIntegration . setupOnce (
70
+ ( ) => undefined ,
71
+ ( ) => getMockHubWithIntegration ( captureConsoleIntegration ) as any ,
72
+ ) ;
73
+
74
+ // expect the default set of console levels not to have been monkey patched
75
+ expect ( global . console . debug ) . toBe ( originalConsole . debug ) ;
76
+ expect ( global . console . info ) . toBe ( originalConsole . info ) ;
77
+ expect ( global . console . warn ) . toBe ( originalConsole . warn ) ;
78
+ expect ( global . console . error ) . toBe ( originalConsole . error ) ;
79
+ expect ( global . console . log ) . toBe ( originalConsole . log ) ;
80
+ expect ( global . console . assert ) . toBe ( originalConsole . assert ) ;
81
+
82
+ // expect no message to be captured with console.log
83
+ global . console . log ( 'some message' ) ;
84
+ expect ( mockHub . captureMessage ) . not . toHaveBeenCalled ( ) ;
85
+ } ) ;
86
+
67
87
it ( 'setup should fail gracefully when console is not available' , ( ) => {
68
88
const consoleRef = global . console ;
69
89
// remove console
You can’t perform that action at this time.
0 commit comments