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 bb876b2

Browse files
committed
fix and add tests
1 parent ea4d3cd commit bb876b2

File tree

12 files changed

+56
-5
lines changed

12 files changed

+56
-5
lines changed

‎dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/click-error.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@ test('should send error for faulty click handlers', async ({ page }) => {
1313

1414
expect(errorEvent).toBeDefined();
1515

16-
const frames = errorEvent?.exception?.values?.[0]?.stacktrace?.frames;
16+
const exception = errorEvent?.exception?.values?.[0];
17+
18+
expect(exception?.mechanism).toEqual({
19+
type: 'auto.browser.browserapierrors.addEventListener',
20+
handled: false,
21+
data: {
22+
handler: 'bound ed',
23+
target: 'EventTarget',
24+
},
25+
});
1726

27+
const frames = exception?.stacktrace?.frames;
1828
await test.step('error should have a non-url-encoded top frame in route with parameter', () => {
1929
if (process.env.TEST_ENV === 'development') {
2030
// In dev mode we want to check local source mapping

‎dev-packages/e2e-tests/test-applications/nextjs-13/tests/client/sessions.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ test('should report healthy sessions', async ({ page }) => {
55
test.skip(process.env.TEST_ENV === 'development', 'test is flakey in dev mode');
66

77
const sessionPromise = waitForSession('nextjs-13', session => {
8+
console.log('session', session);
89
return session.init === true && session.status === 'ok' && session.errors === 0;
910
});
1011

‎dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/getServerSideProps.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test('Should report an error event for errors thrown in getServerSideProps', asy
2323
exception: {
2424
values: [
2525
{
26-
mechanism: { handled: false, type: 'generic' },
26+
mechanism: { handled: false, type: 'auto.function.nextjs.wrapped' },
2727
type: 'Error',
2828
value: 'getServerSideProps Error',
2929
stacktrace: {
@@ -110,7 +110,7 @@ test('Should report an error event for errors thrown in getServerSideProps in pa
110110
exception: {
111111
values: [
112112
{
113-
mechanism: { handled: false, type: 'generic' },
113+
mechanism: { handled: false, type: 'auto.function.nextjs.wrapped' },
114114
type: 'Error',
115115
value: 'custom page extension error',
116116
stacktrace: {

‎dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/pages-router-api-endpoints.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test('Should report an error event for errors thrown in pages router api routes'
3030
function: 'withSentry',
3131
},
3232
handled: false,
33-
type: 'instrument',
33+
type: 'auto.http.nextjs.apiHandler',
3434
},
3535
stacktrace: { frames: expect.arrayContaining([]) },
3636
type: 'Error',

‎dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/server-component-error.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test('Should capture an error thrown in a server component', async ({ page }) =>
2020
exception: {
2121
values: [
2222
{
23-
mechanism: { handled: false, type: 'generic' },
23+
mechanism: { handled: false, type: 'auto.function.nextjs.serverComponent' },
2424
type: 'Error',
2525
value: 'RSC error',
2626
},

‎dev-packages/e2e-tests/test-applications/nextjs-15/tests/nested-rsc-error.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,9 @@ test('Should capture errors from nested server components when `Sentry.captureRe
4141
router_path: '/nested-rsc-error/[param]',
4242
request_path: '/nested-rsc-error/123',
4343
});
44+
45+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
46+
handled: false,
47+
type: 'auto.function.nextjs.onRequestError',
48+
});
4449
});

‎dev-packages/e2e-tests/test-applications/nextjs-15/tests/streaming-rsc-error.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,9 @@ test('Should capture errors for crashing streaming promises in server components
4141
router_path: '/streaming-rsc-error/[param]',
4242
request_path: '/streaming-rsc-error/123',
4343
});
44+
45+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
46+
handled: false,
47+
type: 'auto.function.nextjs.onRequestError',
48+
});
4449
});

‎dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-errors.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,13 @@ test('Sends a client-side exception to Sentry', async ({ page }) => {
3535
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
3636
span_id: expect.stringMatching(/[a-f0-9]{16}/),
3737
});
38+
39+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
40+
handled: false,
41+
type: 'auto.browser.browserapierrors.addEventListener',
42+
data: {
43+
handler: expect.stringContaining('bound uM'),
44+
target: 'EventTarget',
45+
},
46+
});
3847
});

‎dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ test('Should record exceptions for faulty edge server components', async ({ page
1919
expect(errorEvent.tags?.['my-global-scope-isolated-tag']).not.toBeDefined();
2020

2121
expect(errorEvent.transaction).toBe(`Page Server Component (/edge-server-components/error)`);
22+
23+
expect(errorEvent.exception?.values?.[0]?.mechanism).toEqual({
24+
handled: false,
25+
type: 'auto.function.nextjs.serverComponent',
26+
});
2227
});
2328

2429
test('Should record transaction for edge server components', async ({ page }) => {

‎dev-packages/e2e-tests/test-applications/nextjs-orpc/tests/orpc-error.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@ test('should capture orpc error', async ({ page }) => {
1919
}),
2020
],
2121
});
22+
23+
// orpc errors are captured manually by the orpc middleware (user-land)
24+
expect(orpcError.exception?.values?.[0]?.mechanism).toEqual({
25+
handled: true,
26+
type: 'generic',
27+
});
2228
});

0 commit comments

Comments
(0)

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