Closed
Description
The setup docs for Svelte Testing Library say
Add
vitest.config.js
, or update your existingvite.config.js
, with thesvelte
andsvelteTesting
Vite plugins.
And specifies the config as:
import {defineConfig} from 'vitest/config'
import {svelte} from '@sveltejs/vite-plugin-svelte'
import {svelteTesting} from '@testing-library/svelte/vite'
export default defineConfig({
plugins: [svelte(), svelteTesting()],
test: {
environment: 'jsdom',
setupFiles: ['./vitest-setup.js'],
},
})
However when using SvelteKit you need to use its Vite plugin, which will already be in your config. So in that case it would look like this:
import {defineConfig} from 'vitest/config'
import {sveltekit} from '@sveltejs/kit/vite'
import {svelteTesting} from '@testing-library/svelte/vite'
export default defineConfig({
plugins: [sveltekit(), svelteTesting()],
test: {
environment: 'jsdom',
setupFiles: ['./vitest-setup.js'],
},
})
I'd do a PR but I'm using all of this for the first time, so probably not the right person to go editing the docs right now.
Metadata
Metadata
Assignees
Labels
No labels