Help us shape the future of Go! Take the 2026 Go Developer Survey

testdetect

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultGlobs = []string{
	"*_test.go",
	"test_*.py", "*_test.py", "tests/**", "conftest.py",
	"*.test.*", "*.spec.*", "__tests__/**",
	"src/test/**",
	"spec/**", "test/**",
	"__snapshots__/**", "*.snap",
}
View Source
var SnapshotGlobs = []string{"__snapshots__/**", "*.snap"}

Functions

func ExitCodeFromText

func ExitCodeFromText(s string) *int

func IsDocs

func IsDocs(file string) bool

func IsGenerated

func IsGenerated(file, content string) bool

func IsLockfile

func IsLockfile(file string) bool

func IsSnapshotFile

func IsSnapshotFile(file string) bool

func MasksExitCode

func MasksExitCode(command string) bool

func MatchGlob

func MatchGlob(pattern, file string) bool

func UpdatesSnapshots

func UpdatesSnapshots(command string) bool

Types

type Detector

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

func New

func New(extraGlobs, extraCommands []string) *Detector

func (*Detector) Detect

func (d *Detector) Detect(command string) (framework, segment string, ok bool)

Detect also returns the part of a compound command that runs the tests, for example "go test ./..." from "go vet ./... && go test ./...".

func (*Detector) Framework

func (d *Detector) Framework(command string) (string, bool)

func (*Detector) IsTestFile

func (d *Detector) IsTestFile(file string) bool

type ManifestKind

type ManifestKind int
const (
	NotManifest ManifestKind = iota
	Dependency
	CIConfig
	BuildConfig
)

func Classify

func Classify(file string) ManifestKind

type Summary

type Summary struct {
	Outcome                 string
	Passed, Failed, Skipped int
	Found                   bool
}

func Outcome

func Outcome(command string, exitCode *int, output string) Summary

Outcome never guesses "pass": a zero exit code counts only when the shell command cannot hide the exit code of the test command.

func ParseSummary

func ParseSummary(out string) Summary

Jump to

Keyboard shortcuts

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