Files
errors.bitreport.pt/collector-worker/vitest.config.ts
T
David Santos 989a92ba07 BIT-15744: add unit tests and coverage config for api, ingest-api, collector-worker
Add 68 new unit tests covering:
- api/src/types/auth.ts: can() RBAC function and ROLE_PERMISSIONS matrix (10 tests)
- ingest-api/src/lib/hash.ts: sha256Hex() and stableJsonHash() pure functions (12 tests)
- ingest-api/src/config/env.ts: loadEnv() with defaults, validation, clamping (8 tests)
- collector-worker/src/config/loadEnv.ts: loadEnv() with all opts (11 tests)
- collector-worker/src/log/structuredLog.ts: logInfo/logWarn/logError output (11 tests)
- collector-worker/src/poll/fetchHttpEvents.ts: full validation/error path coverage (16 tests)

Also add coverage reporting to vitest.config.ts (v8 provider, text/json/html reporters)
and @vitest/coverage-v8 to devDependencies + test:coverage script in each service.

All 68 tests pass. Run npm install && npm run test:coverage in each service directory.

Paperclip-Issue: BIT-15744
Paperclip-Run: 2ff0b69d-853a-46fe-add7-43aa07012016
2026-04-29 04:44:48 +00:00

15 lines
325 B
TypeScript

import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
environment: "node",
include: ["src/**/*.test.ts"],
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
include: ["src/**/*.ts"],
exclude: ["src/**/*.test.ts", "**/*.d.ts"],
},
},
});