forked from vuejs/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest.config.ts
64 lines (60 loc) · 1.61 KB
/
vitest.config.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
import { configDefaults, defineConfig, UserConfig } from 'vitest/config'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { readdirSync } from 'node:fs'
const resolve = p =>
path.resolve(fileURLToPath(import.meta.url), `../packages/${p}/src/index.ts`)
const dirs = readdirSync(new URL('./packages', import.meta.url))
const alias = {
vue: resolve('vue'),
'vue/compiler-sfc': resolve('compiler-sfc'),
'vue/server-renderer': resolve('server-renderer'),
'@vue/compat': resolve('vue-compat')
}
for (const dir of dirs) {
const key = `@vue/${dir}`
if (dir !== 'vue' && !(key in alias)) {
alias[key] = resolve(dir)
}
}
export default defineConfig({
define: {
__DEV__: true,
__TEST__: true,
__VERSION__: '"test"',
__BROWSER__: false,
__GLOBAL__: false,
__ESM_BUNDLER__: true,
__ESM_BROWSER__: false,
__NODE_JS__: true,
__SSR__: true,
__FEATURE_OPTIONS_API__: true,
__FEATURE_SUSPENSE__: true,
__FEATURE_PROD_DEVTOOLS__: false,
__COMPAT__: true
},
resolve: {
alias
},
test: {
globals: true,
setupFiles: 'scripts/setupVitest.ts',
environmentMatchGlobs: [
['packages/{vue,vue-compat,runtime-dom}/**', 'jsdom']
],
sequence: {
hooks: 'list'
},
coverage: {
provider: 'istanbul',
reporter: ['text', 'html'],
exclude: [
...configDefaults.coverage.exclude!,
// DOM transitions are tested via e2e so no coverage is collected
'packages/runtime-dom/src/components/Transition*',
// mostly entries
'packages/vue-compat/**'
]
}
}
}) as UserConfig