json

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package json provides machine-readable JSON renderers for test and coverage reports, suitable for dashboards, scripts, and pipeline integrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderCov

func RenderCov(w io.Writer, rep *covmodel.CovReport) error

RenderCov writes a JSON coverage report to w.

func RenderTest

func RenderTest(w io.Writer, rep *model.Report) error

RenderTest writes a JSON test report to w.

Types

type CaseOutput

type CaseOutput struct {
	Name       string `json:"name"`
	Status     string `json:"status"`
	DurationMs int64  `json:"duration_ms"`
	Message    string `json:"message,omitempty"`
	File       string `json:"file,omitempty"`
	Line       int    `json:"line,omitempty"`
}

CaseOutput is the JSON representation of a single test case.

type CovOutput

type CovOutput struct {
	GeneratedAt string       `json:"generated_at"`
	Summary     CovSummary   `json:"summary"`
	Files       []FileOutput `json:"files"`
}

CovOutput is the JSON envelope for a coverage report.

type CovSummary

type CovSummary 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"`
	FileCount   int     `json:"file_count"`
}

CovSummary holds aggregate coverage statistics for a coverage report.

type FileOutput

type FileOutput struct {
	Path        string  `json:"path"`
	LinesPct    float64 `json:"lines_pct"`
	LinesCov    int     `json:"lines_covered"`
	LinesTotal  int     `json:"lines_total"`
	BranchPct   float64 `json:"branch_pct,omitempty"`
	BranchCov   int     `json:"branch_covered,omitempty"`
	BranchTotal int     `json:"branch_total,omitempty"`
	FuncPct     float64 `json:"func_pct,omitempty"`
	FuncCov     int     `json:"func_covered,omitempty"`
	FuncTotal   int     `json:"func_total,omitempty"`
}

FileOutput is the JSON representation of per-file coverage data.

type SuiteOutput

type SuiteOutput struct {
	Name  string       `json:"name"`
	Cases []CaseOutput `json:"cases"`
}

SuiteOutput is the JSON representation of a test suite.

type TestOutput

type TestOutput struct {
	GeneratedAt string        `json:"generated_at"`
	Summary     TestSummary   `json:"summary"`
	Suites      []SuiteOutput `json:"suites"`
}

TestOutput is the JSON envelope for a test report.

type TestSummary

type TestSummary struct {
	Total   int     `json:"total"`
	Passed  int     `json:"passed"`
	Failed  int     `json:"failed"`
	Skipped int     `json:"skipped"`
	PassPct float64 `json:"pass_pct"`
}

TestSummary holds aggregate counts for a test report.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL