Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cobbinma/bromide
A snapshot testing library for go 📸
https://github.com/cobbinma/bromide
go golang snapshot snapshot-testing testing testing-tools
Last synced: 27 days ago
JSON representation
A snapshot testing library for go 📸
- Host: GitHub
- URL: https://github.com/cobbinma/bromide
- Owner: cobbinma
- License: mit
- Created: 2024-02-16T09:32:58.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-02-23T12:31:13.000Z (9 months ago)
- Last Synced: 2024-06-21T15:20:13.257Z (5 months ago)
- Topics: go, golang, snapshot, snapshot-testing, testing, testing-tools
- Language: Go
- Homepage:
- Size: 112 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
bromide
A snapshot testing library for go 📸
## Introduction
Bromide is a snapshot library for Go, designed to simplify managing snapshot tests.
With Bromide, you can easily capture test output and then review any differences against expected values.
## Usage
### Write
```sh
go get github.com/cobbinma/bromide
``````go
import github.com/cobbinma/bromidefunc TestSomething(t *testing.T) {
text := "world"
something := testStruct{
example: &text,
again: 5,
}
bromide.Snapshot(t, something)
}
``````
--- FAIL: TestSomething (0.00s)
bromide_test.go:24: snapshot mismatch
bromide_test.go:24:
--- current
+++ incoming
@@ -1,4 +1,4 @@
(bromide_test.testStruct) {
- example: (*string)((len=5) "hello"),
+ example: (*string)((len=5) "world"),
again: (int) 5
}bromide_test.go:24: to update snapshot run `bromide`
FAIL
FAIL github.com/cobbinma/bromide 0.211s
FAIL
```### Review
```sh
go install github.com/cobbinma/bromide/cmd/[email protected]
```![screenshot](./assets/Screenshot.png)
## See Also
* [cupaloy](https://github.com/bradleyjkemp/cupaloy)
## Thanks
* [cupaloy](https://github.com/bradleyjkemp/cupaloy)
* [insta](https://github.com/mitsuhiko/insta)
* [birdie](https://github.com/giacomocavalieri/birdie)