reporter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Message  string `json:"message"`
	Expected any    `json:"expected,omitempty"`
	Actual   any    `json:"actual,omitempty"`
}

Error represents a structured error with optional expected/actual values for diffs

func NewDiffError

func NewDiffError(diff string, expected, actual any) *Error

NewDiffError creates an error with expected and actual values for diff display

func NewError

func NewError(msg string, args ...any) *Error

NewError creates a simple error with just a message

func (*Error) Error

func (e *Error) Error() string

type Info

type Info struct {
	Type      InfoType      `json:"type"`
	Title     string        `json:"title"`
	Content   string        `json:"content"`
	Args      []InfoArg     `json:"args,omitempty"`
	Timestamp time.Duration `json:"timestamp"`
	Language  string        `json:"language,omitempty"`
}

Info represents a piece of information about a test execution

type InfoArg

type InfoArg struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value"`
}

InfoArg represents a single argument with optional name

type InfoType

type InfoType string

InfoType represents the type of information being reported

const (
	// InfoTypeHelper is used when a helper function is called
	InfoTypeHelper InfoType = "helper"
	// InfoTypeRequest is used for HTTP/GraphQL requests
	InfoTypeRequest InfoType = "request"
	// InfoTypeResponse is used for HTTP/GraphQL responses
	InfoTypeResponse InfoType = "response"
	// InfoTypeQuery is used for SQL/GraphQL queries
	InfoTypeQuery InfoType = "query"
	// InfoTypeResult is used for query results
	InfoTypeResult InfoType = "result"
)

type Reporter

type Reporter interface {
	RunFile(ctx context.Context, filename string, fn func(Reporter))
	RunTest(ctx context.Context, runner, name string, fn func(Reporter))
	ReportError(err *Error)
	Info(info Info)
}

Jump to

Keyboard shortcuts

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