forked from mui/base-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest.shared.ts
49 lines (43 loc) · 1.17 KB
/
vitest.shared.ts
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
import * as path from 'node:path';
import { type UserWorkspaceConfig } from 'vitest/config';
const WORKSPACE_ROOT = path.resolve(__dirname, './');
const environment = process.env.VITEST_ENV;
type ProjectConfig = UserWorkspaceConfig['test'] & {};
const browserConfig: ProjectConfig['browser'] =
environment === 'chromium' || environment === 'firefox'
? {
enabled: true,
name: environment,
provider: 'playwright',
headless: !!process.env.CI,
viewport: {
width: 1024,
height: 896,
},
}
: undefined;
const config: UserWorkspaceConfig = {
test: {
exclude: ['node_modules', 'build', '**/*.spec.*'],
globals: true,
setupFiles: [path.resolve(WORKSPACE_ROOT, './test/setupVitest.ts')],
environment: 'jsdom',
environmentOptions: {
jsdom: {
pretendToBeVisual: true,
url: 'http://localhost',
},
},
browser: browserConfig,
env: {
VITEST: 'true',
},
},
resolve: {
alias: {
'@base_ui/react': path.resolve(WORKSPACE_ROOT, './packages/mui-base/src'),
docs: path.resolve(WORKSPACE_ROOT, './docs'),
},
},
};
export default config;