-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathvitest.config.ts
More file actions
67 lines (62 loc) · 1.51 KB
/
vitest.config.ts
File metadata and controls
67 lines (62 loc) · 1.51 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import os from 'node:os';
import { playwright } from '@vitest/browser-playwright';
import { defineConfig } from 'vitest/config';
import { VITE_PLUGINS } from './vite.config';
export default defineConfig({
test: {
projects: [
{
test: {
name: 'unit',
environment: 'node',
include: ['**/*.test.ts'],
},
},
{
test: {
name: 'e2e',
include: ['**/*.test-e2e.ts', '**/*.test-e2e.tsx'],
includeTaskLocation: true,
browser: {
enabled: true,
provider: playwright(),
viewport: {
width: 900,
height: 500,
},
// https://vitest.dev/guide/browser/playwright
// ideally, 'webkit' or 'safari', but there are potential issues with the Audio API
instances: [{ browser: 'chromium' }],
},
env: {
PLATFORM: getTauriPlatform(),
},
},
plugins: VITE_PLUGINS,
publicDir: 'src/__tests__/assets',
},
],
},
optimizeDeps: {
include: [
'react',
'react-dom/client',
'react/jsx-dev-runtime',
'@lingui/core',
'@lingui/react',
'vitest-browser-react',
],
},
});
function getTauriPlatform() {
switch (os.platform()) {
case 'darwin':
return 'macos';
case 'win32':
return 'windows';
case 'linux':
return 'linux';
default:
throw new Error(`Unsupported platform: ${os.platform()}`);
}
}