Skip to content

Commit d42d584

Browse files
committed
test: prevent svelte css hashes changing based on absolute path
previous behavior broke snapshot tests in CI. caused by sveltejs/svelte#16740
1 parent f3b28ed commit d42d584

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

testsuite/tests/dom/__snapshots__/svelte@5/examples.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ exports[`Example tutorial-localize-script/App.svelte > should render 1`] = `
836836
</button>
837837
838838
<div
839-
class="toast-container svelte-xtg016"
839+
class="toast-container svelte-166jqou"
840840
>
841841
842842
</div>

testsuite/tests/ssr/__snapshots__/svelte@5/examples.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ exports[`Example tutorial-localize-derived/App.svelte > should render 1`] = `
178178

179179
exports[`Example tutorial-localize-script/App.svelte > should render 1`] = `
180180
{
181-
"body": "<!--[--><div class="space-y-2"><button>Add to Cart</button> <div class="toast-container svelte-xtg016"><!--[--><!--]--></div><!----><!----></div><!--]-->",
181+
"body": "<!--[--><div class="space-y-2"><button>Add to Cart</button> <div class="toast-container svelte-166jqou"><!--[--><!--]--></div><!----><!----></div><!--]-->",
182182
"head": "",
183-
"html": "<!--[--><div class="space-y-2"><button>Add to Cart</button> <div class="toast-container svelte-xtg016"><!--[--><!--]--></div><!----><!----></div><!--]-->",
183+
"html": "<!--[--><div class="space-y-2"><button>Add to Cart</button> <div class="toast-container svelte-166jqou"><!--[--><!--]--></div><!----><!----></div><!--]-->",
184184
}
185185
`;

testsuite/vitest.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ const testConfigSsr = {
3939
export default defineConfig({
4040
plugins: [
4141
svelteFluent(),
42-
svelte(),
42+
svelte({
43+
compilerOptions: {
44+
cssHash: ({ hash, css }) => `svelte-${hash(css)}`
45+
}
46+
}),
4347
Icons({ compiler: 'svelte', autoInstall: true }),
4448
isSsrTest ? undefined : svelteTesting()
4549
].filter(Boolean),

0 commit comments

Comments
 (0)