-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
57 lines (48 loc) · 1.81 KB
/
Copy pathvitest.config.ts
File metadata and controls
57 lines (48 loc) · 1.81 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
/**
* ========================================================================
* Vitest Configuration
* ========================================================================
* Purpose: Configure Vitest for unit and integration tests (jsdom env)
* Docs: https://vitest.dev/config/
* ========================================================================
*/
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
// ---- Environment ----
// Use JSDOM so React components can be mounted in tests. This
// provides a browser-like DOM API for rendering and assertions.
environment: 'jsdom',
// ---- Setup & Globals ----
// Setup file executed before running tests (e.g., matchers, globals)
setupFiles: ['vitest.setup.ts'],
// ---- Globals ----
// Allow global test helpers like `describe`, `it`, `expect` for
// convenience in test files.
globals: true,
// Limit discovery to test and spec files written in TS/TSX.
include: ['**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}'],
// ---- Coverage & Output ----
// Coverage configuration: include source files, exclude test helpers
coverage: {
// Use V8 native instrumentation for fast coverage collection.
provider: 'v8',
// Generate terminal, machine-readable, and browsable reports.
reporter: ['text', 'json', 'html'],
// Write generated coverage artifacts into the project coverage folder.
reportsDirectory: './coverage',
// Exclude setup, generated, build, and non-target files from coverage.
exclude: [
'node_modules/',
'vitest.config.ts',
'vitest.setup.ts',
'**/*.test.ts',
'**/*.test.tsx',
'**/*.spec.ts',
'**/*.spec.tsx',
'**/dist/',
'**/build/',
],
},
},
});