d3ro-voice/apps/desktop/vitest.config.ts

38 lines
1.4 KiB
TypeScript

import { defineConfig } from 'vitest/config'
import { resolve } from 'path'
const TEST_INCLUDE: Record<string, string[]> = {
all: ['tests/**/*.{test,spec}.ts'],
integration: ['tests/integration/**/*.{test,spec}.ts'],
eval: ['tests/eval/**/*.{test,spec}.ts'],
unit: ['tests/unit/**/*.{test,spec}.ts'],
service: ['tests/{main,red}/**/*.{test,spec}.ts'],
offline: ['tests/{unit,main,red}/**/*.{test,spec}.ts']
}
export default defineConfig(({ mode }) => ({
test: {
globals: true,
environment: 'node',
include: TEST_INCLUDE[mode] ?? TEST_INCLUDE.offline,
exclude: ['tests/e2e/**'],
setupFiles: ['tests/setup.ts'],
testTimeout: 10000,
// Keep the local desktop usable and avoid import-hook starvation on busy, high-core PCs.
maxWorkers: 4,
minWorkers: 1,
coverage: {
provider: 'v8',
include: ['src/main/services/**'],
exclude: ['src/main/services/index.ts']
}
},
resolve: {
alias: [
{ find: /^@d3ro\/i18n\/main$/, replacement: resolve(__dirname, '../../packages/i18n/src/main.ts') },
{ find: /^@d3ro\/i18n$/, replacement: resolve(__dirname, '../../packages/i18n/src/index.tsx') },
{ find: /^@d3ro\/core(\/.*)?$/, replacement: `${resolve(__dirname, '../../packages/core/src')}$1` },
{ find: /^@d3ro\/ui(\/.*)?$/, replacement: `${resolve(__dirname, '../../packages/ui/src')}$1` },
]
}
}))