package imagetesting

import "github.com/gohugoio/hugo/resources/images/imagetesting"

Index

Variables

var DefaultGoldenOpts = GoldenImageTestOpts{
	WriteFiles: false,
	DevMode:    false,
}

To rebuild all Golden image tests, toggle WriteFiles=true and run: GOARCH=amd64 go test -count 1 -timeout 30s -run "^TestImagesGolden" ./... TODO(bep) see if we can do this via flags.

var SkipGoldenTests = runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" || runtime.GOARCH == "s390x"

We don't have a CI test environment for these, and there are known dithering issues that makes these time consuming to maintain.

var UsesFMA = runtime.GOARCH == "s390x" ||
	runtime.GOARCH == "ppc64" ||
	runtime.GOARCH == "ppc64le" ||
	runtime.GOARCH == "arm64" ||
	runtime.GOARCH == "riscv64"

UsesFMA indicates whether "fused multiply and add" (FMA) instruction is used. The command "grep FMADD go/test/codegen/floats.go" can help keep the FMA-using architecture list updated.

Functions

func RunGolden

Types

type GoldenImageTestOpts

type GoldenImageTestOpts struct {
	// The test.
	T testing.TB

	// Name of the test. Will be used as the base folder for generated images.
	// Slashes allowed and encouraged.
	Name string

	// The test site's files in txttar format.
	Files string

	// Set to true to write golden files to disk.
	WriteFiles bool

	// If not set, a temporary directory will be created.
	WorkingDir string

	// Set to true to skip any assertions. Useful when adding new golden variants to a test.
	DevMode bool

	// Set to skip any assertions.
	SkipAssertions bool

	// Whether this represents a rebuild of the same site.
	// Setting this to true will keep the previous golden image set.
	Rebuild bool
}

GoldenImageTestOpts provides options for a golden image test.

Source Files

testing.go

Version
v0.144.2 (latest)
Published
Feb 19, 2025
Platform
linux/amd64
Imports
16 packages
Last checked
13 hours ago

Tools for package owners.