24 lines
841 B
TypeScript
24 lines
841 B
TypeScript
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
export default defineConfig(({ mode }) => ({
|
|
plugins: [tailwindcss(), sveltekit()],
|
|
// Under Vitest, resolve Svelte's browser (client) build so components can
|
|
// `mount` in jsdom instead of hitting the SSR build.
|
|
resolve: mode === 'test' ? { conditions: ['browser'] } : {},
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
setupFiles: ['./vitest-setup.ts'],
|
|
include: ['src/**/*.{test,spec}.{js,ts}'],
|
|
alias: {
|
|
// SvelteKit's $env virtual module isn't available outside the dev server.
|
|
'$env/dynamic/public': fileURLToPath(
|
|
new URL('./src/test-mocks/env-dynamic-public.ts', import.meta.url)
|
|
)
|
|
}
|
|
}
|
|
}));
|