fuzz

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fuzz is `gx fuzz` (REQ-AI-11): it runs the dev build of an app, asks it to render random prop sets of each component, and checks each render: no panic, the HTML parses to the tree that the render wrote, and axe finds no violation in headless Chrome. No node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TreeDefect

func TreeDefect(src string) string

TreeDefect compares the tree that the render wrote with the tree that the HTML parser makes of the same bytes (REQ-AI-11). It returns the first difference, or the empty string when the trees are the same.

Types

type Failure

type Failure struct {
	Component string `json:"component"`
	Package   string `json:"package"`
	Index     int    `json:"index"`
	// Kind is "panic", "tree" or "a11y".
	Kind    string `json:"kind"`
	Message string `json:"message"`
	// Name and Fixture are the entry for the fixtures file of the
	// component: `"<Name>": <Fixture>,`. Fixture is empty when Go source
	// cannot hold the prop set; Unprintable then says why.
	Name        string   `json:"name"`
	Fixture     string   `json:"fixture"`
	Imports     []string `json:"imports,omitempty"`
	Unprintable string   `json:"unprintable,omitempty"`
}

Failure is one prop set that fails a check.

type Options

type Options struct {
	// Dir is the app module root.
	Dir string
	// Main is the app main package; apprun.DetectMain finds it when empty.
	Main string
	// Component limits the run to the components of this name. It can
	// have the package name before a dot: "cart.Cart".
	Component string
	// Seed makes the prop sets. One seed gives the same sets each run.
	Seed uint64
	// Sets is the number of prop sets of each component.
	Sets int
}

Options select the run.

type Result

type Result struct {
	Seed       uint64 `json:"seed"`
	Components int    `json:"components"`
	// Sets is the number of prop sets that the run rendered.
	Sets     int             `json:"sets"`
	Skipped  []string        `json:"skipped"`
	Failures []Failure       `json:"failures"`
	Report   *propgen.Report `json:"-"`
}

Result is the outcome of one run.

func Run

func Run(ctx context.Context, opt Options) (*Result, error)

Run does one run. The error is for a run that cannot start or finish: the app does not build, or Chrome does not start. A failing prop set is in the result.

func (*Result) Print

func (r *Result) Print(w io.Writer)

Print writes the result for a person: each failing prop set as a fixture, then one summary line with the seed.

Jump to

Keyboard shortcuts

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