-
Notifications
You must be signed in to change notification settings - Fork 1k
ur‐Coverage Plan
🇵🇰 اردو | 🇺🇸 English | Language Hub
🌐 Languages: 🇺🇸 English · 🇸🇦 ar · 🇧🇬 bg · 🇧🇩 bn · 🇨🇿 cs · 🇩🇰 da · 🇩🇪 de · 🇪🇸 es · 🇮🇷 fa · 🇫🇮 fi · 🇫🇷 fr · 🇮🇳 gu · 🇮🇱 he · 🇮🇳 hi · 🇭🇺 hu · 🇮🇩 id · 🇮🇹 it · 🇯🇵 ja · 🇰🇷 ko · 🇮🇳 mr · 🇲🇾 ms · 🇳🇱 nl · 🇳🇴 no · 🇵🇭 phi · 🇵🇱 pl · 🇵🇹 pt · 🇧🇷 pt-BR · 🇷🇴 ro · 🇷🇺 ru · 🇸🇰 sk · 🇸🇪 sv · 🇰🇪 sw · 🇮🇳 ta · 🇮🇳 te · 🇹🇭 th · 🇹🇷 tr · 🇺🇦 uk-UA · 🇵🇰 ur · 🇻🇳 vi · 🇨🇳 zh-CN
Last updated: 2026-03-28
There are multiple coverage numbers depending on how the report is computed. For planning, only one of them is useful.
| Metric | Scope | Statements / Lines | Branches | Functions | Notes |
|---|---|---|---|---|---|
| Legacy | Old npm run test:coverage
|
79.42% | 75.15% | 67.94% | Inflated: counts test files and excludes open-sse
|
| Diagnostic | Source-only, excluding tests and excluding open-sse
|
68.16% | 63.55% | 64.06% | Useful only to isolate src/**
|
| Recommended baseline | Source-only, excluding tests and including open-sse
|
56.95% | 66.05% | 57.80% | This is the project-wide baseline to improve |
The recommended baseline is the number to optimize against.
- Coverage targets apply to source files, not to
tests/**. -
open-sse/**is part of the product and must remain in scope. - New code should not reduce coverage in touched areas.
- Prefer testing behavior and branch outcomes over implementation details.
- Prefer temp SQLite databases and small fixtures over broad mocks for
src/lib/db/**.
-
npm run test:coverage- Main source coverage gate for the unit test suite
- Generates
text-summary,html,json-summary, andlcov
-
npm run coverage:report- Detailed file-by-file report from the latest run
-
npm run test:coverage:legacy- Historical comparison only
| Phase | Target | Focus |
|---|---|---|
| Phase 1 | 60% statements / lines | Quick wins and low-risk utility coverage |
| Phase 2 | 65% statements / lines | DB and route foundations |
| Phase 3 | 70% statements / lines | Provider validation and usage analytics |
| Phase 4 | 75% statements / lines |
open-sse translators and helpers |
| Phase 5 | 80% statements / lines |
open-sse handlers and executor branches |
| Phase 6 | 85% statements / lines | Harder edge cases, branch debt, regression suites |
| Phase 7 | 90% statements / lines | Final sweep, gap closure, strict ratchet |
Branches and functions should ratchet upward with each phase, but the primary hard target is statements / lines.
These files or areas offer the best return for the next phases:
-
open-sse/handlers-
chatCore.tsat 7.57% - Overall directory at 29.07%
-
-
open-sse/translator/request- Overall directory at 36.39%
- Many translators are still near single-digit coverage
-
open-sse/translator/response- Overall directory at 8.07%
-
open-sse/executors- Overall directory at 36.62%
-
src/lib/db-
models.tsat 20.66% -
registeredKeys.tsat 34.46% -
modelComboMappings.tsat 36.25% -
settings.tsat 46.40% -
webhooks.tsat 33.33%
-
-
src/lib/usage-
usageHistory.tsat 21.12% -
usageStats.tsat 9.56% -
costCalculator.tsat 30.00%
-
-
src/lib/providers-
validation.tsat 41.16%
-
- Low-risk utility and API files for early gains
src/shared/utils/upstreamError.tssrc/shared/utils/apiAuth.tssrc/lib/api/errorResponse.tssrc/app/api/settings/require-login/route.tssrc/app/api/providers/[id]/models/route.ts
- Fix coverage metric so it reflects source code instead of test files
- Keep a legacy coverage script for comparison
- Record the baseline and hotspots in-repo
- Add focused tests for low-risk utilities:
src/shared/utils/upstreamError.tssrc/shared/utils/fetchTimeout.tssrc/lib/api/errorResponse.tssrc/shared/utils/apiAuth.tssrc/lib/display/names.ts
- Add route tests for:
src/app/api/settings/require-login/route.tssrc/app/api/providers/[id]/models/route.ts
- Add DB-backed tests for:
src/lib/db/modelComboMappings.tssrc/lib/db/settings.tssrc/lib/db/registeredKeys.ts
- Cover branch behavior in:
src/lib/providers/validation.tssrc/app/api/v1/embeddings/route.tssrc/app/api/v1/moderations/route.ts
- Add usage analytics tests for:
src/lib/usage/usageHistory.tssrc/lib/usage/usageStats.tssrc/lib/usage/costCalculator.ts
- Expand route coverage for proxy management and settings branches
- Cover translator helpers and central translation paths:
open-sse/translator/index.tsopen-sse/translator/helpers/*open-sse/translator/request/*open-sse/translator/response/*
- Add handler-level tests for:
open-sse/handlers/chatCore.tsopen-sse/handlers/responsesHandler.jsopen-sse/handlers/imageGeneration.jsopen-sse/handlers/embeddings.js
- Add executor branch coverage for provider-specific auth, retries, and endpoint overrides
- Merge more edge-case suites into the main coverage path
- Increase function coverage for DB modules with weak constructor/helper coverage
- Close branch gaps in
settings.ts,registeredKeys.ts,validation.ts, and translator helpers
- Treat the remaining low-coverage files as blockers
- Add regression tests for every uncovered production bug fixed during the push to 90%
- Raise the coverage gate in CI only after the local baseline is stable for at least two consecutive runs
Update npm run test:coverage thresholds only after the project actually exceeds the next milestone with a comfortable buffer.
Recommended ratchet sequence:
- 55/60/55
- 60/62/58
- 65/64/62
- 70/66/66
- 75/70/72
- 80/75/78
- 85/80/84
- 90/85/88
Order is statements-lines / branches / functions.
The current coverage command measures the main Node unit suite and includes source reached from it, including open-sse. It does not yet merge Vitest coverage into a single unified report. That merge is worth doing later, but it is not a blocker for starting the 60% -> 80% climb.
OmniRoute · Website · npm · Docker Hub
- Setup Guide
- User Guide
- Features
- Quick Start (Docker)
- Electron Desktop App
- Termux (Android)
- PWA Guide
- MCP Server
- A2A Server
- Agent Protocols
- OpenCode Plugin
- Webhooks
- Cloud Agents
- Skills
- Memory
- Evals
- Gamification
- Guardrails
- Compliance
- Error Sanitization
- Public Credentials
- Route Guard Tiers
- Stealth Guide
- CLI Token Auth