Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a99673b

Browse files
committed
annotate more captureException calls, add a bunch of test assertions
1 parent ff2d3ce commit a99673b

File tree

14 files changed

+94
-5
lines changed

14 files changed

+94
-5
lines changed

‎dev-packages/e2e-tests/test-applications/nestjs-11/tests/cron-decorator.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ test('Sends exceptions to Sentry on error in cron job', async ({ baseURL }) => {
7171

7272
expect(errorEvent.exception?.values).toHaveLength(1);
7373
expect(errorEvent.exception?.values?.[0]?.value).toBe('Test error from cron job');
74+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
75+
handled: false,
76+
type: 'auto.cron.nestjs.async',
77+
});
78+
7479
expect(errorEvent.contexts?.trace).toEqual({
7580
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
7681
span_id: expect.stringMatching(/[a-f0-9]{16}/),

‎dev-packages/e2e-tests/test-applications/nestjs-11/tests/errors.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ test('Sends exception to Sentry', async ({ baseURL }) => {
1313

1414
expect(errorEvent.exception?.values).toHaveLength(1);
1515
expect(errorEvent.exception?.values?.[0]?.value).toBe('This is an exception with id 123');
16+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
17+
handled: false,
18+
type: 'auto.http.nestjs.global_filter',
19+
});
1620

1721
expect(errorEvent.request).toEqual({
1822
method: 'GET',

‎dev-packages/e2e-tests/test-applications/nestjs-8/tests/errors.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ test('Sends exception to Sentry', async ({ baseURL }) => {
1313

1414
expect(errorEvent.exception?.values).toHaveLength(1);
1515
expect(errorEvent.exception?.values?.[0]?.value).toBe('This is an exception with id 123');
16+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
17+
handled: false,
18+
type: 'auto.http.nestjs.global_filter',
19+
});
1620

1721
expect(errorEvent.request).toEqual({
1822
method: 'GET',

‎dev-packages/e2e-tests/test-applications/nestjs-basic-with-graphql/tests/errors.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ test('Sends exception to Sentry', async ({ baseURL }) => {
1414
expect(errorEvent.exception?.values).toHaveLength(1);
1515
expect(errorEvent.exception?.values?.[0]?.value).toBe('This is an exception with id 123');
1616

17+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
18+
handled: false,
19+
type: 'auto.http.nestjs.global_filter',
20+
});
21+
1722
expect(errorEvent.request).toEqual({
1823
method: 'GET',
1924
cookies: {},
@@ -102,6 +107,11 @@ test('Sends graphql exception to Sentry', async ({ baseURL }) => {
102107
expect(errorEvent.exception?.values).toHaveLength(1);
103108
expect(errorEvent.exception?.values?.[0]?.value).toBe('This is an exception!');
104109

110+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
111+
handled: false,
112+
type: 'auto.graphql.nestjs.global_filter',
113+
});
114+
105115
expect(errorEvent.request).toEqual({
106116
method: 'POST',
107117
cookies: {},

‎dev-packages/e2e-tests/test-applications/nestjs-basic/tests/cron-decorator.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ test('Sends exceptions to Sentry on error in async cron job', async ({ baseURL }
7575
span_id: expect.stringMatching(/[a-f0-9]{16}/),
7676
});
7777

78+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
79+
handled: false,
80+
type: 'auto.cron.nestjs.async',
81+
});
82+
7883
// kill cron so tests don't get stuck
7984
await fetch(`${baseURL}/kill-test-cron/test-async-cron-error`);
8085
});
@@ -92,6 +97,11 @@ test('Sends exceptions to Sentry on error in sync cron job', async ({ baseURL })
9297
span_id: expect.stringMatching(/[a-f0-9]{16}/),
9398
});
9499

100+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
101+
handled: false,
102+
type: 'auto.cron.nestjs',
103+
});
104+
95105
// kill cron so tests don't get stuck
96106
await fetch(`${baseURL}/kill-test-cron/test-sync-cron-error`);
97107
});

‎dev-packages/e2e-tests/test-applications/nestjs-basic/tests/errors.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ test('Sends exception to Sentry', async ({ baseURL }) => {
1313

1414
expect(errorEvent.exception?.values).toHaveLength(1);
1515
expect(errorEvent.exception?.values?.[0]?.value).toBe('This is an exception with id 123');
16+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
17+
handled: false,
18+
type: 'auto.http.nestjs.global_filter',
19+
});
1620

1721
expect(errorEvent.request).toEqual({
1822
method: 'GET',

‎dev-packages/e2e-tests/test-applications/nestjs-distributed-tracing/tests/events.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ test('Event emitter', async () => {
2121
type: 'Error',
2222
value: 'Test error from event handler',
2323
stacktrace: expect.any(Object),
24-
mechanism: expect.any(Object),
24+
mechanism: {
25+
handled: false,
26+
type: 'auto.event.nestjs',
27+
},
2528
},
2629
],
2730
});

‎dev-packages/e2e-tests/test-applications/nestjs-fastify/tests/cron-decorator.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ test('Sends exceptions to Sentry on error in cron job', async ({ baseURL }) => {
7171

7272
expect(errorEvent.exception?.values).toHaveLength(1);
7373
expect(errorEvent.exception?.values?.[0]?.value).toBe('Test error from cron job');
74+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
75+
handled: false,
76+
type: 'auto.cron.nestjs.async',
77+
});
7478
expect(errorEvent.contexts?.trace).toEqual({
7579
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
7680
span_id: expect.stringMatching(/[a-f0-9]{16}/),

‎dev-packages/e2e-tests/test-applications/nestjs-fastify/tests/errors.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ test('Sends exception to Sentry', async ({ baseURL }) => {
1414
expect(errorEvent.exception?.values).toHaveLength(1);
1515
expect(errorEvent.exception?.values?.[0]?.value).toBe('This is an exception with id 123');
1616

17+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
18+
handled: false,
19+
type: 'auto.http.nestjs.global_filter',
20+
});
21+
1722
expect(errorEvent.request).toEqual({
1823
method: 'GET',
1924
cookies: {},

‎dev-packages/e2e-tests/test-applications/nestjs-graphql/tests/errors.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ test('Sends exception to Sentry', async ({ baseURL }) => {
3232
expect(errorEvent.exception?.values).toHaveLength(1);
3333
expect(errorEvent.exception?.values?.[0]?.value).toBe('This is an exception!');
3434

35+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
36+
handled: false,
37+
type: 'auto.graphql.nestjs.global_filter',
38+
});
39+
3540
expect(errorEvent.request).toEqual({
3641
method: 'POST',
3742
cookies: {},

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /