-
Notifications
You must be signed in to change notification settings - Fork 645
Expand file tree
/
Copy pathvitest.config.mts
More file actions
110 lines (92 loc) · 2.87 KB
/
vitest.config.mts
File metadata and controls
110 lines (92 loc) · 2.87 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// eslint-disable-next-line import-x/no-nodejs-modules
import { join } from 'path';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
const IFRAME_PATH = join(
import.meta.dirname,
'../snaps-execution-environments/dist/webpack/iframe',
);
const IFRAME_TEST_PATH = join(
import.meta.dirname,
'./src/services/iframe/test',
);
const WORKER_EXECUTOR_PATH = join(
import.meta.dirname,
'../snaps-execution-environments/dist/webpack/worker-executor',
);
const WORKER_POOL_PATH = join(
import.meta.dirname,
'../snaps-execution-environments/dist/webpack/worker-pool',
);
export default defineConfig({
plugins: [tsconfigPaths(), nodePolyfills()],
server: {
proxy: {
'/iframe/executor': {
target: `http://localhost:63315/@fs${IFRAME_PATH}`,
rewrite: (path) => path.replace(/^\/iframe\/executor/u, ''),
},
'/iframe/test': {
target: `http://localhost:63315/@fs${IFRAME_TEST_PATH}`,
rewrite: (path) => path.replace(/^\/iframe\/test/u, ''),
},
'/worker/executor': {
target: `http://localhost:63315/@fs${WORKER_EXECUTOR_PATH}`,
rewrite: (path) => path.replace(/^\/worker\/executor/u, ''),
},
'/worker/pool': {
target: `http://localhost:63315/@fs${WORKER_POOL_PATH}`,
rewrite: (path) => path.replace(/^\/worker\/pool/u, ''),
},
},
fs: {
strict: true,
allow: [
'./src/services/iframe/test',
'../snaps-execution-environments/dist/webpack/iframe',
'../snaps-execution-environments/dist/webpack/worker-executor',
'../snaps-execution-environments/dist/webpack/worker-pool',
],
},
},
test: {
// Vitest enables watch mode by default. We disable it here, so it can be
// explicitly enabled with `yarn test:browser --watch`.
watch: false,
// The files to include in the test run.
include: ['src/**/*.test.browser.ts'],
browser: {
enabled: true,
headless: true,
provider: 'playwright',
instances: [{ browser: 'chromium' }],
},
coverage: {
enabled: true,
reportsDirectory: 'coverage/vite',
// Configure the coverage provider. We use `istanbul` instead of `v8`
// because it seems to be more reliable.
provider: 'istanbul',
// The files to include in the coverage report.
include: [
'src/**/*.ts',
'src/**/*.tsx',
'src/**/*.js',
'src/**/*.jsx',
'src/**/*.mjs',
],
// The files to exclude from the coverage report.
exclude: [
'src/**/index.ts',
'src/**/*.d.ts',
'src/**/*.test.ts',
'src/**/*.test.tsx',
'src/**/test-utils/**',
'src/**/__mocks__/**',
'src/**/node-js/**',
'src/services/node.ts',
],
},
},
});