-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathvitest.config.ts
63 lines (59 loc) · 1.65 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
import { defineConfig } from 'vitest/config';
import fs from 'fs';
import path from 'path';
const pkgList = fs
.readdirSync(path.join(__dirname, './packages'))
.filter((pkg: string) => pkg.charAt(0) !== '.');
const alias = {};
pkgList.forEach((shortName: string) => {
const name = `@oceanbase/${shortName}`;
alias[name] = path.join(__dirname, `./packages/${shortName}/src`);
});
export default defineConfig({
resolve: {
alias,
mainFields: ['module'],
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: [
path.join(__dirname, 'tests/vitest.setup.ts'),
path.join(__dirname, 'tests/setupTests.ts'),
],
// ref: https://github.com/vitest-dev/vitest/issues/1575#issuecomment-1439286286
globalSetup: [path.join(__dirname, 'tests/globalSetup.ts')],
// exclude part of charts tests for now
// ref: https://github.com/antvis/L7/issues/2332
exclude: [
'**/Area/__tests__/ref.test.tsx',
'**/DualAxes/__tests__/ref.test.tsx',
'**/Line/__tests__/ref.test.tsx',
'**/Pie/__tests__/donut.test.tsx',
'**/ChartProvider/__tests__/theme.test.tsx',
],
deps: {
optimizer: {
web: {
// ref: https://github.com/wobsoriano/vitest-canvas-mock
include: ['vitest-canvas-mock'],
},
},
},
poolOptions: {
threads: {
singleThread: true,
},
},
environmentOptions: {
jsdom: {
resources: 'usable',
},
},
sequence: {
// 按顺序调用钩子,和 jest 行为保持一致
// ref: https://cn.vitest.dev/guide/migration.html#%E9%92%A9%E5%AD%90
hooks: 'list',
},
},
});