2024-07-11 17:22:22 +00:00
|
|
|
import { defineProject } from 'vitest/config';
|
2024-06-16 04:26:37 +00:00
|
|
|
import { defaultConfig } from './vite.config';
|
|
|
|
|
2024-07-11 17:22:22 +00:00
|
|
|
export default defineProject(({ mode }) => ({
|
2024-06-16 04:26:37 +00:00
|
|
|
...defaultConfig,
|
|
|
|
test: {
|
2024-07-11 17:22:22 +00:00
|
|
|
name: "main",
|
|
|
|
include: ["./src/test/**/*.{test,spec}.ts"],
|
|
|
|
exclude: ["./src/test/pre.test.ts"],
|
2024-06-16 04:26:37 +00: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,
|
|
|
|
},
|
|
|
|
}))
|