- Add support for Frigate reviews / detections. - Add support for GenAI metadata. - Significant internal refactor to more flexible "UnifiedQuery" to allow mixing cameras with simple metadata and review metadata (e.g. a timeline view of a Frigate camera with reviews, and a Reolink camera with simple metadata). - Add support for folder media as camera media. There are a few more PRs to commit prior to this going live, but commiting this for now due to the scale of the change. BREAKING CHANGE: `media_type` and `events_type` are retired under `live`, `viewer` and `timeline` configuration sections, instead media type is associated (once) with the camera under `media`.
72 lines
1.7 KiB
TypeScript
72 lines
1.7 KiB
TypeScript
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/frigate/watcher.ts',
|
|
'camera-manager/generic/*.ts',
|
|
'camera-manager/reolink/*.ts',
|
|
'camera-manager/utils/**/*.ts',
|
|
'card-controller/**/*.ts',
|
|
'components-lib/**/!(controller).ts',
|
|
'components-lib/!(timeline)/**/controller.ts',
|
|
'conditions/**/*.ts',
|
|
'config/**/*.ts',
|
|
'const.ts',
|
|
'ha/**/*.ts',
|
|
'types.ts',
|
|
'utils/**/*.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: {
|
|
server: {
|
|
deps: {
|
|
// These dependencies import without extensions.
|
|
// Related: https://github.com/vitest-dev/vitest/issues/2313
|
|
inline: ['ha-nunjucks', 'ts-py-datetime'],
|
|
},
|
|
},
|
|
include: ['tests/**/*.test.ts'],
|
|
coverage: {
|
|
exclude: ['docs/**', 'tests/**', '.eslintrc.cjs'],
|
|
|
|
// Favor istanbul for coverage over v8 due to better accuracy.
|
|
provider: 'istanbul',
|
|
thresholds: {
|
|
...calculateFullCoverageThresholds(),
|
|
},
|
|
},
|
|
},
|
|
});
|