-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
50 lines (48 loc) · 1.84 KB
/
vitest.config.ts
File metadata and controls
50 lines (48 loc) · 1.84 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
/**
* vitest.config.ts
*
* Purpose:
* Configures the Vitest testing framework for the FitFlow application using TypeScript,
* establishing a robust test environment that supports component and unit testing. This
* configuration enables React component testing, code coverage reporting, and a simulated
* browser environment to ensure thorough testing of the application's functionality.
*
* Key Features:
* - React plugin integration for JSX/TSX support in tests
* - JSDOM environment for browser API simulation
* - Global test variables for simplified test writing
* - Configurable setup files for test environment preparation
* - Comprehensive code coverage reporting options
*
* Technical Details:
* - Enables React's JSX/TSX transformations during tests
* - Uses JSDOM to simulate DOM operations in Node.js
* - Configures global variables for cleaner test syntax
* - Includes setup files for shared test utilities and mocks
* - Specifies coverage reporters for both console and visual reporting
*
* Integration:
* - Referenced when running npm test commands
* - Works alongside src/test/setup.ts for consistent test environment
* - Supports the Testing Library ecosystem for component testing
* - Enables continuous integration with coverage thresholds
* - Integrates with TypeScript for type-safe testing
*
* Recent Changes:
* - 2025-03-01: Added comprehensive documentation following project standards
* - 2025-02-15: Initial configuration with React, JSDOM and coverage reporting
*/
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts'],
coverage: {
reporter: ['text', 'html'],
exclude: ['node_modules/', 'src/test/setup.ts'],
},
},
});