-
Notifications
You must be signed in to change notification settings - Fork 645
Expand file tree
/
Copy pathvitest.config.mts
More file actions
90 lines (76 loc) · 2.24 KB
/
vitest.config.mts
File metadata and controls
90 lines (76 loc) · 2.24 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
// 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',
);
export default defineConfig({
plugins: [tsconfigPaths(), nodePolyfills()],
optimizeDeps: {
include: [
'vite-plugin-node-polyfills/shims/buffer',
'vite-plugin-node-polyfills/shims/global',
'vite-plugin-node-polyfills/shims/process',
],
},
server: {
proxy: {
'/iframe/executor': {
target: `http://localhost:63317/@fs${IFRAME_PATH}`,
rewrite: (path) => path.replace(/^\/iframe\/executor/u, ''),
},
},
fs: {
strict: true,
allow: ['../snaps-execution-environments/dist/webpack/iframe'],
},
},
test: {
// Vitest enables watch mode by default. We disable it here, so it can be
// explicitly enabled with `yarn test:browser --watch`.
watch: false,
api: {
// The port to use for the test server. This is used by the browser
// provider to connect to the test server.
port: 63317,
strictPort: true,
},
// 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',
reporter: ['json', 'json-summary', 'html'],
// 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/eval-worker.ts',
],
},
},
});