getCoveragePercent
Computes the figure a badge shows.
A kind with nothing to cover counts as fully covered, as vitest’s own summary reports it. The figure is rounded DOWN to one decimal, so a project at 99.96% never shows 100%.
Import:
import { getCoveragePercent } from '@mnaoumov/obsidian-dev-toolkit/test-runners/coverage-badge';Signature:
function getCoveragePercent(totals: CoverageTotals, metric: CoverageBadgeMetric): numberParameters:
| Parameter | Type | Description |
|---|---|---|
totals |
CoverageTotals | The CoverageTotals. |
metric |
CoverageBadgeMetric | The CoverageBadgeMetric. |
Returns: number — The coverage figure, in percents.