tests
This commit is contained in:
+20
-4
@@ -1,7 +1,23 @@
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [tailwindcss(), sveltekit()]
|
||||
});
|
||||
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)
|
||||
)
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user