-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
43 lines (41 loc) · 1.22 KB
/
Copy pathvitest.config.ts
File metadata and controls
43 lines (41 loc) · 1.22 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
import { defineConfig, loadEnv } from 'vite';
export default defineConfig(({ mode }) => {
// Load environment variables following Vite/Vitest conventions:
// .env, .env.local, .env.test, .env.test.local, etc.
const env = loadEnv(mode, process.cwd(), '');
return {
test: {
include: ['lib/**/*.test.ts', 'scripts/**/*.test.ts'],
exclude: ['**/node_modules/**', '**/dist/**'],
globals: true,
environment: 'node',
coverage: {
provider: 'v8',
include: [
// Target files for coverage
'lib/**/*.{ts,tsx}',
],
exclude: [
// Exclude files from coverage
'coverage/**',
'node_modules/**',
'vitest.config.ts',
'**/*.d.ts',
'**/*.types.ts',
'**/*.test.*',
'**/__tests__/**',
'lib/index.ts',
'lib/core/types.ts',
'lib/repository/index.ts',
],
},
},
define: {
// Make selected env vars available as process.env.* in tests if needed.
// You can read them via process.env.PROTOPEDIA_API_V2_TOKEN, etc.
'process.env.PROTOPEDIA_API_V2_TOKEN': JSON.stringify(
env.PROTOPEDIA_API_V2_TOKEN,
),
},
};
});