-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvitest.config.mts
43 lines (39 loc) · 1.04 KB
/
vitest.config.mts
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 path from 'path';
import { defineConfig, configDefaults } from 'vitest/config';
import tsconfig from './tsconfig.json';
const alias = Object.fromEntries(
// For Each Path in tsconfig.json
Object.entries(tsconfig.compilerOptions.paths).map(([key, [value]]) => [
// Remove the "/*" from the key and resolve the path
key.replace('/*', ''),
// Remove the "/*" from the value Resolve the relative path
path.resolve(__dirname, value.replace('/*', '')),
]),
);
export default defineConfig({
test: {
environment: 'node',
include: ['**/?(*.)+(spec).[tj]s?(x)'],
coverage: {
enabled: true,
reporter: ['text', 'html'],
exclude: [...configDefaults.coverage.exclude!, '**/{commitlint,lint-staged}.config.*'],
thresholds: {
statements: 80,
branches: 80,
functions: 80,
lines: 80,
perFile: true,
},
},
clearMocks: true,
restoreMocks: true,
mockReset: true,
expect: {
requireAssertions: true,
},
},
resolve: {
alias,
},
});