Files
errors.bitreport.pt/api/package.json
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

39 lines
1.0 KiB
JSON

{
"name": "@errors-bitreport/api",
"version": "0.1.0",
"description": "BitReport Error Reporting Platform — Fastify API",
"type": "module",
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc",
"start": "node dist/index.js",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"db:migrate": "bash ../scripts/run-mysql-migrations.sh"
},
"dependencies": {
"@fastify/cookie": "^9.3.1",
"@fastify/helmet": "^11.1.1",
"@fastify/jwt": "^8.0.1",
"@fastify/rate-limit": "^9.1.0",
"@fastify/swagger": "^8.14.0",
"@fastify/swagger-ui": "^3.0.0",
"bcrypt": "^5.1.1",
"fastify": "^4.28.1",
"mysql2": "^3.11.5",
"pino": "^9.1.0",
"prom-client": "^15.1.3",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/bcrypt": "^5.0.2",
"@types/node": "^20.14.0",
"tsx": "^4.15.6",
"typescript": "^5.4.5",
"@vitest/coverage-v8": "^1.6.0",
"vitest": "^1.6.0"
}
}