pit

package module
v0.0.0-...-2014efb Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: MIT Imports: 13 Imported by: 0

README

pit

WIP: This is very much still a work in progress, it will probably break.

pit is a smartish wrapper around go test. It's end goal will be to only run tests for those files/packages that have changed, and the packages that depend on the changed files/packages.

pit in its current state will run all tests in a package via go test -v -cover only if there are changed files.

pit was just easy to type, but the current working backronym for pit is private investigator for tests

License

MIT

Documentation

Overview

Package pit ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Failure

type Failure struct {
	File    string `json:"filename"`
	Row     int    `json:"row"`
	Column  int    `json:"column"`
	Message string `json:"message"`
}

func (*Failure) String

func (f *Failure) String() string

type Package

type Package struct {
	Name        string
	Dir         string
	ImportPath  string
	SourceFiles []string
	TestFiles   []string
	// contains filtered or unexported fields
}

func FindPackages

func FindPackages(wd string) ([]*Package, error)

FindPackages returns a slice of Packages found in the passed directory.

func (*Package) Repository

func (p *Package) Repository() (*git.Repository, error)

Repository returns the git repository for the package

func (*Package) RunTests

func (p *Package) RunTests(config *TestConfig) (*PackageTestResult, error)

RunTests runs the packages test suite, checking if the package has tests and whether any files have been changed

type PackageTest

type PackageTest struct {
	Name     string        `json:"name"`
	Status   string        `json:"status"`
	Duration time.Duration `json:"duration"`
	Output   []string      `json:"ouput"`
}

type PackageTestResult

type PackageTestResult struct {
	Name     string         `json:"name"`
	Status   string         `json:"status"`
	Duration time.Duration  `json:"duration"`
	Coverage float32        `json:"coverage"`
	Summary  string         `json:"summary"`
	Tests    []*PackageTest `json:"tests"`
	Errors   []*Failure     `json:"errors"`
}

type TestConfig

type TestConfig struct {
	RunAll     bool
	CommitHash string
	Args       []string
}

TestConfig defines how a packages tests will be run

Directories

Path Synopsis
cmd
pit
internals
testparser
Package testparser provides a parser for go test output
Package testparser provides a parser for go test output

Jump to

Keyboard shortcuts

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