-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3409342
commit 3da2f13
Showing
8 changed files
with
105 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ignore: | ||
- internal/colour |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
package snapshot | ||
|
||
// Option is a functional option for configuring snapshot tests. | ||
type Option func(*Shotter) | ||
type Option func(*SnapShotter) | ||
|
||
// Update is an [Option] that tells snapshot whether to automatically update the stored snapshots | ||
// with the new value from each test. Typically you'll want the value of this option to be set | ||
// from an environment variable or a test flag so that you can inspect the diffs prior to deciding | ||
// that the changes are expected, and therefore the snapshots should be updated. | ||
func Update(v bool) Option { | ||
return func(s *Shotter) { | ||
s.update = v | ||
// with the new value from each test. | ||
// | ||
// Typically, you'll want the value of this option to be set from an environment variable or a | ||
// test flag so that you can inspect the diffs prior to deciding that the changes are | ||
// expected, and therefore the snapshots should be updated. | ||
func Update(update bool) Option { | ||
return func(s *SnapShotter) { | ||
s.update = update | ||
} | ||
} | ||
|
||
// Clean is an [Option] that tells snapshot to erase the snapshots directory for the given test | ||
// before it runs. This is particularly useful if you've renamed or restructured your tests since | ||
// the snapshots were last generated to remove all unused snapshots. | ||
// | ||
// Typically, you'll want the value of this option to be set from an environment variable or a | ||
// test flag so that it only happens when explicitly requested, as like [Update], fresh snapshots | ||
// will always pass the tests. | ||
func Clean(clean bool) Option { | ||
return func(s *SnapShotter) { | ||
s.clean = clean | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters