validation

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package validation provides test validation and execution functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MinCoverage   float64
	FailOnMissing bool
	ReportGaps    bool
}

Config contains validation configuration

type CoverageParser

type CoverageParser struct{}

CoverageParser parses coverage output from different test runners

func NewCoverageParser

func NewCoverageParser() *CoverageParser

NewCoverageParser creates a new coverage parser

func (*CoverageParser) ParseCargoCoverage

func (p *CoverageParser) ParseCargoCoverage(output string) float64

ParseCargoCoverage parses cargo-tarpaulin output Expected format: "85.50% coverage, 171/200 lines covered"

func (*CoverageParser) ParseCoverage

func (p *CoverageParser) ParseCoverage(output string, language string) float64

ParseCoverage auto-detects language and parses coverage

func (*CoverageParser) ParseGoCoverage

func (p *CoverageParser) ParseGoCoverage(output string) float64

ParseGoCoverage parses Go coverage output Expected format: "coverage: 80.5% of statements"

func (*CoverageParser) ParseJestCoverage

func (p *CoverageParser) ParseJestCoverage(output string) float64

ParseJestCoverage parses Jest coverage output Expected format: "All files | 85.5 | 80.2 | 90.1 | 85.5 |"

func (*CoverageParser) ParsePytestCoverage

func (p *CoverageParser) ParsePytestCoverage(output string) float64

ParsePytestCoverage parses pytest-cov output Expected format: "TOTAL ... 85%"

type Result

type Result struct {
	CoveragePercent   float64  `json:"coverage_percent"`
	FilesWithTests    int      `json:"files_with_tests"`
	FilesMissingTests []string `json:"files_missing_tests"`
	TestsPassed       int      `json:"tests_passed"`
	TestsFailed       int      `json:"tests_failed"`
	Errors            []string `json:"errors,omitempty"`
}

Result represents validation results

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator validates tests

func NewValidator

func NewValidator(config Config) *Validator

NewValidator creates a new validator

func (*Validator) Validate

func (v *Validator) Validate(path string, sourceFiles []*models.SourceFile) (*Result, error)

Validate validates tests for the given source files

Jump to

Keyboard shortcuts

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