diff --git a/package.json b/package.json index f585082..a9d1d4b 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "preview": "vite preview", "test": "vitest", "test:run": "vitest run", + "test:coverage": "vitest run --coverage", "test:integration": "vitest run tests/integration", "test:regression": "vitest run tests/regression --update", "test:e2e": "playwright test", diff --git a/vitest.config.js b/vitest.config.js new file mode 100644 index 0000000..db67bf3 --- /dev/null +++ b/vitest.config.js @@ -0,0 +1,31 @@ +import { defineConfig } from 'vitest/config' +import react from '@vitejs/plugin-react' + +export default defineConfig({ + plugins: [react()], + test: { + environment: 'jsdom', + globals: true, + setupFiles: ['./src/test/setup.js'], + include: ['src/**/*.{test,spec}.{js,jsx}', 'tests/**/*.{test,spec}.js'], + exclude: ['tests/e2e/**', 'tests/performance/**', 'tests/regression/visual.test.js', 'node_modules/**'], + snapshotFormat: { + escapeString: true, + printBasicPrototype: false, + }, + coverage: { + provider: 'v8', + reporter: ['text', 'lcov', 'html'], + exclude: [ + 'node_modules/', + 'tests/', + '**/*.test.js', + '**/*.config.js' + ], + lines: 80, + functions: 80, + branches: 80, + statements: 80 + }, + }, +})