File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -93,12 +93,17 @@ describe('withSentry', () => {
9393 test ( 'flush must be called when all waitUntil are done' , async ( ) => {
9494 // Also spy on the exported flush function to see how many times it's called
9595 let exportedFlushCallCount = 0 ;
96- const originalExportedFlush = SentryCore . flush ;
9796 const exportedFlushSpy = vi . spyOn ( SentryCore , 'flush' ) . mockImplementation ( async ( timeout ?: number ) => {
9897 exportedFlushCallCount ++ ;
9998 console . log ( `[EXPORTED flush() #${ exportedFlushCallCount } ] timeout: ${ timeout } ` ) ;
100- // Call through to the real implementation
101- return originalExportedFlush ( timeout ) ;
99+ const stack = new Error ( ) . stack ?. split ( '\n' ) . slice ( 2 , 6 ) . join ( '\n ' ) ;
100+ console . log ( ` Called from:\n ${ stack } ` ) ;
101+ // Get the client and call its flush method directly instead of recursing
102+ const client = SentryCore . getClient ( ) ;
103+ if ( client ) {
104+ return client . flush ( timeout ) ;
105+ }
106+ return false ;
102107 } ) ;
103108
104109 let flushCallCount = 0 ;
You can’t perform that action at this time.
0 commit comments