Skip to content

Commit ec8a598

Browse files
JPeer264claude
andcommitted
fixup! test(deno): Run all Node integration suites on Deno
Skip the `pg-native` tests on Deno: with a module load hook installed, Deno compiles a native addon (`libpq`) as JavaScript, which throws `SyntaxError: Invalid or unexpected token`. Any load hook triggers it, also one that only passes through, on Deno 2.8.3 and 2.9.0. The `sql.unsafe()` test ignores error events: its last query fails on purpose, and the resulting unhandled-rejection event can arrive before the transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 604816a commit ec8a598

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

  • dev-packages/node-integration-tests/suites/tracing

dev-packages/node-integration-tests/suites/tracing/postgres-streamed/test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core';
22
import type { SerializedStreamedSpanContainer } from '@sentry/core';
33
import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes';
44
import { afterAll, describe, expect } from 'vitest';
5-
import { conditionalTest } from '../../../utils';
5+
import { conditionalTest, RUNTIME } from '../../../utils';
66
import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner';
77

88
// Query-span origin depends on which instrumentation is active. Blocks driving the SDK's default
@@ -227,7 +227,8 @@ describeWithDockerCompose('postgres auto instrumentation (streamed)', { workingD
227227
});
228228
});
229229

230-
conditionalTest({ max: 25 })('pg-native', () => {
230+
// Deno: with a module load hook installed, Deno compiles a native addon (`libpq`) as JavaScript.
231+
(RUNTIME === 'deno' ? describe.skip : conditionalTest({ max: 25 }))('pg-native', () => {
231232
createEsmAndCjsTests(
232233
__dirname,
233234
'scenario-native.mjs',

dev-packages/node-integration-tests/suites/tracing/postgres/test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { afterAll, describe, expect } from 'vitest';
2-
import { conditionalTest } from '../../../utils';
2+
import { conditionalTest, RUNTIME } from '../../../utils';
33
import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner';
44

55
describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [__dirname] }, () => {
@@ -276,7 +276,8 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [
276276
});
277277
});
278278

279-
conditionalTest({ max: 25 })('pg-native', () => {
279+
// Deno: with a module load hook installed, Deno compiles a native addon (`libpq`) as JavaScript.
280+
(RUNTIME === 'deno' ? describe.skip : conditionalTest({ max: 25 }))('pg-native', () => {
280281
const EXPECTED_TRANSACTION = {
281282
transaction: 'Test Transaction',
282283
spans: expect.arrayContaining([

dev-packages/node-integration-tests/suites/tracing/postgresjs/test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,9 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory:
488488

489489
createEsmAndCjsTests(__dirname, 'scenario-unsafe.mjs', 'instrument.mjs', (createTestRunner, test) => {
490490
test('should instrument sql.unsafe() queries', { timeout: 90_000 }, async () => {
491-
await createTestRunner().expect({ transaction: EXPECTED_TRANSACTION }).start().completed();
491+
// The last query fails on purpose, and its unhandled rejection also sends an error event, which can
492+
// arrive before the transaction.
493+
await createTestRunner().ignore('event').expect({ transaction: EXPECTED_TRANSACTION }).start().completed();
492494
});
493495
});
494496
});

0 commit comments

Comments
 (0)