-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
51 lines (41 loc) · 1.31 KB
/
vitest.config.ts
File metadata and controls
51 lines (41 loc) · 1.31 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
/// <reference types="vitest" />
import { defineConfig } from 'vitest/config';
import { resolve } from 'path';
export default defineConfig({
resolve: {
alias: {
'@': resolve(__dirname, './src'),
},
},
test: {
// Enable global test APIs (similar to pytest)
globals: true,
// Use happy-dom for DOM testing (lightweight alternative to jsdom)
environment: 'happy-dom',
// Test file patterns
include: ['tests/**/*.{test,spec}.{js,ts}', 'src/**/*.{test,spec}.{js,ts}'],
// Exclude patterns
exclude: ['node_modules', 'dist', 'tests/**/*.spec.js', 'playwright.config.js'],
// Watch mode configuration
watch: true,
// Reporter configuration (like pytest's output)
// reporter: (process.env.CI ? 'default' : 'verbose') as any,
// Coverage configuration
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'lcov'],
include: ['src/**/*.{js,ts,astro}'],
exclude: [
'src/pages/**', // Page components don't need unit testing
'src/content/**', // Content files
'src/types.ts',
'src/env.d.ts',
],
},
// Test setup
setupFiles: ['tests/setup.ts'],
// Test timeout (shorter for CI)
testTimeout: process.env.CI ? 5000 : 10000,
pool: 'threads',
},
});