This repository was archived by the owner on Aug 17, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvitest.config.ts
More file actions
87 lines (85 loc) · 3.14 KB
/
Copy pathvitest.config.ts
File metadata and controls
87 lines (85 loc) · 3.14 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
82
83
84
85
86
87
import { defineConfig } from 'vitest/config';
import { coverageThresholds } from './src/core/testing/coverage-gate';
export default defineConfig({
test: {
globals: true,
environment: 'node',
globalSetup: ['./tests/global-setup.ts'],
// Per-worker setup: pins NODE_ENV='test' before any user test
// code (or imported source module) loads. Counters Bun's `.env`
// autoload — a fresh consumer's `.env` ships with
// `NODE_ENV=development` and the assertion in
// `tests/unit/test-infrastructure.spec.ts` would otherwise fail.
setupFiles: [
'./tests/setup-files/pin-node-env.ts',
'./tests/setup-files/clean-module-email-overlays.ts',
],
include: ['tests/**/*.{spec,test,e2e-spec,story.test}.ts'],
exclude: ['node_modules', 'dist', 'tests/k6/**', 'tests/types/**'],
testTimeout: 30_000,
hookTimeout: 120_000,
pool: 'forks',
coverage: {
provider: 'v8',
// `json-summary` writes coverage-summary.json which the /dev/coverage
// page reads to render the totals + per-file table.
reporter: ['text', 'cobertura', 'html', 'json-summary'],
reportsDirectory: 'reports/coverage',
include: ['src/core/**', 'src/modules/**', 'src/shared/**'],
exclude: [
'src/**/*.d.ts',
'src/**/*.dto.ts',
'src/**/index.ts',
'src/main.ts',
// NestJS module declarations + thin controllers are integration-
// tested via e2e specs (real HTTP roundtrip). Excluding them
// from the unit-coverage gate keeps the threshold focused on
// pure-function logic where unit tests buy real safety.
'src/**/*.module.ts',
'src/**/*.controller.ts',
'src/**/*.interceptor.ts',
'src/**/*.middleware.ts',
'src/**/*.guard.ts',
// Dev-Portal SPA source. Browser-only React tree, bundled by
// `bun run build:dev-portal` and exercised manually in
// development. The shell renderer (dev-portal-shell.ts) stays
// covered — it crosses the trust boundary (server → browser).
'src/core/dx/clients/**',
// Non-source artefacts that may live inside src/ but never
// execute: directory placeholders, ignore lists, docs. v8 can
// pick these up if they end up in the include glob — exclude
// explicitly so the coverage report stays focused on real code.
'src/**/.gitkeep',
'src/**/.gitignore',
'src/**/.prettierrc',
'src/**/.prettierignore',
'src/**/.eslintrc*',
'src/**/.eslintignore',
'src/**/.npmignore',
'src/**/.npmrc',
'src/**/.env',
'src/**/.env.*',
'src/**/CLAUDE.md',
'src/**/README.md',
'src/**/*.md',
'src/**/*.json',
'src/**/*.yml',
'src/**/*.yaml',
'src/**/*.toml',
'src/**/*.lock',
],
thresholds: coverageThresholds,
},
reporters: process.env.CI ? ['default', 'junit'] : ['default'],
outputFile: {
junit: 'reports/junit.xml',
},
},
resolve: {
alias: {
'@core': '/src/core',
'@modules': '/src/modules',
'@shared': '/src/shared',
},
},
});