Documentation
¶
Overview ¶
Package delta handles run-over-run comparison for test results and coverage. A Snapshot captures the key metrics from one run; two snapshots produce a Delta which the HTML renderers use to display change badges.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatPctDelta ¶
FormatPctDelta returns a human-readable signed string like "+2.3%" or "-1.1%".
Types ¶
type CoverageSnap ¶
type CoverageSnap struct {
LinesPct float64 `json:"lines_pct"`
LinesCov int `json:"lines_covered"`
LinesTotal int `json:"lines_total"`
BranchPct float64 `json:"branch_pct"`
BranchCov int `json:"branch_covered"`
BranchTotal int `json:"branch_total"`
FuncPct float64 `json:"func_pct"`
FuncCov int `json:"func_covered"`
FuncTotal int `json:"func_total"`
// Files maps each file path to its line coverage percentage.
// Used to produce per-file deltas when comparing two snapshots.
Files map[string]float64 `json:"files,omitempty"`
}
CoverageSnap holds coverage metrics.
func FromCovReport ¶
func FromCovReport(rep *covmodel.CovReport) *CoverageSnap
FromCovReport builds a CoverageSnap from a parsed coverage report.
type Delta ¶
type Delta struct {
// Tests
TotalDelta int
PassedDelta int
FailedDelta int
SkippedDelta int
HasTests bool
// Coverage — overall
LinesPctDelta float64
BranchPctDelta float64
FuncPctDelta float64
HasCoverage bool
// Coverage — per-file line coverage deltas (path → Δ%).
// Only populated for files present in both baseline and current.
FileDeltas map[string]float64
}
Delta is the computed difference between a baseline and current snapshot.
type Snapshot ¶
type Snapshot struct {
Version int `json:"version"`
Timestamp string `json:"timestamp"`
Label string `json:"label,omitempty"`
Tests *TestSnap `json:"tests,omitempty"`
Coverage *CoverageSnap `json:"coverage,omitempty"`
}
Snapshot is the machine-readable summary of one run, saved to JSON. It can represent tests-only, coverage-only, or a combined run.
Click to show internal directories.
Click to hide internal directories.