Files
errors.bitreport.pt/ingest-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

36 lines
964 B
JSON

{
"name": "@bitreport/error-reporting-ingest-api",
"version": "0.1.0",
"private": true,
"type": "module",
"description": "Passive HTTP ingest for BitReport central error reporting (BIT-154.3)",
"scripts": {
"dev": "tsx watch src/server.ts",
"build": "tsc",
"start": "node dist/server.js",
"typecheck": "tsc --noEmit",
"test": "vitest run && python3 ../tools/ci/check_error_reporter_context_contract.py --path ../clients",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"@fastify/swagger": "^8.15.0",
"@fastify/swagger-ui": "^3.1.0",
"dotenv": "^16.4.5",
"fastify": "^4.28.1",
"mysql2": "^3.11.5",
"prom-client": "^15.1.3"
},
"devDependencies": {
"@types/node": "^22.9.0",
"ajv": "^8.18.0",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"@vitest/coverage-v8": "^2.1.0",
"vitest": "^2.1.0"
},
"engines": {
"node": ">=20"
}
}