Files
zpan/vitest.config.ts
T
saltboandClaude Opus 4.6 df32f35ba9 refactor(test): separate unit and integration tests
Rename 19 integration test files from *.test.ts to *.integration.test.ts.
Configure vitest projects to run them independently with separate coverage
thresholds. CI now reports unit and integration coverage as separate flags
to Codecov.

Unit tests: pure function calls, mocked dependencies, no DB
Integration tests: createTestApp() with in-memory DB + HTTP requests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 21:01:37 -04:00

68 lines
1.6 KiB
TypeScript

import path from 'node:path'
import { defineConfig } from 'vitest/config'
const aliases = {
'@': path.resolve(__dirname, './src'),
'@shared': path.resolve(__dirname, './shared'),
'@server': path.resolve(__dirname, './server'),
}
const coverageConfig = {
provider: 'v8' as const,
include: ['server/**/*.ts', 'shared/**/*.ts', 'src/lib/**/*.ts', 'src/i18n/**/*.ts'],
exclude: [
'server/entry-*.ts',
'server/**/*.test.ts',
'server/**/*.integration.test.ts',
'server/**/*.cf-test.ts',
'server/test/**',
'server/platform/**',
'server/db/**',
'shared/**/*.test.ts',
'src/**/*.test.ts',
'src/i18n/index.ts',
],
reporter: ['text', 'json'] as const,
}
export default defineConfig({
test: {
globals: true,
projects: [
{
resolve: { alias: aliases },
test: {
name: 'unit',
include: ['server/**/*.test.ts', 'shared/**/*.test.ts', 'src/**/*.test.ts'],
exclude: ['**/*.integration.test.ts', '**/*.cf-test.ts'],
coverage: {
...coverageConfig,
thresholds: {
statements: 50,
branches: 40,
functions: 50,
lines: 50,
},
},
},
},
{
resolve: { alias: aliases },
test: {
name: 'integration',
include: ['server/**/*.integration.test.ts'],
coverage: {
...coverageConfig,
thresholds: {
statements: 90,
branches: 80,
functions: 90,
lines: 90,
},
},
},
},
],
},
})