-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.mts
More file actions
76 lines (72 loc) · 2.05 KB
/
vitest.config.mts
File metadata and controls
76 lines (72 loc) · 2.05 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { defineConfig, ViteUserConfig } from 'vitest/config';
import tsconfig from './tsconfig.json';
import path from 'node:path';
// Create an alias object from the paths in tsconfig.json
const pathAlias = 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('/*', '')),
])
);
const reporters: Exclude<ViteUserConfig['test'], undefined>['reporters'] = ['default', 'html'];
if (process.env.GITHUB_ACTIONS) {
reporters.push('github-actions');
}
export default defineConfig({
test: {
projects: [
{
test: {
name: 'unit',
setupFiles: ['./tests/configurations/vite.setup.ts'],
include: ['tests/unit/**/*.spec.ts'],
environment: 'node',
},
resolve: {
alias: pathAlias,
},
},
{
test: {
name: 'integration',
setupFiles: ['./tests/configurations/vite.setup.ts'],
globalSetup: ['./tests/configurations/global-setup.ts'],
include: ['tests/integration/**/*.spec.ts'],
environment: 'node',
testTimeout: 30_000,
hookTimeout: 60_000,
env: {
DB_HOST: '127.0.0.1',
DB_PORT: '55432',
DB_USERNAME: 'postgres',
DB_PASSWORD: 'postgres',
DB_NAME: 'sync_layer_test',
DB_ENABLE_SSL: 'false',
},
},
resolve: {
alias: pathAlias,
},
},
],
reporters,
coverage: {
enabled: true,
reporter: ['text', 'html', 'json', 'json-summary'],
include: ['src/**/*.ts'],
exclude: ['**/vendor/**', 'node_modules/**'],
reportOnFailure: true,
thresholds: {
global: {
statements: 80,
branches: 80,
functions: 80,
lines: 80,
},
},
},
},
});