Skip to content

Commit cec35de

Browse files
committed
Flake be gone
1 parent 8eec189 commit cec35de

File tree

5 files changed

+86
-79
lines changed

5 files changed

+86
-79
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,15 @@
1-
import * as Sentry from '@sentry/solidstart';
2-
import type { ParentProps } from 'solid-js';
3-
import { ErrorBoundary, createSignal, onMount } from 'solid-js';
4-
5-
const SentryErrorBoundary = Sentry.withSentryErrorBoundary(ErrorBoundary);
6-
7-
const [count, setCount] = createSignal(1);
8-
const [caughtError, setCaughtError] = createSignal(false);
9-
101
export default function ClientErrorPage() {
112
return (
12-
<SampleErrorBoundary>
13-
{caughtError() && (
14-
<Throw error={`Error ${count()} thrown from Sentry ErrorBoundary in Solid Start E2E test app`} />
15-
)}
16-
<section class="bg-gray-100 text-gray-700 p-8">
17-
<div class="flex flex-col items-start space-x-2">
18-
<button
19-
class="border rounded-lg px-2 mb-2 border-red-500 text-red-500 cursor-pointer"
20-
id="caughtErrorBtn"
21-
onClick={() => setCaughtError(true)}
22-
>
23-
Throw caught error
24-
</button>
25-
</div>
26-
<div class="flex flex-col items-start space-x-2">
27-
<button
28-
class="border rounded-lg px-2 mb-2 border-red-500 text-red-500 cursor-pointer"
29-
id="errorBtn"
30-
onClick={() => {
31-
throw new Error('Uncaught error thrown from Solid Start E2E test app');
32-
}}
33-
>
34-
Throw uncaught error
35-
</button>
36-
</div>
37-
</section>
38-
</SampleErrorBoundary>
39-
);
40-
}
41-
42-
function Throw(props: { error: string }) {
43-
onMount(() => {
44-
throw new Error(props.error);
45-
});
46-
return null;
47-
}
48-
49-
function SampleErrorBoundary(props: ParentProps) {
50-
return (
51-
<SentryErrorBoundary
52-
fallback={(error, reset) => (
53-
<section class="bg-gray-100 text-gray-700 p-8">
54-
<h1 class="text-2xl font-bold">Error Boundary Fallback</h1>
55-
<div class="flex items-center space-x-2 mb-4">
56-
<code>{error.message}</code>
57-
</div>
58-
<button
59-
id="errorBoundaryResetBtn"
60-
class="border rounded-lg px-2 border-gray-900"
61-
onClick={() => {
62-
setCount(count() + 1);
63-
setCaughtError(false);
64-
reset();
65-
}}
66-
>
67-
Reset
68-
</button>
69-
</section>
70-
)}
71-
>
72-
{props.children}
73-
</SentryErrorBoundary>
3+
<div class="flex flex-col items-start space-x-2">
4+
<button
5+
class="border rounded-lg px-2 mb-2 border-red-500 text-red-500 cursor-pointer"
6+
id="errorBtn"
7+
onClick={() => {
8+
throw new Error('Uncaught error thrown from Solid Start E2E test app');
9+
}}
10+
>
11+
Throw uncaught error
12+
</button>
13+
</div>
7414
);
7515
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import * as Sentry from '@sentry/solidstart';
2+
import type { ParentProps } from 'solid-js';
3+
import { ErrorBoundary, createSignal, onMount } from 'solid-js';
4+
5+
const SentryErrorBoundary = Sentry.withSentryErrorBoundary(ErrorBoundary);
6+
7+
const [count, setCount] = createSignal(1);
8+
const [caughtError, setCaughtError] = createSignal(false);
9+
10+
export default function ErrorBoundaryTestPage() {
11+
return (
12+
<SampleErrorBoundary>
13+
{caughtError() && (
14+
<Throw error={`Error ${count()} thrown from Sentry ErrorBoundary in Solid Start E2E test app`} />
15+
)}
16+
<section class="bg-gray-100 text-gray-700 p-8">
17+
<div class="flex flex-col items-start space-x-2">
18+
<button
19+
class="border rounded-lg px-2 mb-2 border-red-500 text-red-500 cursor-pointer"
20+
id="caughtErrorBtn"
21+
onClick={() => setCaughtError(true)}
22+
>
23+
Throw caught error
24+
</button>
25+
</div>
26+
</section>
27+
</SampleErrorBoundary>
28+
);
29+
}
30+
31+
function Throw(props: { error: string }) {
32+
onMount(() => {
33+
throw new Error(props.error);
34+
});
35+
return null;
36+
}
37+
38+
function SampleErrorBoundary(props: ParentProps) {
39+
return (
40+
<SentryErrorBoundary
41+
fallback={(error, reset) => (
42+
<section class="bg-gray-100 text-gray-700 p-8">
43+
<h1 class="text-2xl font-bold">Error Boundary Fallback</h1>
44+
<div class="flex items-center space-x-2 mb-4">
45+
<code>{error.message}</code>
46+
</div>
47+
<button
48+
id="errorBoundaryResetBtn"
49+
class="border rounded-lg px-2 border-gray-900"
50+
onClick={() => {
51+
setCount(count() + 1);
52+
setCaughtError(false);
53+
reset();
54+
}}
55+
>
56+
Reset
57+
</button>
58+
</section>
59+
)}
60+
>
61+
{props.children}
62+
</SentryErrorBoundary>
63+
);
64+
}

dev-packages/e2e-tests/test-applications/solidstart/src/routes/index.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export default function Home() {
1414
<li>
1515
<A href="/server-error">Server error</A>
1616
</li>
17+
<li>
18+
<A href="/error-boundary">Error Boundary</A>
19+
</li>
1720
<li>
1821
<A id="navLink" href="/users/5">
1922
User 5

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect, test } from '@playwright/test';
22
import { waitForError } from '@sentry-internal/test-utils';
33

4-
test.skip('captures an exception', async ({ page }) => {
4+
test('captures an exception', async ({ page }) => {
55
const errorEventPromise = waitForError('solidstart', errorEvent => {
66
return (
77
!errorEvent.type &&
@@ -10,7 +10,7 @@ test.skip('captures an exception', async ({ page }) => {
1010
);
1111
});
1212

13-
await page.goto('/client-error');
13+
await page.goto('/error-boundary');
1414
await page.locator('#caughtErrorBtn').click();
1515
const errorEvent = await errorEventPromise;
1616

@@ -27,11 +27,11 @@ test.skip('captures an exception', async ({ page }) => {
2727
},
2828
],
2929
},
30-
transaction: '/client-error',
30+
transaction: '/error-boundary',
3131
});
3232
});
3333

34-
test.skip('captures a second exception after resetting the boundary', async ({ page }) => {
34+
test('captures a second exception after resetting the boundary', async ({ page }) => {
3535
const firstErrorEventPromise = waitForError('solidstart', errorEvent => {
3636
return (
3737
!errorEvent.type &&
@@ -40,7 +40,7 @@ test.skip('captures a second exception after resetting the boundary', async ({ p
4040
);
4141
});
4242

43-
await page.goto('/client-error');
43+
await page.goto('/error-boundary');
4444
await page.locator('#caughtErrorBtn').click();
4545
const firstErrorEvent = await firstErrorEventPromise;
4646

@@ -57,7 +57,7 @@ test.skip('captures a second exception after resetting the boundary', async ({ p
5757
},
5858
],
5959
},
60-
transaction: '/client-error',
60+
transaction: '/error-boundary',
6161
});
6262

6363
const secondErrorEventPromise = waitForError('solidstart', errorEvent => {
@@ -85,6 +85,6 @@ test.skip('captures a second exception after resetting the boundary', async ({ p
8585
},
8686
],
8787
},
88-
transaction: '/client-error',
88+
transaction: '/error-boundary',
8989
});
9090
});

dev-packages/e2e-tests/test-applications/solidstart/tests/errors.client.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test.describe('client-side errors', () => {
1818
type: 'Error',
1919
value: 'Uncaught error thrown from Solid Start E2E test app',
2020
mechanism: {
21-
type: 'instrument',
21+
type: 'onerror',
2222
handled: false,
2323
},
2424
},

0 commit comments

Comments
 (0)