Skip to content

Commit febee8b

Browse files
committed
debug
1 parent 08a0202 commit febee8b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/cloudflare/test/request.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)