Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 9 additions & 31 deletions dev-packages/bun-integration-tests/node-suites/excludes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Node suites that do not run on Bun, relative to `node-integration-tests`. A single test that
// fails on Bun runs only on the other runtimes, with `test.runIf(supports({ runtimes }))` in the
// Node suite, and is not listed here.
// Node suite, and a suite or test that fails only on older Bun versions runs with
// `supports({ bunMin })`. Neither is listed here.

// Node-only features: ANR and native thread watchdogs, child processes, the AWS Lambda Node runtime,
// `node:sqlite`, which `flue` needs, and the Vercel keep-alive, which needs `http.server.response.finish`.
Expand Down Expand Up @@ -57,23 +58,6 @@ const NO_FETCH_INSTRUMENTATION = [
'suites/tracing/requests/traceparent/test.ts',
];

// Bun 1.3.14 (the CI version) does not instrument outgoing `node:http` requests. These suites pass
// on Bun 1.4.2. See https://github.com/getsentry/sentry-javascript/issues/23881
const NO_OUTGOING_HTTP_INSTRUMENTATION = [
'suites/tracing/dsc-txn-name-update/test.ts',
'suites/tracing/http-client-spans/http-basic/test.ts',
'suites/tracing/http-client-spans/http-strip-query/test.ts',
'suites/tracing/requests/http-breadcrumbs/test.ts',
'suites/tracing/requests/http-maxed-out-sockets/test.ts',
'suites/tracing/requests/http-no-trace-propagation/test.ts',
'suites/tracing/requests/http-no-tracing-no-spans/test.ts',
'suites/tracing/requests/http-no-tracing/test.ts',
'suites/tracing/requests/http-sampled-no-active-span/test.ts',
'suites/tracing/requests/http-sampled/test.ts',
'suites/tracing/requests/http-unsampled/test.ts',
'suites/tracing/tracePropagationTargets/**',
];

// `bun run` cannot inject the diagnostics channels into libraries, so framework, database and AI
// instrumentation creates no spans. Apps must be built with `@sentry/bun/plugin`.
// See https://github.com/getsentry/sentry-javascript/issues/23882
Expand Down Expand Up @@ -142,17 +126,16 @@ export const NO_AUTO_INSTRUMENTATION = [
'suites/tracing/vercelai/**',
];

// Fail on Bun, cause not investigated yet. `system-error` and `tracer-start-active-span-error`
// fail on Bun 1.3.14 and pass on Bun 1.4.2. With the `@sentry/bun` alias, `system-error` also
// fails because `@sentry/bun` does not include `nodeSystemErrorIntegration`.
// Fail on Bun. The cause is not investigated yet.
const NOT_TRIAGED = [
'suites/contextLines/filename-with-spaces/test.ts',
'suites/modules/test.ts',
'suites/proxy/test.ts',
'suites/system-error/test.ts',
'suites/tracing/tracer-start-active-span-error/test.ts',
];

// The suite expects the events of `nodeSystemErrorIntegration`, which `@sentry/bun` does not include.
const NO_SYSTEM_ERROR_INTEGRATION = ['suites/system-error/test.ts'];

