Skip to content

Commit 6cd83cc

Browse files
chargomeclaude
andcommitted
test(node): Port express error-handling suites to span streaming
Drop the static trace lifecycle pins from the express suites that only capture error events, and assert on the segment span where a transaction was expected. Refs #24136 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent b7173ce commit 6cd83cc

13 files changed

Lines changed: 13 additions & 25 deletions

File tree

dev-packages/node-integration-tests/suites/express/handle-error/instrument-no-tracing.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node';
22
import { loggingTransport } from '@sentry-internal/node-integration-tests';
33

44
Sentry.init({
5-
traceLifecycle: 'static',
65
dsn: 'https://public@dsn.ingest.sentry.io/1337',
76
release: '1.0',
87
transport: loggingTransport,

dev-packages/node-integration-tests/suites/express/handle-error/instrument-sample-rate-0.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node';
22
import { loggingTransport } from '@sentry-internal/node-integration-tests';
33

44
Sentry.init({
5-
traceLifecycle: 'static',
65
dsn: 'https://public@dsn.ingest.sentry.io/1337',
76
release: '1.0',
87
transport: loggingTransport,

dev-packages/node-integration-tests/suites/express/handle-error/instrument-setup-error-handler.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { loggingTransport } from '@sentry-internal/node-integration-tests';
55
// middleware is the sole error capturer (mechanism `auto.middleware.express`) — the fallback for
66
// setups where the channel-based auto capture is unavailable.
77
Sentry.init({
8-
traceLifecycle: 'static',
98
dsn: 'https://public@dsn.ingest.sentry.io/1337',
109
release: '1.0',
1110
transport: loggingTransport,

dev-packages/node-integration-tests/suites/express/handle-error/instrument-should-handle-error.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node';
22
import { loggingTransport } from '@sentry-internal/node-integration-tests';
33

44
Sentry.init({
5-
traceLifecycle: 'static',
65
dsn: 'https://public@dsn.ingest.sentry.io/1337',
76
release: '1.0',
87
transport: loggingTransport,

dev-packages/node-integration-tests/suites/express/handle-error/instrument.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node';
22
import { loggingTransport } from '@sentry-internal/node-integration-tests';
33

44
Sentry.init({
5-
traceLifecycle: 'static',
65
dsn: 'https://public@dsn.ingest.sentry.io/1337',
76
release: '1.0',
87
tracesSampleRate: 1,

dev-packages/node-integration-tests/suites/express/handle-error/test.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@ describe('express error handling', () => {
1212
const runner = createRunner()
1313
.unordered()
1414
.expect({
15-
transaction: {
16-
transaction: 'GET /test/express/:id',
17-
contexts: {
18-
trace: {
19-
op: 'http.server',
20-
status: 'internal_error',
21-
data: expect.objectContaining({
22-
'http.response.status_code': 500,
23-
}),
24-
},
25-
},
15+
span: container => {
16+
expect(container.items.find(item => item.is_segment)).toMatchObject({
17+
name: 'GET /test/express/:id',
18+
status: 'error',
19+
attributes: expect.objectContaining({
20+
'sentry.op': { type: 'string', value: 'http.server' },
21+
'sentry.status.message': { type: 'string', value: 'internal_error' },
22+
'http.response.status_code': { type: 'integer', value: 500 },
23+
}),
24+
});
2625
},
2726
})
2827
.expect({
@@ -99,7 +98,7 @@ describe('express error handling', () => {
9998
createCjsTests(__dirname, 'scenario.mjs', 'instrument-no-tracing.mjs', (createRunner, test) => {
10099
test('should capture and send Express controller error if tracesSampleRate is not set.', async () => {
101100
const runner = createRunner()
102-
.ignore('transaction')
101+
.ignore('span')
103102
.expect({
104103
event: {
105104
exception: {

dev-packages/node-integration-tests/suites/express/multiple-init/instrument.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node';
22
import { loggingTransport } from '@sentry-internal/node-integration-tests';
33

44
Sentry.init({
5-
traceLifecycle: 'static',
65
// No dsn, means client is disabled
76
// dsn: 'https://public@dsn.ingest.sentry.io/1337',
87
release: '1.0',

dev-packages/node-integration-tests/suites/express/multiple-init/scenario.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ app.get('/test/no-init', (_req, res) => {
1919
app.get('/test/init', (_req, res) => {
2020
// Call init again, but with DSN
2121
Sentry.init({
22-
traceLifecycle: 'static',
2322
dsn: 'https://public@dsn.ingest.sentry.io/1337',
2423
release: '1.0',
2524
transport: loggingTransport,

dev-packages/node-integration-tests/suites/express/requestUser/instrument.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node';
22
import { loggingTransport } from '@sentry-internal/node-integration-tests';
33

44
Sentry.init({
5-
traceLifecycle: 'static',
65
dsn: 'https://public@dsn.ingest.sentry.io/1337',
76
release: '1.0',
87
transport: loggingTransport,

dev-packages/node-integration-tests/suites/express/sentry-trace/instrument.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as Sentry from '@sentry/node';
22
import { loggingTransport } from '@sentry-internal/node-integration-tests';
33

44
Sentry.init({
5-
traceLifecycle: 'static',
65
dsn: 'https://public@dsn.ingest.sentry.io/1337',
76
release: '1.0',
87
environment: 'prod',

0 commit comments

Comments
 (0)