mirror of
https://github.com/saltbo/zpan.git
synced 2026-09-19 10:01:12 +08:00
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>
68 lines
1.6 KiB
TypeScript
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,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
})
|