-
-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathvitest.config.ts
43 lines (40 loc) · 1.01 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
import * as path from 'path';
import {defineConfig, mergeConfig, UserConfig} from 'vitest/config';
export default defineConfig(() => {
const testType = process.env.RUN_TEST ?? 'unit';
const config = {
test: {
deps: {
inline: ['@fastify/autoload'],
},
},
resolve: {
alias: {
'@api/domain': path.resolve(
'src/common/domainFunctions/functions.d.ts',
),
},
},
} satisfies UserConfig;
if (testType === 'unit') {
return mergeConfig(config, {
test: {
exclude: ['./test/**/*.integration.test.ts'],
include: ['./test/**/*.test.ts'],
globalSetup: ['./test/setup-unit.ts'],
},
});
} else if (testType === 'integration') {
return mergeConfig(config, {
test: {
include: ['./test/**/*.integration.test.ts'],
threads: false,
sequence: {
hooks: 'list',
},
globalSetup: ['./test/setup-integration.ts'],
},
} satisfies UserConfig);
}
return {};
});