gocover

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeneralErrorExitCode        = 1  // bash general error exit code
	UnitTestFailedErrorExitCode = 11 // unit test failed exit code
	LowCoverageErrorExitCode    = 12 // pass rate is lower than the coverage baseline exit code
)
View Source
const (
	DefaultReportFormat     = "html"
	DefaultCompareBranch    = "origin/master"
	DefaultCoverageBaseline = 80.0
)
View Source
const (
	FullCoverage CoverageMode = "full"
	DiffCoverage CoverageMode = "diff"

	GoExecutor     ExecutorMode = "go"
	GinkgoExecutor ExecutorMode = "ginkgo"
)

Variables

View Source
var (
	ErrModuleNotFound = errors.New("cannot find module path")
)
View Source
var ErrUnknownCoverageMode = errors.New("unknown coverage mode")
View Source
var ErrUnknownExecutorMode = errors.New("unknown executor mode")

Functions

This section is empty.

Types

type CoverageMode

type CoverageMode string

type DiffOption

type DiffOption struct {
	CoverProfiles  []string
	CompareBranch  string
	RepositoryPath string
	ModuleDir      string
	ModulePath     string

	CoverageBaseline float64
	ReportFormat     string
	ReportName       string
	OutputDir        string
	Excludes         []string
	Style            string

	DbOption *dbclient.DBOption

	Logger logrus.FieldLogger
}

DiffOption contains the input to the gocover diff command.

func NewDiffOption

func NewDiffOption() *DiffOption

NewDiffOptions returns a Options with default values.

func (*DiffOption) Validate

func (o *DiffOption) Validate() error

type ExecutorMode added in v1.0.1

type ExecutorMode string

type FullOption

type FullOption struct {
	CoverProfiles  []string
	RepositoryPath string
	ModuleDir      string

	CoverageBaseline float64
	ReportFormat     string
	ReportName       string
	OutputDir        string
	Excludes         []string
	Style            string

	DbOption *dbclient.DBOption

	Logger logrus.FieldLogger
}

FullOption contains the input for gocover full command.

func NewFullOption

func NewFullOption() *FullOption

NewDiffOption returns a Full Option with default values.

func (*FullOption) Validate

func (o *FullOption) Validate() error

type GoCover

type GoCover interface {
	Run(ctx context.Context) error
}

GoCover interface to generate coverage result.

func NewDiffCover

func NewDiffCover(o *DiffOption) (GoCover, error)

func NewFullCover

func NewFullCover(o *FullOption) (GoCover, error)

type GoCoverError added in v1.0.1

type GoCoverError struct {
	ExitCode   int
	Err        error
	ErrMessage string
}

GoCoverError carries the detail error information for gocover error

func WrapError added in v1.0.1

func WrapError(err error, errMessage string) *GoCoverError

func WrapErrorWithCode added in v1.0.1

func WrapErrorWithCode(err error, exitCode int, errMessage string) *GoCoverError

func (*GoCoverError) Error added in v1.0.1

func (e *GoCoverError) Error() string

type GoCoverTestExecutor added in v1.0.1

type GoCoverTestExecutor interface {
	Run(ctx context.Context) error
}

func NewGoCoverTestExecutor added in v1.0.1

func NewGoCoverTestExecutor(o *GoCoverTestOption) (GoCoverTestExecutor, error)

type GoCoverTestOption

type GoCoverTestOption struct {
	CoverProfiles  []string
	CompareBranch  string
	RepositoryPath string
	ModuleDir      string
	ModulePath     string
	CoverageMode   CoverageMode
	ExecutorMode   ExecutorMode
	GinkgoFlags    []string
	GoFlags        []string

	CoverageBaseline float64
	ReportFormat     string
	ReportName       string
	OutputDir        string
	Excludes         []string
	Style            string

	DbOption *dbclient.DBOption

	StdOut io.Writer
	StdErr io.Writer
	Logger logrus.FieldLogger
}

GoCoverTestOption contains the input to the gocover govtest command.

func NewGoCoverTestOption

func NewGoCoverTestOption() *GoCoverTestOption

NewGoCoverTestOption returns a Options with default values.

Jump to

Keyboard shortcuts

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