Skip to content

Commit 70d8410

Browse files
andreiborzas1gr1d
authored andcommitted
Add reload workoarund for dev server hydration error :(
1 parent ecc3c54 commit 70d8410

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed
Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1-
import { sentrySolidStartVite } from '@sentry/solidstart';
1+
import { withSentry } from '@sentry/solidstart';
22
import { defineConfig } from '@solidjs/start/config';
33

4-
export default defineConfig({
5-
vite: {
6-
plugins: [sentrySolidStartVite()],
7-
},
8-
});
4+
export default defineConfig(
5+
withSentry(
6+
{},
7+
{
8+
// Typically we want to default to ./src/instrument.sever.ts
9+
// `withSentry` would then build and copy the file over to
10+
// the .output folder, but since we can't use the production
11+
// server for our e2e tests, we have to delete the build folders
12+
// prior to using the dev server for our tests. Which also gets
13+
// rid of the instrument.server.mjs file that we need to --import.
14+
// Therefore, we specify the .mjs file here and to ensure
15+
// `withSentry` gets its file to build and we continue to reference
16+
// the file from the `src` folder for --import without needing to
17+
// transpile before.
18+
// This can be removed once we get the production server to work
19+
// with our e2e tests.
20+
instrumentation: './src/instrument.server.mjs',
21+
},
22+
),
23+
);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ test('captures an exception', async ({ page }) => {
1111
});
1212

1313
await page.goto('/error-boundary');
14+
// The first page load causes a hydration error on the dev server sometimes - a reload works around this
15+
await page.reload();
1416
await page.locator('#caughtErrorBtn').click();
1517
const errorEvent = await errorEventPromise;
1618

0 commit comments

Comments
 (0)