Documentation ¶
Overview ¶
Package snapshot provides basic methods for snapshot testing Snapshot tests may be useful for regression testing or unit testing (with proper review) This package doesn't aim to be anything more than a simple utility to be used in conjunction with golang's own testing package, or any other testing framework which is also compatible with `go test` Snapshots are auto-generated and managed by this package:
Index ¶
Constants ¶
View Source
const ( // SnapshotDir is where snapshots are stored SnapshotDir string = "__snapshots__" // SnapshotExtension is the extension for snapshot files SnapshotExtension string = ".snap.xml" // Indent - 4 spaces Indent string = " " )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comparison ¶
type Comparison interface { // Matches runs a comparison with the saved snapshot // overwrites the saved snapshot if CLI flag "-u" is passed to `go test` Matches(v interface{}) error }
Comparison compares snapshots
func WithLabel ¶
func WithLabel(label string) Comparison
WithLabel reads the existing snapshot and allows comparison
Click to show internal directories.
Click to hide internal directories.