2024-07-11 18:22:22 +01:00
|
|
|
import { defineProject } from 'vitest/config';
|
2024-06-16 05:26:37 +01:00
|
|
|
import { defaultConfig } from './vite.config';
|
|
|
|
|
2024-07-11 18:22:22 +01:00
|
|
|
export default defineProject(({ mode }) => ({
|
2024-06-16 05:26:37 +01:00
|
|
|
...defaultConfig,
|
|
|
|
test: {
|
2024-07-11 18:22:22 +01:00
|
|
|
name: "main",
|
|
|
|
include: ["./src/test/**/*.{test,spec}.ts"],
|
|
|
|
exclude: ["./src/test/pre.test.ts"],
|
2024-06-16 05:26:37 +01:00
|
|
|
setupFiles: ['./src/test/vitest.setup.ts'],
|
|
|
|
server: {
|
|
|
|
deps: {
|
|
|
|
inline: ['vitest-canvas-mock'],
|
|
|
|
optimizer: {
|
|
|
|
web: {
|
|
|
|
include: ['vitest-canvas-mock'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
environment: 'jsdom' as const,
|
|
|
|
environmentOptions: {
|
|
|
|
jsdom: {
|
|
|
|
resources: 'usable',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
threads: false,
|
|
|
|
trace: true,
|
|
|
|
restoreMocks: true,
|
|
|
|
watch: false,
|
|
|
|
coverage: {
|
|
|
|
provider: 'istanbul' as const,
|
|
|
|
reportsDirectory: 'coverage' as const,
|
|
|
|
reporters: ['text-summary', 'html'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
esbuild: {
|
|
|
|
pure: mode === 'production' ? [ 'console.log' ] : [],
|
|
|
|
keepNames: true,
|
|
|
|
},
|
|
|
|
}))
|