-
Notifications
You must be signed in to change notification settings - Fork 42
/
vitest.config.ts
47 lines (44 loc) · 1.33 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
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
const getSubDirectories = (dir: string): string[] =>
fs
.readdirSync(dir)
.filter((item) => fs.statSync(path.join(dir, item)).isDirectory())
const root = path.dirname(fileURLToPath(import.meta.url))
const pluginPackages = getSubDirectories(path.resolve(root, 'plugins'))
const themePackages = getSubDirectories(path.resolve(root, 'themes'))
export default defineConfig({
resolve: {
alias: [
{
find: new RegExp(`^@vuepress/(${pluginPackages.join('|')})$`),
replacement: path.resolve(root, './plugins/$1/src/index.ts'),
},
{
find: new RegExp(`^@vuepress/(${themePackages.join('|')})$`),
replacement: path.resolve(root, './themes/$1/src/index.ts'),
},
{
find: new RegExp(`^@vuepress/(${themePackages.join('|')}/client)$`),
replacement: path.resolve(root, './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,
},
},
})