-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
33 lines (31 loc) · 1.06 KB
/
Copy pathvitest.config.ts
File metadata and controls
33 lines (31 loc) · 1.06 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
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
// CI 为了 `next build` 在整个 job 里设了 NODE_ENV=production;单元测试必须以 test 模式运行,
// 否则 vite 会把 jsdom 环境下的 Node 内置模块(如 crypto)当成浏览器不可用而做空桩。
Object.assign(process.env, { NODE_ENV: 'test' });
export default defineConfig({
plugins: [react()],
test: {
globals: true,
environment: 'jsdom',
// polyfill IndexedDB
setupFiles: ['./test/setup.ts', './test/setup-dom.ts'],
// increase timeout if needed for async IndexedDB operations
testTimeout: 10000,
// exclude e2e tests which are run by Playwright separately
// exclude server tests which require external dependencies
exclude: [
'node_modules',
'**/node_modules/**',
'.next',
'.next/**',
'.claude/**',
'dist',
'e2e/**/*.spec.ts',
'test/server.test.ts',
'test/Calendar.test.tsx',
'test/KnowledgeGraph.test.tsx',
'test/NoteList.test.tsx',
],
},
});