lecheminvert.tech/vitest.config.ts

40 lines
1 KiB
TypeScript
Raw Permalink Normal View History

import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import { defineVitestProject } from '@nuxt/test-utils/config'
export default defineConfig({
test: {
projects: [
{
// Les tests unitaires tournent hors Nuxt : on redeclare l'alias #shared.
resolve: {
alias: { '#shared': fileURLToPath(new URL('./shared', import.meta.url)) },
},
test: {
name: 'unit',
include: ['test/unit/*.{test,spec}.ts'],
environment: 'node',
},
},
await defineVitestProject({
test: {
name: 'nuxt',
include: ['test/nuxt/*.{test,spec}.ts'],
environment: 'nuxt',
environmentOptions: {
nuxt: {
rootDir: fileURLToPath(new URL('.', import.meta.url)),
domEnvironment: 'happy-dom',
},
},
},
}),
],
coverage: {
enabled: true,
provider: 'v8',
include: ['server/**', 'shared/**'],
},
},
})