Skip to content

Commit

Permalink
fix: update testcase to adapt to new sveltekit output no longer retai…
Browse files Browse the repository at this point in the history
…ning module names in filename
  • Loading branch information
dominikg committed Jan 20, 2025
1 parent 28c5c47 commit d702062
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/e2e-tests/kit-node/__tests__/kit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,24 @@ describe('kit-node', () => {

if (isBuild) {
it('should not include dynamic import from onmount in ssr output', async () => {
const serverFiles = await glob('.svelte-kit/output/server/**/*.js', { cwd: testDir });
const includesClientOnlyModule = serverFiles.some((file: string) =>
const ssrManifest = JSON.parse(
readFileContent('.svelte-kit/output/server/.vite/manifest.json')
);
const serverFilesSrc = Object.values(ssrManifest)
.filter((e) => !!e.src)
.map((e) => e.src);
const includesClientOnlyModule = serverFilesSrc.some((file: string) =>
file.includes('client-only-module')
);
expect(includesClientOnlyModule).toBe(false);
});
it('should include dynamic import from onmount in client output', async () => {
const clientFiles = await glob('.svelte-kit/output/client/**/*.js', { cwd: testDir });
const includesClientOnlyModule = clientFiles.some((file: string) =>
file.includes('client-only-module')
const clientManifest = JSON.parse(
readFileContent('.svelte-kit/output/client/.vite/manifest.json')
);
expect(includesClientOnlyModule).toBe(true);
const clientOnlyOutput = clientManifest['src/client-only-module.js'];
expect(clientOnlyOutput).toBeDefined();
expect(clientOnlyOutput.isDynamicEntry).toBe(true);
});
}

Expand Down

0 comments on commit d702062

Please sign in to comment.