testreport

package
v0.4.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package testreport turns go test's JSON event stream into a durable timing report.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Action  string  `json:"Action"`
	Package string  `json:"Package"`
	Test    string  `json:"Test"`
	Elapsed float64 `json:"Elapsed"`
	Output  string  `json:"Output"`
}

type Package

type Package struct {
	Name    string  `json:"name"`
	Action  string  `json:"action"`
	Seconds float64 `json:"seconds"`
	Cached  bool    `json:"cached,omitempty"`
}

type Report

type Report struct {
	Schema          int       `json:"schema"`
	GeneratedAt     time.Time `json:"generated_at"`
	Events          int       `json:"events"`
	TestsPassed     int       `json:"tests_passed"`
	TestsFailed     int       `json:"tests_failed"`
	TestsSkipped    int       `json:"tests_skipped"`
	PackageFailures int       `json:"package_failures"`
	Incomplete      []string  `json:"incomplete_packages,omitempty"`
	Truncated       bool      `json:"truncated,omitempty"`
	Packages        []Package `json:"packages"`
	Tests           []Test    `json:"tests"`
}

func Read

func Read(r io.Reader, progress io.Writer, now time.Time) (Report, error)

Read consumes exactly one JSON object per line. It rejects empty and malformed streams because a timing artifact that silently omitted a compiler failure is worse than no artifact.

type Test

type Test struct {
	Package string  `json:"package"`
	Name    string  `json:"name"`
	Action  string  `json:"action"`
	Seconds float64 `json:"seconds"`
}

Jump to

Keyboard shortcuts

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