Skip to content

Commit e443694

Browse files
authored
fix(test): Some ANR tests should test the transport (#11465)
All of the ANR tests were verified over stdout. This PR ensures some of the basic tests actually send events over http to ensure the transport is fully tested.
1 parent 0ad046a commit e443694

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

dev-packages/node-integration-tests/suites/anr/basic-session.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ setTimeout(() => {
88
}, 10000);
99

1010
Sentry.init({
11-
dsn: 'https://[email protected]/1337',
11+
dsn: process.env.SENTRY_DSN,
1212
release: '1.0',
13-
debug: true,
1413
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1514
autoSessionTracking: true,
1615
});

dev-packages/node-integration-tests/suites/anr/basic.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ setTimeout(() => {
88
}, 10000);
99

1010
Sentry.init({
11-
dsn: 'https://[email protected]/1337',
11+
dsn: process.env.SENTRY_DSN,
1212
release: '1.0',
13-
debug: true,
1413
autoSessionTracking: false,
1514
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1615
});

dev-packages/node-integration-tests/suites/anr/basic.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ setTimeout(() => {
88
}, 10000);
99

1010
Sentry.init({
11-
dsn: 'https://[email protected]/1337',
11+
dsn: process.env.SENTRY_DSN,
1212
release: '1.0',
13-
debug: true,
1413
autoSessionTracking: false,
1514
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1615
});

dev-packages/node-integration-tests/suites/anr/isolated.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ setTimeout(() => {
88
}, 10000);
99

1010
Sentry.init({
11-
dsn: 'https://[email protected]/1337',
11+
dsn: process.env.SENTRY_DSN,
1212
release: '1.0',
13-
debug: true,
1413
autoSessionTracking: false,
1514
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1615
});

dev-packages/node-integration-tests/suites/anr/test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,19 @@ conditionalTest({ min: 16 })('should report ANR when event loop blocked', () =>
6666
});
6767

6868
test('CJS', done => {
69-
createRunner(__dirname, 'basic.js').expect({ event: EXPECTED_ANR_EVENT }).start(done);
69+
createRunner(__dirname, 'basic.js').withMockSentryServer().expect({ event: EXPECTED_ANR_EVENT }).start(done);
7070
});
7171

7272
test('ESM', done => {
73-
createRunner(__dirname, 'basic.mjs').expect({ event: EXPECTED_ANR_EVENT }).start(done);
73+
createRunner(__dirname, 'basic.mjs').withMockSentryServer().expect({ event: EXPECTED_ANR_EVENT }).start(done);
7474
});
7575

7676
test('With --inspect', done => {
77-
createRunner(__dirname, 'basic.mjs').withFlags('--inspect').expect({ event: EXPECTED_ANR_EVENT }).start(done);
77+
createRunner(__dirname, 'basic.mjs')
78+
.withMockSentryServer()
79+
.withFlags('--inspect')
80+
.expect({ event: EXPECTED_ANR_EVENT })
81+
.start(done);
7882
});
7983

8084
test('should exit', done => {
@@ -97,6 +101,7 @@ conditionalTest({ min: 16 })('should report ANR when event loop blocked', () =>
97101

98102
test('With session', done => {
99103
createRunner(__dirname, 'basic-session.js')
104+
.withMockSentryServer()
100105
.expect({
101106
session: {
102107
status: 'abnormal',
@@ -142,6 +147,9 @@ conditionalTest({ min: 16 })('should report ANR when event loop blocked', () =>
142147
};
143148

144149
test('fetches correct isolated scope', done => {
145-
createRunner(__dirname, 'isolated.mjs').expect({ event: EXPECTED_ISOLATED_EVENT }).start(done);
150+
createRunner(__dirname, 'isolated.mjs')
151+
.withMockSentryServer()
152+
.expect({ event: EXPECTED_ISOLATED_EVENT })
153+
.start(done);
146154
});
147155
});

0 commit comments

Comments
 (0)