diff --git a/test/fixtures/svelte-component/astro.config.mjs b/test/fixtures/svelte-component/astro.config.mjs index dbf6d6b8fa46..b1aeede15aac 100644 --- a/test/fixtures/svelte-component/astro.config.mjs +++ b/test/fixtures/svelte-component/astro.config.mjs @@ -3,5 +3,7 @@ import svelte from '@astrojs/svelte'; // https://astro.build/config export default defineConfig({ - integrations: [svelte()], + integrations: [svelte({ + extensions: ['.svelte', '.sve'] + })], }); \ No newline at end of file diff --git a/test/fixtures/svelte-component/src/components/Custom.sve b/test/fixtures/svelte-component/src/components/Custom.sve new file mode 100644 index 000000000000..f61026424e88 --- /dev/null +++ b/test/fixtures/svelte-component/src/components/Custom.sve @@ -0,0 +1,5 @@ + + +
{ message }
diff --git a/test/fixtures/svelte-component/src/pages/typescript.astro b/test/fixtures/svelte-component/src/pages/typescript.astro index d6b4167564d4..2de86df16cf1 100644 --- a/test/fixtures/svelte-component/src/pages/typescript.astro +++ b/test/fixtures/svelte-component/src/pages/typescript.astro @@ -1,5 +1,9 @@ --- import TypeScript from '../components/TypeScript.svelte' + +// Using a custom extension to verify svelte options +// in astro.config.mjs are passed properly to the svelte integration +import Custom from '../components/Custom.sve' --- @@ -20,6 +24,7 @@ import TypeScript from '../components/TypeScript.svelte'
+
diff --git a/test/svelte-component.test.js b/test/svelte-component.test.js index 36ba35b51beb..a68acd92432e 100644 --- a/test/svelte-component.test.js +++ b/test/svelte-component.test.js @@ -22,6 +22,13 @@ describe('Svelte component', () => { expect($('#svelte-ts').text()).to.equal('Hello, TypeScript'); }); + + it('Works with custom Svelte config', async () => { + const html = await fixture.readFile('/typescript/index.html'); + const $ = cheerio.load(html); + + expect($('#svelte-custom-ext').text()).to.equal('Hello, Custom Extensions'); + }); }); if (isWindows) return;