37 lines
1.2 KiB
TypeScript
37 lines
1.2 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: {
|
|
'@d3ro/core': resolve(__dirname, '../../packages/core/src'),
|
|
'@d3ro/ui': resolve(__dirname, '../../packages/ui/src'),
|
|
'@d3ro/i18n': resolve(__dirname, '../../packages/i18n/src/index.tsx')
|
|
}
|
|
}
|
|
}))
|