-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
33 lines (31 loc) · 1.19 KB
/
Copy pathvitest.config.ts
File metadata and controls
33 lines (31 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { defineConfig } from 'vitest/config'
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
const root = dirname(fileURLToPath(import.meta.url))
export default defineConfig({
test: {
// Pure-function unit tests only. None of the modules under test
// (loan-math, aggregate, format) touch the DOM, so we skip jsdom and
// run in plain Node. Faster, simpler, less to maintain.
environment: 'node',
include: ['src/**/*.test.ts', 'src/**/*.test.tsx'],
// Same locale as the app — formatRupees pins en-IN, and tests assert
// exact output ("₹1,00,000"). If the test process runs under a
// different locale this still passes because Intl.NumberFormat respects
// the explicit locale argument, but keep this here as a guardrail.
globals: false,
coverage: {
provider: 'v8',
include: ['src/lib/**/*.ts'],
exclude: ['src/lib/**/*.test.ts', 'src/lib/supabase/**'],
reporter: ['text', 'html'],
},
},
resolve: {
alias: {
// Match the tsconfig "@/*" → "src/*" path so test files can import
// from "@/lib/…" just like the rest of the codebase.
'@': resolve(root, 'src'),
},
},
})