-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathvitest.config.ts
49 lines (45 loc) · 1.4 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
import fs from 'node:fs'
import path from 'node:path'
import { defineConfig } from 'vitest/config'
import { getDirname } from 'vuepress/utils'
const __dirname = import.meta.dirname || getDirname(import.meta.url)
const getSubDirectories = (dir: string): string[] =>
fs
.readdirSync(dir)
.filter((item) => fs.statSync(path.join(dir, item)).isDirectory())
const pluginPackages = getSubDirectories(path.resolve(__dirname, 'plugins'))
const themePackages = getSubDirectories(path.resolve(__dirname, 'themes'))
export default defineConfig({
resolve: {
alias: [
{
find: new RegExp(`^@vuepress/(${pluginPackages.join('|')})$`),
replacement: path.resolve(__dirname, './plugins/$1/src/index.ts'),
},
{
find: new RegExp(`^@vuepress/(${themePackages.join('|')})$`),
replacement: path.resolve(__dirname, './themes/$1/src/index.ts'),
},
{
find: new RegExp(`^@vuepress/(${themePackages.join('|')}/client)$`),
replacement: path.resolve(__dirname, './themes/$1/src/client/index.ts'),
},
],
},
test: {
coverage: {
all: false,
provider: 'istanbul',
reporter: ['clover', 'json', 'lcov', 'text'],
},
include: [
'plugins/**/tests/**/*.spec.ts',
'themes/**/tests/**/*.spec.ts',
'tools/**/tests/**/*.spec.ts',
],
typecheck: {
enabled: true,
ignoreSourceErrors: true,
},
},
})