generated from MapColonies/jobnik-worker-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.mts
More file actions
48 lines (43 loc) · 1.3 KB
/
vitest.config.mts
File metadata and controls
48 lines (43 loc) · 1.3 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
import { defineConfig, ViteUserConfig } from 'vitest/config';
import tsconfig from './tsconfig.json';
import path from '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({
resolve: {
alias: pathAlias,
},
test: {
setupFiles: ['./tests/setup/vite.setup.ts'],
include: ['tests/**/*.spec.ts'],
environment: 'node',
reporters,
coverage: {
enabled: true,
reporter: ['text', 'html', 'json', 'json-summary'],
include: ['src/**/*.ts'],
exclude: ['**/vendor/**', 'node_modules/**', 'src/index.ts', 'src/worker.ts'],
reportOnFailure: true,
thresholds: {
global: {
statements: 80,
branches: 80,
functions: 80,
lines: 80,
},
},
},
},
});