/
constants.ts
73 lines (63 loc) · 1.2 KB
/
constants.ts
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
// if changed, update also jsdocs and docs
export const defaultPort = 51204
export const defaultBrowserPort = 63315
export const EXIT_CODE_RESTART = 43
export const API_PATH = '/__vitest_api__'
export const extraInlineDeps = [
/^(?!.*(?:node_modules)).*\.mjs$/,
/^(?!.*(?:node_modules)).*\.cjs\.js$/,
// Vite client
/vite\w*\/dist\/client\/env.mjs/,
// Nuxt
'@nuxt/test-utils',
]
export const CONFIG_NAMES = [
'vitest.config',
'vite.config',
]
const WORKSPACES_NAMES = [
'vitest.workspace',
'vitest.projects',
]
const CONFIG_EXTENSIONS = [
'.ts',
'.mts',
'.cts',
'.js',
'.mjs',
'.cjs',
]
export const configFiles = CONFIG_NAMES.flatMap(name =>
CONFIG_EXTENSIONS.map(ext => name + ext),
)
const WORKSPACES_EXTENSIONS = [
...CONFIG_EXTENSIONS,
'.json',
]
export const workspacesFiles = WORKSPACES_NAMES.flatMap(name =>
WORKSPACES_EXTENSIONS.map(ext => name + ext),
)
export const globalApis = [
// suite
'suite',
'test',
'describe',
'it',
// chai
'chai',
'expect',
'assert',
// typecheck
'expectTypeOf',
'assertType',
// utils
'vitest',
'vi',
// hooks
'beforeAll',
'afterAll',
'beforeEach',
'afterEach',
'onTestFinished',
'onTestFailed',
]