generated from custom-cards/boilerplate-card
-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
vite.config.ts
84 lines (78 loc) · 1.96 KB
/
vite.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
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
77
78
79
80
81
82
83
84
import { defineConfig } from 'vitest/config';
// These globs are expected to have 100% coverage.
const FULL_COVERAGE_FILES_RELATIVE = [
'camera-manager/*.ts',
'camera-manager/browse-media/camera.ts',
'camera-manager/browse-media/utils/*.ts',
'camera-manager/frigate/camera.ts',
'camera-manager/frigate/requests.ts',
'camera-manager/frigate/util.ts',
'camera-manager/generic/*.ts',
'camera-manager/reolink/*.ts',
'camera-manager/utils/*.ts',
'card-controller/**/*.ts',
'components-lib/**/!(timeline-source.ts)',
'config/**/*.ts',
'const.ts',
'types.ts',
'utils/action.ts',
'utils/audio.ts',
'utils/basic.ts',
'utils/camera.ts',
'utils/casting.ts',
'utils/custom-icons.ts',
'utils/debug.ts',
'utils/diagnostics.ts',
'utils/download.ts',
'utils/embla/**/*.ts',
'utils/endpoint.ts',
'utils/ha/integration/**/*.ts',
'utils/ha/registry/**/*.ts',
'utils/ha/types.ts',
'utils/initializer.ts',
'utils/interaction-mode.ts',
'utils/media-info.ts',
'utils/media-layout.ts',
'utils/media.ts',
'utils/ptz.ts',
'utils/screenshot.ts',
'utils/substream.ts',
'utils/text-direction.ts',
'utils/timer.ts',
'utils/zod.ts',
'view/*.ts',
];
interface Threshold {
statements: number;
branches: number;
functions: number;
lines: number;
perFile: boolean;
}
const fullCoverage: Threshold = {
statements: 100,
branches: 100,
functions: 100,
lines: 100,
perFile: true,
};
const calculateFullCoverageThresholds = (): Record<string, Threshold> => {
return FULL_COVERAGE_FILES_RELATIVE.reduce(
(a, v) => ({ ...a, ['**/src/' + v]: fullCoverage }),
{},
);
};
// ts-prune-ignore-next
export default defineConfig({
test: {
include: ['tests/**/*.test.ts'],
coverage: {
exclude: ['docs/**', 'tests/**', '.eslintrc.cjs'],
// Favor istanbul for coverage over v8 due to better accuracy.
provider: 'istanbul',
thresholds: {
...calculateFullCoverageThresholds(),
},
},
},
});