testing/error_coverage.ts view source
(collector: ErrorCoverageCollector, route_specs: RouteSpec[], options?: ErrorCoverageOptions | undefined): void Assert error coverage meets a minimum threshold.
Computes the ratio of exercised error paths to total declared error paths.
For routes whose status error schema names specific codes (z.literal or
z.enum), each declared code counts as one coverage path; for schemas
without declared codes (ApiError/z.string()), the status counts as one
path. A status-only observation covers all declared codes for that status
(the "any-code" rule).
When min_coverage is 0 (default), logs coverage info without failing.
When > 0, fails if coverage is below the threshold.
collector
route_specs
RouteSpec[]options?
ErrorCoverageOptions | undefinedreturns
void throws
AssertionError- if `min_coverage > 0` and the covered/total ratio