Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/adapter-netlify/test/apps/edge/build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ test('_redirects are copied to publish directory', () => {
);
expect(redirects).toContain('/redirect-me /greeting/redirected 301');
});

test('treeshakes component from the server bundle if SSR is turned off', () => {
const edge_function = fs.readFileSync(edge_function_path, 'utf-8');
expect(edge_function).not.toContain('this should never appear in the server bundle');
});
10 changes: 2 additions & 8 deletions packages/adapter-netlify/test/apps/edge/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ test('read from $app/server works', async ({ request }) => {
expect(await response.text()).toBe(content);
});

test('treeshakes component from the server bundle if SSR is turned off', async ({ page }) => {
test('page renders on the client if SSR is turned off', async ({ page }) => {
await page.goto('/treeshake-server');
const component_text = 'this should never appear in the server bundle';
const server_bundle = fs.readFileSync(
path.resolve(import.meta.dirname, '../.netlify/v1/edge-functions/sveltekit-render.js'),
'utf-8'
);
expect(server_bundle).not.toContain(component_text);
await expect(page.locator('p')).toHaveText(component_text);
await expect(page.locator('p')).toHaveText('this should never appear in the server bundle');
});
Loading