Documentation ¶
Index ¶
- type Option
- func WithCovermode(val string) Option
- func WithGoBinPath(goBinPath string) Option
- func WithLogger(logger *log.Logger) Option
- func WithRaceDetection(enabled bool) Option
- func WithRunnerFunc(rf command.Runner) Option
- func WithShort(enabled bool) Option
- func WithShuffle(val string) Option
- func WithTimeout(dur time.Duration) Option
- func WithUUIDFunc(uf UUIDFunc) Option
- type Package
- type Result
- type Runner
- type Test
- type UUIDFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Runner)
Option configures a Runner.
func WithCovermode ¶
WithCovermode configures Runner to run tests with `-covermode` flag.
func WithGoBinPath ¶
WithGoBinPath configures Runner to use path as go binary for running tests.
By default, `go` is used.
func WithLogger ¶
WithLogger configures Runner with a logger.
func WithRaceDetection ¶
WithRaceDetection configures Runner to run tests with `-race` flag.
Note: Enabling race detection will force the covermode to be `atomic`.
func WithRunnerFunc ¶
WithRunnerFunc configures Runner to use function for running commands.
By default, commands are run with the `os/exec` package, but the runner function can be replaced for testing purposes.
func WithShuffle ¶
WithShuffle configures Runner to run tests with `-shuffle` flag.
func WithTimeout ¶
WithTimeout configures Runner to use duration for test run timeout.
func WithUUIDFunc ¶
WithUUIDFunc configures Runner to use function for UUID generation.
By default, nanoid.New is used for UUID generation, but function can be replaced for testing purposes.
type Package ¶
type Package struct { Time time.Time `json:"time"` Name string `json:"name"` Pass bool `json:"pass"` Passed int `json:"passed"` Skipped int `json:"skipped"` Failed int `json:"failed"` Coverage float64 `json:"coverage"` Elapsed float64 `json:"elapsed"` Tests []*Test `json:"tests"` // contains filtered or unexported fields }
Package is the result of tests in a single package.
type Result ¶
type Result struct { UUID string `json:"uuid"` Error string `json:"error"` Pass bool `json:"pass"` Start time.Time `json:"start"` Duration time.Duration `json:"duration"` ExitCode int `json:"exitCode"` Output []byte `json:"output"` Targets []string `json:"targets"` Passed int `json:"passed"` Failed int `json:"failed"` Skipped int `json:"skipped"` Tests int `json:"tests"` Packages []*Package `json:"packages"` // contains filtered or unexported fields }
Result of a `go test` run.
func (Result) Dir ¶
Dir containing files relevant for the test result.
Directory contains `coverprofile.out` generated by Runner.Run as well as `report.json` which is a code coverage report generated by [coverparser.Parser].
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner runs tests and parses the results.