eCourt-Doc-Edit/web/vitest.config.ts

21 lines
1 KiB
TypeScript
Raw Permalink Normal View History

import { fileURLToPath } from 'node:url'
2026-08-20 13:51:42 +07:00
import { defineConfig } from 'vitest/config'
// Unit test สำหรับ pure functions (fieldValidation/snapshot) + useTheme (ต้องมี DOM)
// ไม่ดึง @nuxt/test-utils — stub เฉพาะ auto-imports ที่ใช้จริง (test/setup.ts) ให้เบาและอธิบายตัวเอง
// (useTheme แยก client/server ด้วย typeof window จึงไม่ต้อง replace import.meta.client)
export default defineConfig({
test: {
environment: 'happy-dom',
setupFiles: ['./test/setup.ts'],
include: ['test/**/*.spec.ts'],
},
// alias ~/ ชี้ srcDir = app/ ตาม Nuxt — จำเป็นตอน spec import ไฟล์ที่ลาก useAuth
// (useAuth อ้าง ~/utils/oidc — เดิมไม่มี spec ไหนแตะ useApi จึงไม่เคยโดน)
resolve: {
alias: {
'~': fileURLToPath(new URL('./app', import.meta.url)),
},
},
2026-08-20 13:51:42 +07:00
})