Performance: Vitest setup
MEDIUM IMPACT
This affects the development environment's startup time and test execution speed, impacting developer feedback loops.
/// vitest.config.ts import { defineConfig } from 'vitest/config'; import { svelte } from '@sveltejs/vite-plugin-svelte'; export default defineConfig({ plugins: [svelte()], test: { environment: 'jsdom', cache: true, include: ['src/**/*.{test,spec}.{js,ts,svelte}'], deps: { inline: ['@testing-library/svelte'] } } });
import { describe, it, expect } from 'vitest'; import { render } from '@testing-library/svelte'; // No config file, default settings // Tests run with full Svelte compilation each time
| Pattern | Module Compilation | Caching | Test Startup Time | Verdict |
|---|---|---|---|---|
| Default Vitest setup | Full Svelte compilation every run | No caching | Slow (several seconds) | [X] Bad |
| Configured Vitest with svelte plugin and caching | Incremental compilation with caching | Enabled | Fast (under 1 second) | [OK] Good |