mirror of
https://github.com/saltbo/zpan.git
synced 2026-08-29 00:01:42 +08:00
80 lines
2.0 KiB
TypeScript
80 lines
2.0 KiB
TypeScript
import path from 'node:path'
|
|
import react from '@vitejs/plugin-react-swc'
|
|
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',
|
|
'src/routes/u/**/*.tsx',
|
|
'src/routes/_authenticated/settings/**/*.tsx',
|
|
],
|
|
exclude: [
|
|
'server/entry-*.ts',
|
|
'server/**/*.test.ts',
|
|
'server/**/*.integration.test.ts',
|
|
'server/**/*.cf-test.ts',
|
|
'server/**/*.libsql-test.ts',
|
|
'server/test/**',
|
|
'server/platform/**',
|
|
'server/db/**',
|
|
'shared/**/*.test.ts',
|
|
'src/**/*.test.ts',
|
|
'src/**/*.integration.test.ts',
|
|
'src/i18n/index.ts',
|
|
],
|
|
reporter: ['text', 'json'] as const,
|
|
}
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
globals: true,
|
|
projects: [
|
|
{
|
|
plugins: [react()],
|
|
resolve: { alias: aliases },
|
|
test: {
|
|
name: 'unit',
|
|
environment: 'jsdom',
|
|
include: ['server/**/*.test.ts', 'shared/**/*.test.ts', 'src/**/*.test.ts', 'src/**/*.test.tsx'],
|
|
exclude: ['**/*.integration.test.ts', '**/*.cf-test.ts', '**/e2e-*.test.ts'],
|
|
coverage: {
|
|
...coverageConfig,
|
|
thresholds: {
|
|
statements: 60,
|
|
branches: 50,
|
|
functions: 40,
|
|
lines: 60,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
resolve: { alias: aliases },
|
|
test: {
|
|
name: 'integration',
|
|
include: ['server/**/*.integration.test.ts', 'src/**/*.integration.test.ts'],
|
|
coverage: {
|
|
...coverageConfig,
|
|
thresholds: {
|
|
statements: 90,
|
|
branches: 80,
|
|
functions: 90,
|
|
lines: 90,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
})
|