Skip to content

Commit ba1c692

Browse files
committed
adjust tests
1 parent ab66a0b commit ba1c692

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

dev-packages/e2e-tests/test-applications/solid-solidrouter/tests/errorboundary.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test('captures an exception', async ({ page }) => {
1515
type: 'ReferenceError',
1616
value: 'NonExistentComponent is not defined',
1717
mechanism: {
18-
type: 'generic',
18+
type: 'auto.function.solid.error_boundary',
1919
handled: true,
2020
},
2121
},
@@ -39,7 +39,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
3939
type: 'ReferenceError',
4040
value: 'NonExistentComponent is not defined',
4141
mechanism: {
42-
type: 'generic',
42+
type: 'auto.function.solid.error_boundary',
4343
handled: true,
4444
},
4545
},
@@ -64,7 +64,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
6464
type: 'ReferenceError',
6565
value: 'NonExistentComponent is not defined',
6666
mechanism: {
67-
type: 'generic',
67+
type: 'auto.function.solid.error_boundary',
6868
handled: true,
6969
},
7070
},

dev-packages/e2e-tests/test-applications/solid/tests/errorboundary.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test('captures an exception', async ({ page }) => {
2222
type: 'Error',
2323
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid E2E test app',
2424
mechanism: {
25-
type: 'generic',
25+
type: 'auto.function.solid.error_boundary',
2626
handled: true,
2727
},
2828
},
@@ -53,7 +53,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
5353
type: 'Error',
5454
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid E2E test app',
5555
mechanism: {
56-
type: 'generic',
56+
type: 'auto.function.solid.error_boundary',
5757
handled: true,
5858
},
5959
},
@@ -82,7 +82,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
8282
type: 'Error',
8383
value: 'Error 2 thrown from Sentry ErrorBoundary in Solid E2E test app',
8484
mechanism: {
85-
type: 'generic',
85+
type: 'auto.function.solid.error_boundary',
8686
handled: true,
8787
},
8888
},

packages/solid/src/errorboundary.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function withSentryErrorBoundary(ErrorBoundary: Component<ErrorBoundaryPr
2020
captureException(error, {
2121
mechanism: {
2222
handled: true, // handled because user has to provide a fallback
23-
type: 'solid.error-boundary',
23+
type: 'auto.function.solid.error_boundary',
2424
},
2525
});
2626

packages/solid/test/errorboundary.test.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ describe('withSentryErrorBoundary', () => {
4949
));
5050

5151
expect(mockCaptureException).toHaveBeenCalledTimes(1);
52-
expect(mockCaptureException).toHaveBeenLastCalledWith(new ReferenceError('NonExistentComponent is not defined'));
52+
expect(mockCaptureException).toHaveBeenLastCalledWith(new ReferenceError('NonExistentComponent is not defined'), {
53+
mechanism: {
54+
handled: true,
55+
type: 'auto.function.solid.error_boundary',
56+
},
57+
});
5358
});
5459

5560
it('renders the fallback component', async () => {
@@ -89,13 +94,23 @@ describe('withSentryErrorBoundary', () => {
8994
));
9095

9196
expect(mockCaptureException).toHaveBeenCalledTimes(1);
92-
expect(mockCaptureException).toHaveBeenNthCalledWith(1, new ReferenceError('NonExistentComponent is not defined'));
97+
expect(mockCaptureException).toHaveBeenNthCalledWith(1, new ReferenceError('NonExistentComponent is not defined'), {
98+
mechanism: {
99+
handled: true,
100+
type: 'auto.function.solid.error_boundary',
101+
},
102+
});
93103

94104
const button = await findByRole('button');
95105
await user.click(button);
96106

97107
expect(mockCaptureException).toHaveBeenCalledTimes(2);
98-
expect(mockCaptureException).toHaveBeenNthCalledWith(2, new ReferenceError('NonExistentComponent is not defined'));
108+
expect(mockCaptureException).toHaveBeenNthCalledWith(2, new ReferenceError('NonExistentComponent is not defined'), {
109+
mechanism: {
110+
handled: true,
111+
type: 'auto.function.solid.error_boundary',
112+
},
113+
});
99114
});
100115

101116
it('renders children when there is no error', async () => {

0 commit comments

Comments
 (0)