-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Expand file tree
/
Copy pathvitest.config.e2e.ts
More file actions
77 lines (73 loc) · 3.03 KB
/
Copy pathvitest.config.e2e.ts
File metadata and controls
77 lines (73 loc) · 3.03 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
import { resolve } from 'node:path'
import { defaultExclude, defineConfig } from 'vitest/config'
const isBuild = !!process.env.VITE_TEST_BUILD
const isBundledDev = !isBuild && !!process.env.VITE_TEST_BUNDLED_DEV
// Spec files that do not pass yet with `experimental.bundledDev` forced on
// (`pnpm run test-serve-bundled`) — remove entries as bundled dev gains
// support (vitejs/vite#23028). A file where only a few cases fail is not
// listed here; those cases are marked `test.skipIf(isBundledDev)` instead.
const bundledDevExclude = [
'./playground/assets/__tests__/runtime-base/assets-runtime-base.spec.ts',
'./playground/backend-integration/__tests__/backend-integration.spec.ts',
'./playground/chunk-importmap/__tests__/chunk-importmap.spec.ts',
'./playground/csp/__tests__/csp.spec.ts',
'./playground/css-codesplit/__tests__/css-codesplit.spec.ts',
'./playground/css-no-codesplit/__tests__/css-no-codesplit.spec.ts',
'./playground/forward-console/__test__/forward-console.spec.ts',
'./playground/fs-serve/__tests__/base/fs-serve-base.spec.ts',
'./playground/fs-serve/__tests__/deny/fs-serve-deny.spec.ts',
'./playground/fs-serve/__tests__/fs-serve.spec.ts',
'./playground/hmr-ssr/__tests__/hmr-ssr.spec.ts',
'./playground/legacy/__tests__/chunk-importmap/legacy-chunk-importmap.spec.ts',
'./playground/object-hooks/__tests__/object-hooks.spec.ts',
'./playground/optimize-deps/__tests__/optimize-deps.spec.ts',
'./playground/tailwind-v3/__test__/tailwind-v3.spec.ts',
'./playground/tailwind/__test__/tailwind.spec.ts',
'./playground/transform-plugin/__tests__/base/transform-plugin.spec.ts',
'./playground/worker/__tests__/es/worker-es.spec.ts',
'./playground/worker/__tests__/iife/worker-iife.spec.ts',
'./playground/worker/__tests__/relative-base-iife/worker-relative-base-iife.spec.ts',
'./playground/worker/__tests__/relative-base/worker-relative-base.spec.ts',
]
const timeout = process.env.PWDEBUG ? Infinity : process.env.CI ? 50000 : 30000
export default defineConfig({
resolve: {
alias: {
// eslint-disable-next-line n/no-unsupported-features/node-builtins
'~utils': resolve(import.meta.dirname, './playground/test-utils'),
},
},
test: {
include: ['./playground/**/*.spec.[tj]s'],
exclude: [
...(isBundledDev ? bundledDevExclude : []),
...(isBuild
? [
'./playground/object-hooks/**/*.spec.[tj]s', // object hook sequential
]
: []),
...defaultExclude,
],
setupFiles: ['./playground/vitestSetup.ts'],
globalSetup: ['./playground/vitestGlobalSetup.ts'],
testTimeout: timeout,
hookTimeout: timeout,
reporters: 'dot',
deps: {
// Prevent Vitest from running the workspace packages in Vite's SSR runtime
moduleDirectories: ['node_modules', 'packages'],
},
expect: {
poll: {
timeout: 50 * (process.env.CI ? 200 : 50),
},
},
env: {
NODE_ENV: process.env.VITE_TEST_BUILD ? 'production' : 'development',
},
},
oxc: {
target: 'node20',
},
publicDir: false,
})