diff --git a/packages/bun/test/integrations/bunserver.test.ts b/packages/bun/test/integrations/bunserver.test.ts index 0a25b655a892..bec2b892ea3a 100644 --- a/packages/bun/test/integrations/bunserver.test.ts +++ b/packages/bun/test/integrations/bunserver.test.ts @@ -1,6 +1,6 @@ import type { RequestEventData } from '@sentry/core'; import * as SentryCore from '@sentry/core'; -import { afterEach, beforeAll, beforeEach, describe, expect, spyOn, test } from 'bun:test'; +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, spyOn, test } from 'bun:test'; import type { BunOptions } from '../../src'; import { bunServerIntegration, getDefaultIntegrationsWithoutPerformance, init } from '../../src'; import { instrumentBunServe } from '../../src/integrations/bunserver'; @@ -53,6 +53,13 @@ describe('Bun Serve Integration', () => { port += 1; }); + // The spies replace `@sentry/core` exports for all test files that `bun test` runs after this one + afterAll(() => { + captureExceptionSpy.mockRestore(); + continueTraceSpy.mockRestore(); + startSpanSpy.mockRestore(); + }); + test.each(['fetch', 'route'])( 'keeps a streaming %s response span open until the last chunk is consumed', async mode => {