Skip to content

Commit 5df282e

Browse files
JPeer264claude
andcommitted
fixup! test(bun): Run all Node integration suites on Bun
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 689ba14 commit 5df282e

3 files changed

Lines changed: 21 additions & 18 deletions

File tree

‎dev-packages/bun-integration-tests/node-suites/excludes.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const NO_AUTO_INSTRUMENTATION = [
8282
'suites/tracing/fastify/test.ts',
8383
'suites/tracing/genericPool-v2/test.ts',
8484
'suites/tracing/genericPool/test.ts',
85+
'suites/tracing/is-localhost/test.ts',
8586
'suites/tracing/google-genai-v2/test.ts',
8687
'suites/tracing/google-genai/test.ts',
8788
'suites/tracing/groq/test.ts',

‎dev-packages/bun-integration-tests/suites/is-localhost/index.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { sendPortToRunner } from '@sentry-internal/node-integration-tests';
12
import * as Sentry from '@sentry/bun';
23

34
Sentry.init({
@@ -15,4 +16,4 @@ const server = Bun.serve({
1516
},
1617
});
1718

18-
process.send?.(JSON.stringify({ event: 'READY', port: server.port }));
19+
sendPortToRunner(server.port!);

‎dev-packages/bun-integration-tests/suites/is-localhost/test.ts‎

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
import type { Envelope, SerializedStreamedSpan, SerializedStreamedSpanContainer } from '@sentry/core';
2-
import { expect, it } from 'vitest';
3-
import { createRunner } from '../../runner';
1+
import { afterAll, expect, test } from 'vitest';
2+
import { cleanupChildProcesses, createRunner } from '../../../node-integration-tests/utils/runner';
43

5-
function getSpans(envelope: Envelope): SerializedStreamedSpan[] {
6-
return (envelope[1][0][1] as SerializedStreamedSpanContainer).items;
7-
}
4+
afterAll(() => {
5+
cleanupChildProcesses();
6+
});
87

98
// The runner always requests `http://localhost:<port>`, so only the `true` case is reachable here.
109
// The `false` case is covered by the unit tests for `isLocalhostRequest`.
11-
it('sets sentry.is_localhost on every streamed span', async ({ signal }) => {
12-
const runner = createRunner(__dirname)
13-
.expect(envelope => {
14-
const spans = getSpans(envelope);
15-
16-
expect(spans.some(span => span.is_segment)).toBe(true);
17-
expect(spans.some(span => span.name === 'child-span')).toBe(true);
10+
test('sets sentry.is_localhost on every streamed span', async () => {
11+
const runner = createRunner(__dirname, 'index.ts')
12+
.withMockSentryServer()
13+
.unordered()
14+
.expect({
15+
span: container => {
16+
expect(container.items.some(span => span.is_segment)).toBe(true);
17+
expect(container.items.some(span => span.name === 'child-span')).toBe(true);
1818

19-
for (const span of spans) {
20-
expect(span.attributes['sentry.is_localhost']).toEqual({ value: true, type: 'boolean' });
21-
}
19+
for (const span of container.items) {
20+
expect(span.attributes['sentry.is_localhost']).toEqual({ value: true, type: 'boolean' });
21+
}
22+
},
2223
})
23-
.start(signal);
24+
.start();
2425

2526
await runner.makeRequest('get', '/');
2627
await runner.completed();

0 commit comments

Comments
 (0)