-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
vitest.shared.mts
49 lines (44 loc) · 1.19 KB
/
vitest.shared.mts
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 { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { type UserWorkspaceConfig } from 'vitest/config';
const CURRENT_DIR = dirname(fileURLToPath(import.meta.url));
const WORKSPACE_ROOT = resolve(CURRENT_DIR, './');
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: [resolve(WORKSPACE_ROOT, './test/setupVitest.ts')],
environment: 'jsdom',
environmentOptions: {
jsdom: {
pretendToBeVisual: true,
url: 'http://localhost',
},
},
browser: browserConfig,
env: {
VITEST: 'true',
},
},
resolve: {
alias: {
docs: resolve(WORKSPACE_ROOT, './docs'),
},
},
};
export default config;