app

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(option Options) (int, error)

Types

type Options

type Options struct {
	// Output is used to write the final output, such as the tables, summary, etc.
	Output io.Writer
	// DisableColor will disable all colors.
	DisableColor bool
	// Format will set the output format for tables.
	Format OutputFormat
	// Sorter will set the sort order for the table.
	Sorter parse.PackageSorter
	// ShowNoTests will display packages containing no test files or empty test files.
	ShowNoTests bool
	// FileName will read test output from a file.
	FileName string

	// Test table options
	TestTableOptions    TestTableOptions
	SummaryTableOptions SummaryTableOptions

	// FollowOutput will follow the raw output as go test is running.
	FollowOutput        bool           // Output to stdout
	FollowOutputWriter  io.WriteCloser // Output to a file, takes precedence over FollowOutput
	FollowOutputVerbose bool

	// Progress will print a single summary line for each package once the package has completed.
	// Useful for long running test suites. Maybe used with FollowOutput or on its own.
	//
	// This will output to stdout.
	Progress       bool
	ProgressOutput io.Writer

	// DisableTableOutput will disable all table output. This is used for testing.
	DisableTableOutput bool

	// Compare includes a diff of a previous test output file in the summary table.
	Compare string
}

type OutputFormat

type OutputFormat int
const (
	// OutputFormatBasic is a normal table without a border
	OutputFormatPlain OutputFormat = iota + 1
	// OutputFormatBasic is a normal table with border
	OutputFormatBasic
	// OutputFormatBasic is a markdown-rendered table
	OutputFormatMarkdown
)

type SummaryTableOptions added in v0.12.0

type SummaryTableOptions struct {
	// For narrow screens, remove common prefix and trim long package names vertically. Example:
	// github.com/mfridman/tparse/app
	// github.com/mfridman/tparse/internal/seed-up-down-to-zero
	//
	// tparse/app
	// tparse
	//  /seed-up-down-to-zero
	Trim bool

	// TrimPath is the path prefix to trim from the package name.
	TrimPath string
}

type TestTableOptions

type TestTableOptions struct {
	// Display passed or skipped tests. If both are true this is equivalent to all.
	Pass, Skip bool
	// For narrow screens, trim long test identifiers vertically. Example:
	// TestNoVersioning/seed-up-down-to-zero
	//
	// TestNoVersioning
	//  /seed-up-down-to-zero
	Trim bool

	// TrimPath is the path prefix to trim from the package name.
	TrimPath string

	// Display up to N slow tests for each package, tests are sorted by
	// calculated the elapsed time for the given test.
	Slow int
}

Jump to

Keyboard shortcuts

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