-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvitest.config.ts
More file actions
50 lines (49 loc) · 2.03 KB
/
Copy pathvitest.config.ts
File metadata and controls
50 lines (49 loc) · 2.03 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
import { fileURLToPath } from 'node:url';
import { ExternalPackageIconLoader } from 'unplugin-icons/loaders';
import Icons from 'unplugin-icons/vite';
import { configDefaults, defineConfig } from 'vitest/config';
export default defineConfig({
test: {
// apps/mobile is its own project: it pins react to RN's bundled renderer, so its tests must
// resolve a different copy than everything else (apps/mobile/vitest.config.ts).
projects: [
{
// Mirror the renderers' unplugin-icons setup so modules importing `~icons/*`
// virtual modules (e.g. the shell's AgentIcon) load under the root vitest runner.
plugins: [
Icons({
compiler: 'jsx',
jsx: 'react',
customCollections: ExternalPackageIconLoader('@proj-airi/lobe-icons'),
}),
],
resolve: {
// Mirror apps/desktop's `@renderer` path alias (apps/desktop/tsconfig.json +
// electron.vite.config.ts) so the desktop unit tests resolve under this runner.
alias: {
'@renderer': fileURLToPath(new URL('./apps/desktop/src/renderer/src', import.meta.url)),
},
},
test: {
name: 'default',
include: [
'packages/**/src/**/__tests__/**/*.test.{ts,tsx}',
'apps/**/src/**/__tests__/**/*.test.{ts,tsx}',
'packages/**/tests/{contract,integration}/**/*.test.{ts,tsx}',
'apps/**/tests/{contract,integration}/**/*.test.{ts,tsx}',
'.github/scripts/**/*.test.mjs',
],
exclude: [...configDefaults.exclude, 'apps/mobile/**'],
environment: 'node',
// Belongs to this project rather than the root: projects do not inherit root `test`
// options, and what it patches (jsdom gaps `@pierre/diffs` hits) is web-renderer only.
setupFiles: [
'./vitest.setup.ts',
'./packages/host/agent-adapter/src/__tests__/vitest.setup.ts',
],
},
},
'./apps/mobile/vitest.config.ts',
],
},
});