Add 813 new tests (+31.6%) to bring all covered files to thresholds: - 4 zero-coverage models (KeyRecovery, BulkReplace, TopNavbar, TranslationRunResult) → 100% with L1 model-invariant tests - 8 low-coverage models extended past thresholds - UI components (Pagination 1→31, Skeleton 20, Badge 27, ConfirmDialog 21) - API modules (api.ts, cot-logger, maintenance, reports) → 100% - Utils/stores (dateFormat, timezone, toasts, stores, maintenance) Production changes: - Add GRACE contract headers (@RATIONALE/@REJECTED) to 10+ files - Fix batcheslength→batches.length typo in TranslationRunResult.svelte - Refactor Badge.svelte || expressions into cls() helper
88 lines
2.8 KiB
JavaScript
88 lines
2.8 KiB
JavaScript
import { defineConfig } from 'vitest/config';
|
|
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
import path from 'path';
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
svelte()
|
|
],
|
|
test: {
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
include: [
|
|
'src/**/*.{test,spec}.{js,ts}',
|
|
'src/lib/**/*.test.{js,ts}',
|
|
'src/lib/**/__tests__/*.{test,spec}.{js,ts}',
|
|
'src/lib/**/__tests__/test_*.{js,ts}',
|
|
'tests/**/*.test.{js,ts}'
|
|
],
|
|
exclude: [
|
|
'node_modules/**',
|
|
'dist/**'
|
|
],
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'json', 'html'],
|
|
include: [
|
|
'src/lib/stores/**/*.{js,ts}',
|
|
'src/lib/models/**/*.{js,ts}',
|
|
'src/lib/api/**/*.{js,ts}',
|
|
'src/lib/auth/**/*.{js,ts}',
|
|
'src/lib/helpers/**/*.{js,ts}',
|
|
'src/lib/utils/**/*.{js,ts}',
|
|
'src/lib/api.ts',
|
|
'src/lib/routes.ts',
|
|
'src/lib/utils.ts',
|
|
'src/lib/cot-logger.ts',
|
|
'src/lib/toasts.svelte.ts',
|
|
'src/lib/stores.svelte.ts',
|
|
'src/lib/ui/**/*.{js,ts,svelte}',
|
|
'!src/lib/**/*.test.*',
|
|
'!src/lib/**/__tests__/**',
|
|
'!src/lib/**/mocks/**',
|
|
'!src/lib/**/*.spec.*',
|
|
'!src/lib/**/locales/**',
|
|
],
|
|
exclude: [
|
|
'src/lib/components/**',
|
|
'src/lib/i18n/**',
|
|
'src/lib/Counter.svelte',
|
|
'src/lib/stores/__tests__/setupTests.ts',
|
|
'src/lib/stores/__tests__/mocks/**',
|
|
'src/routes/**',
|
|
'src/services/**',
|
|
'src/components/**',
|
|
'node_modules/**',
|
|
'dist/**',
|
|
],
|
|
thresholds: {
|
|
perFile: true,
|
|
statements: 98,
|
|
lines: 98,
|
|
functions: 95,
|
|
branches: 80,
|
|
'src/lib/ui/Badge.svelte': {
|
|
branches: 76,
|
|
},
|
|
},
|
|
clean: true,
|
|
},
|
|
setupFiles: ['./src/lib/stores/__tests__/setupTests.js'],
|
|
alias: [
|
|
{ find: '$app/environment', replacement: path.resolve(__dirname, './src/lib/stores/__tests__/mocks/environment.js') },
|
|
{ find: '$app/stores', replacement: path.resolve(__dirname, './src/lib/stores/__tests__/mocks/stores.js') },
|
|
{ find: '$app/state', replacement: path.resolve(__dirname, './src/lib/stores/__tests__/mocks/state.js') },
|
|
{ find: '$app/navigation', replacement: path.resolve(__dirname, './src/lib/stores/__tests__/mocks/navigation.js') },
|
|
{ find: '$env/static/public', replacement: path.resolve(__dirname, './src/lib/stores/__tests__/mocks/env_public.js') },
|
|
{ find: '$components', replacement: path.resolve(__dirname, './src/components') }
|
|
]
|
|
},
|
|
resolve: {
|
|
conditions: ['mode=browser', 'browser'],
|
|
alias: {
|
|
'$lib': path.resolve(__dirname, './src/lib'),
|
|
'$app': path.resolve(__dirname, './src'),
|
|
'$components': path.resolve(__dirname, './src/components')
|
|
}
|
|
}
|
|
}); |