// The scenario configures `nativeNodeFetchIntegration`, which `@sentry/bun` does not export.
const NO_NATIVE_NODE_FETCH_INTEGRATION = [
'suites/tracing/http-client-spans/fetch-forward-request-hook/test.ts',
Expand Down Expand Up @@ -202,13 +185,7 @@ const NO_EXPRESS_INSTRUMENTATION = [
'suites/tracing/traceid-recycling-with-spans/test.ts',
];

export const NODE_SUITES_EXCLUDE = [
'**/node_modules/**',
...NODE_ONLY,
...NO_OUTGOING_HTTP_INSTRUMENTATION,
...NO_AUTO_INSTRUMENTATION,
...NOT_TRIAGED,
];
export const NODE_SUITES_EXCLUDE = ['**/node_modules/**', ...NODE_ONLY, ...NO_AUTO_INSTRUMENTATION, ...NOT_TRIAGED];

// Excluded only in the `node-suites` project, which runs the suites with `@sentry/node`.
export const SENTRY_NODE_EXCLUDE = [...NO_HTTP_SERVER_SPANS, ...NO_FETCH_INSTRUMENTATION];
Expand All @@ -217,6 +194,7 @@ export const SENTRY_NODE_EXCLUDE = [...NO_HTTP_SERVER_SPANS, ...NO_FETCH_INSTRUM
export const SENTRY_BUN_EXCLUDE = [
...HTTP_SERVER_OPTIONS_IGNORED,
...NO_EXPRESS_INSTRUMENTATION,
...NO_SYSTEM_ERROR_INTEGRATION,
...NO_NATIVE_NODE_FETCH_INTEGRATION,
...FETCH_INTEGRATION_DIFFERS,
];
Expand All @@ -233,7 +211,7 @@ const BUN_BUILD_EAGER_SUBSCRIPTION = ['suites/tracing/orchestrion-lazy-registrat
// `http.server.request.start`.
const BUN_BUILD_NO_HTTP_SERVER_INTEGRATION = ['suites/express/multiple-init/test.ts'];

// Some or all tests fail with the bundled scenarios, cause not investigated yet. In
// Some or all tests fail with the bundled scenarios. The cause is not investigated yet. In
// `express/tracing` only the request data tests fail: they set `httpIntegration` options, and with
// `@sentry/bun` the request body comes from `bunHttpServerIntegration`.
const BUN_BUILD_NOT_TRIAGED = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const REQUIRE_OF_ESM_ONLY_DEPENDENCY = [
'suites/tracing/prisma-orm-v8/test.ts',
];

// Some or all tests fail on Deno, cause not investigated yet. In most AI suites the span
// Some or all tests fail on Deno. The cause is not investigated yet. In most AI suites the span
// streaming test fails. `apollo-graphql` (CJS tests only) and `mongodb` fail on Deno 2.8.3 (the CI
// version) and pass on Deno 2.9.0.
const NOT_TRIAGED = [
Expand Down
3 changes: 2 additions & 1 deletion dev-packages/node-integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ arriving after its condition is satisfied.
`dev-packages/bun-integration-tests` and `dev-packages/deno-integration-tests` run every suite of this package on Bun
and Deno as well. When you add a suite, check that it passes on both. If it cannot, add it to
`node-suites/excludes.ts` of the runtime's package with the reason, or run the single tests that fail only on the
other runtimes, for example `test.runIf(supports({ runtimes: ['node', 'deno'] }))` for a test that fails on Bun.
other runtimes, for example `test.runIf(supports({ runtimes: ['node', 'deno'] }))` for a test that fails on Bun. A
suite or test that fails only on Bun versions older than a given one runs with `supports({ bunMin: '1.4.0' })`.

## Running Tests Locally

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { afterAll, describe, test } from 'vitest';
import { cleanupChildProcesses, createRunner } from '../../utils/runner';
import { supports } from '../../utils';

afterAll(() => {
cleanupChildProcesses();
});

describe('SystemError integration', () => {
// Fails on Bun before 1.4. The cause is not investigated yet.
describe.runIf(supports({ bunMin: '1.4.0' }))('SystemError integration', () => {
test('userInfo: false', async () => {
await createRunner(__dirname, 'basic.mjs')
.expect({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,64 +1,70 @@
import { createTestServer } from '@sentry-internal/test-utils';
import { expect, test } from 'vitest';
import { createRunner } from '../../../utils/runner';
import { supports } from '../../../utils';

test('adds current transaction name to baggage when the txn name is high-quality', async () => {
expect.assertions(5);
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
test.runIf(supports({ bunMin: '1.4.0' }))(
'adds current transaction name to baggage when the txn name is high-quality',
async () => {
expect.assertions(5);

let traceId: string | undefined;
let traceId: string | undefined;

const [SERVER_URL, closeTestServer] = await createTestServer()
.get('/api/v0', headers => {
const baggageItems = getBaggageHeaderItems(headers);
traceId = baggageItems.find(item => item.startsWith('sentry-trace_id='))?.split('=')[1] as string;
const [SERVER_URL, closeTestServer] = await createTestServer()
.get('/api/v0', headers => {
const baggageItems = getBaggageHeaderItems(headers);
traceId = baggageItems.find(item => item.startsWith('sentry-trace_id='))?.split('=')[1] as string;

expect(traceId).toMatch(/^[\da-f]{32}$/);
expect(traceId).toMatch(/^[\da-f]{32}$/);

expect(baggageItems).toEqual([
'sentry-environment=production',
'sentry-public_key=public',
'sentry-release=1.0',
expect.stringMatching(/sentry-sample_rand=0\.\d+/),
'sentry-sample_rate=1',
'sentry-sampled=true',
`sentry-trace_id=${traceId}`,
]);
})
.get('/api/v1', headers => {
expect(getBaggageHeaderItems(headers)).toEqual([
'sentry-environment=production',
'sentry-public_key=public',
'sentry-release=1.0',
expect.stringMatching(/sentry-sample_rand=0\.\d+/),
'sentry-sample_rate=1',
'sentry-sampled=true',
`sentry-trace_id=${traceId}`,
'sentry-transaction=updated-name-1',
]);
})
.get('/api/v2', headers => {
expect(getBaggageHeaderItems(headers)).toEqual([
'sentry-environment=production',
'sentry-public_key=public',
'sentry-release=1.0',
expect.stringMatching(/sentry-sample_rand=0\.\d+/),
'sentry-sample_rate=1',
'sentry-sampled=true',
`sentry-trace_id=${traceId}`,
'sentry-transaction=updated-name-2',
]);
})
.start();
expect(baggageItems).toEqual([
'sentry-environment=production',
'sentry-public_key=public',
'sentry-release=1.0',
expect.stringMatching(/sentry-sample_rand=0\.\d+/),
'sentry-sample_rate=1',
'sentry-sampled=true',
`sentry-trace_id=${traceId}`,
]);
})
.get('/api/v1', headers => {
expect(getBaggageHeaderItems(headers)).toEqual([
'sentry-environment=production',
'sentry-public_key=public',
'sentry-release=1.0',
expect.stringMatching(/sentry-sample_rand=0\.\d+/),
'sentry-sample_rate=1',
'sentry-sampled=true',
`sentry-trace_id=${traceId}`,
'sentry-transaction=updated-name-1',
]);
})
.get('/api/v2', headers => {
expect(getBaggageHeaderItems(headers)).toEqual([
'sentry-environment=production',
'sentry-public_key=public',
'sentry-release=1.0',
expect.stringMatching(/sentry-sample_rand=0\.\d+/),
'sentry-sample_rate=1',
'sentry-sampled=true',
`sentry-trace_id=${traceId}`,
'sentry-transaction=updated-name-2',
]);
})
.start();

await createRunner(__dirname, 'scenario-headers.ts')
.withEnv({ SERVER_URL })
.expect({
span: {},
})
.start()
.completed();
closeTestServer();
});
await createRunner(__dirname, 'scenario-headers.ts')
.withEnv({ SERVER_URL })
.expect({
span: {},
})
.start()
.completed();
closeTestServer();
},
);

test('adds current transaction name to trace envelope header when the txn name is high-quality', async () => {
expect.assertions(4);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { createTestServer } from '@sentry-internal/test-utils';
import { afterAll, describe, expect } from 'vitest';
import { cleanupChildProcesses, createCjsTests } from '../../../../utils/runner';
import { supports } from '../../../../utils';

describe('outgoing http spans', () => {
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
describe.runIf(supports({ bunMin: '1.4.0' }))('outgoing http spans', () => {
afterAll(() => {
cleanupChildProcesses();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ import {
import { createTestServer } from '@sentry-internal/test-utils';
import { afterAll, describe, expect } from 'vitest';
import { cleanupChildProcesses, createCjsTests } from '../../../../utils/runner';
import { supports } from '../../../../utils';

describe('outgoing http spans - strip query', () => {
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
describe.runIf(supports({ bunMin: '1.4.0' }))('outgoing http spans - strip query', () => {
afterAll(() => {
cleanupChildProcesses();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ describe('ignoring a continued server segment', () => {
};

test('propagates a negative sampling decision to outgoing fetch requests', () => testPropagation('/ignored'));
// Bun 1.3.14 does not instrument outgoing `node:http` requests.
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
test.runIf(supports({ runtimes: ['node', 'deno'] }))(
test.runIf(supports({ bunMin: '1.4.0' }))(
'propagates a negative sampling decision to outgoing node:http requests',
() => testPropagation('/ignored-http'),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ describe('no_parent_span client report', () => {
});

createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument.mjs', (createRunner, test) => {
// Bun 1.3.14 does not instrument outgoing `node:http` requests.
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
test.runIf(supports({ runtimes: ['node', 'deno'] }))(
test.runIf(supports({ bunMin: '1.4.0' }))(
'records no_parent_span outcome for an outgoing http request without a local parent',
async () => {
const runner = createRunner()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { createTestServer } from '@sentry-internal/test-utils';
import { describe, expect } from 'vitest';
import { createEsmAndCjsTests } from '../../../../utils/runner';
import { supports } from '../../../../utils';

describe('outgoing http', () => {
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
describe.runIf(supports({ bunMin: '1.4.0' }))('outgoing http', () => {
createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument.mjs', (createRunner, test) => {
test('outgoing http requests create breadcrumbs', async () => {
const [SERVER_URL, closeTestServer] = await createTestServer().start();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { createTestServer } from '@sentry-internal/test-utils';
import { describe, expect } from 'vitest';
import { createEsmAndCjsTests } from '../../../../utils/runner';
import { supports } from '../../../../utils';

describe('outgoing http with maxed-out agent sockets', () => {
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
describe.runIf(supports({ bunMin: '1.4.0' }))('outgoing http with maxed-out agent sockets', () => {
createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument.mjs', (createRunner, test) => {
test('injects trace headers into requests queued behind a busy socket', async () => {
expect.assertions(5);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { createTestServer } from '@sentry-internal/test-utils';
import { describe, expect } from 'vitest';
import { createEsmAndCjsTests } from '../../../../utils/runner';
import { supports } from '../../../../utils';

describe('outgoing http with tracePropagation disabled', () => {
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
describe.runIf(supports({ bunMin: '1.4.0' }))('outgoing http with tracePropagation disabled', () => {
createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument.mjs', (createRunner, test) => {
test('does not inject trace headers but still creates breadcrumbs', async () => {
expect.assertions(5);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { createTestServer } from '@sentry-internal/test-utils';
import { describe, expect } from 'vitest';
import { createEsmAndCjsTests } from '../../../../utils/runner';
import { supports } from '../../../../utils';

describe('outgoing http requests with tracing & spans disabled', () => {
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
describe.runIf(supports({ bunMin: '1.4.0' }))('outgoing http requests with tracing & spans disabled', () => {
createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument.mjs', (createRunner, test) => {
test('outgoing http requests are correctly instrumented with tracing & spans disabled', async () => {
expect.assertions(11);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { createTestServer } from '@sentry-internal/test-utils';
import { describe, expect } from 'vitest';
import { createEsmAndCjsTests } from '../../../../utils/runner';
import { supports } from '../../../../utils';

describe('outgoing http', () => {
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
describe.runIf(supports({ bunMin: '1.4.0' }))('outgoing http', () => {
createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument.mjs', (createRunner, test) => {
test('outgoing http requests are correctly instrumented with tracing disabled', async () => {
expect.assertions(11);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { createTestServer } from '@sentry-internal/test-utils';
import { describe, expect } from 'vitest';
import { createEsmAndCjsTests } from '../../../../utils/runner';
import { supports } from '../../../../utils';

describe('outgoing http', () => {
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
describe.runIf(supports({ bunMin: '1.4.0' }))('outgoing http', () => {
createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument.mjs', (createRunner, test) => {
test('outgoing sampled http requests without active span are correctly instrumented', async () => {
expect.assertions(11);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { createTestServer } from '@sentry-internal/test-utils';
import { describe, expect } from 'vitest';
import { createEsmAndCjsTests } from '../../../../utils/runner';
import { supports } from '../../../../utils';

describe('outgoing http', () => {
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
describe.runIf(supports({ bunMin: '1.4.0' }))('outgoing http', () => {
createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument.mjs', (createRunner, test) => {
test('outgoing sampled http requests are correctly instrumented', async () => {
expect.assertions(11);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { createTestServer } from '@sentry-internal/test-utils';
import { describe, expect } from 'vitest';
import { createEsmAndCjsTests } from '../../../../utils/runner';
import { supports } from '../../../../utils';

describe('outgoing http', () => {
// Bun before 1.4 does not instrument outgoing `node:http` requests.
// See https://github.com/getsentry/sentry-javascript/issues/23881
describe.runIf(supports({ bunMin: '1.4.0' }))('outgoing http', () => {
createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument.mjs', (createRunner, test) => {
test('outgoing http requests are correctly instrumented when not sampled', async () => {
expect.assertions(11);
Expand Down
Loading
Loading