-
-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathvitest.config.ts
More file actions
52 lines (49 loc) · 1.2 KB
/
vitest.config.ts
File metadata and controls
52 lines (49 loc) · 1.2 KB
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
import * as path from 'path';
import type {ViteUserConfig} from 'vitest/config';
import {defineConfig, mergeConfig} from 'vitest/config';
export default defineConfig(() => {
const testType = process.env.RUN_TEST ?? 'unit';
const config = defineConfig({
test: {
env: {
FASTIFY_AUTOLOAD_TYPESCRIPT: '1',
},
server: {
deps: {
inline: ['@fastify/autoload'],
},
},
},
resolve: {
alias: {
'@api/domain': path.resolve(
'src/common/domainFunctions/functions.d.ts',
),
},
},
});
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,
defineConfig({
test: {
fileParallelism: false,
include: ['./test/**/*.integration.test.ts'],
sequence: {
hooks: 'list',
},
globalSetup: ['./test/setup-integration.ts'],
},
} satisfies ViteUserConfig),
);
}
return {};
});