-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
81 lines (75 loc) · 2.16 KB
/
vitest.config.ts
File metadata and controls
81 lines (75 loc) · 2.16 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { setup } from '@ark/attest'
import tsconfigPaths from 'vite-tsconfig-paths'
import { configDefaults, defineConfig } from 'vitest/config'
const ssrResolveConditions = [
'module',
'node',
'development|production',
]
const testExclude = [
...configDefaults.exclude,
'.claude/**',
'**/build/**',
'**/*.demo.{js,jsx,ts,tsx,mjs,mts,cjs,cts}',
'tools/oxlint-custom-rules/tests/fixtures/**',
'**/*.test-d.ts',
]
const coverageExclude = [
'**/*.d.ts',
'**/*.test-d.ts',
'**/*.test-helpers.ts',
'**/*.demo.{js,jsx,ts,tsx,mjs,mts,cjs,cts}',
'**/*.{test,spec}.{js,jsx,ts,tsx,mjs,mts,cjs,cts}',
'**/__tests/**',
'**/__tests__/**',
'**/__snapshots__/**',
'**/__mocks__/**',
'**/__examples__/**',
'**/build/**',
'.claude/**',
'tools/oxlint-custom-rules/tests/fixtures/**',
]
const repoRoot = import.meta.dirname
const packageRelativeRoot = process.cwd().replace(`${repoRoot}/`, ``)
const packageSpecificCoverageExclude =
packageRelativeRoot === 'packages/kitz' || packageRelativeRoot === 'packages/platform'
? ['src/**/*.ts']
: []
// Run attest type checking only when explicitly requested via ATTEST env var
if (process.env[`ATTEST`] === `true`) {
setup()
}
export default defineConfig({
// TODO: Remove cast when fixed: https://github.com/vitest-dev/vitest/issues/9126
plugins: [tsconfigPaths() as any],
resolve: {
alias: {
// Circular devDep workaround - see .claude/rules/circular-devdep-workaround.md
'#kitz/test/test': `${repoRoot}/packages/test/src/__.ts`,
'#kitz/test': `${repoRoot}/packages/test/src/_.ts`,
'#kitz/assert/assert': `${repoRoot}/packages/assert/src/__.ts`,
'#kitz/assert': `${repoRoot}/packages/assert/src/_.ts`,
},
},
test: {
globals: false,
globalSetup: [`${repoRoot}/vitest.global-setup.ts`],
include: configDefaults.include,
exclude: testExclude,
coverage: {
provider: 'v8',
reporter: ['text'],
exclude: [...coverageExclude, ...packageSpecificCoverageExclude],
thresholds: {
perFile: true,
lines: 70,
functions: 70,
},
},
},
ssr: {
resolve: {
conditions: ssrResolveConditions,
},
},
})