Skip to content

Commit f87e39f

Browse files
authored
test(bun): Fix failing test after span.isRecording change (#10136)
1 parent 559b423 commit f87e39f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/bun/test/integrations/bunserver.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { beforeAll, beforeEach, describe, expect, test } from 'bun:test';
2-
import { Hub, makeMain, spanToJSON } from '@sentry/core';
2+
import { Hub, getDynamicSamplingContextFromSpan, makeMain, spanIsSampled, spanToJSON } from '@sentry/core';
33

44
import { BunClient } from '../../src/client';
55
import { instrumentBunServe } from '../../src/integrations/bunserver';
@@ -82,10 +82,16 @@ describe('Bun Serve Integration', () => {
8282
client.on('finishTransaction', transaction => {
8383
expect(transaction.spanContext().traceId).toBe(TRACE_ID);
8484
expect(transaction.parentSpanId).toBe(PARENT_SPAN_ID);
85-
expect(transaction.isRecording()).toBe(true);
85+
expect(spanIsSampled(transaction)).toBe(true);
86+
// span.endTimestamp is already set in `finishTransaction` hook
87+
expect(transaction.isRecording()).toBe(false);
8688

8789
// eslint-disable-next-line deprecation/deprecation
8890
expect(transaction.metadata?.dynamicSamplingContext).toStrictEqual({ version: '1.0', environment: 'production' });
91+
expect(getDynamicSamplingContextFromSpan(transaction)).toStrictEqual({
92+
version: '1.0',
93+
environment: 'production',
94+
});
8995
});
9096

9197
const server = Bun.serve({

0 commit comments

Comments
 (0)