@@ -18,12 +18,6 @@ Each cassette is a YAML file in `testdata/cassettes` that stores an array of
1818Of these, the tool only uses the ` request ` field, and the ` response ` field will
1919be automatically removed as part of running tool.
2020
21- The ` request ` in each interaction for a cassette is replayed and the response
22- body captured as a snapshot for the particular cassette using
23- [ ` go-snaps ` ] ( https://github.com/gkampitakis/go-snaps ) - subsequent runs will
24- compare the response body with the existing snapshot and show a diff of any
25- differences.
26-
2721## Usage
2822
2923As this tool uses packages intended for being used in tests, it must be run
@@ -33,8 +27,20 @@ using `go test`:
3327go test ./...
3428```
3529
36- You can regenerate snapshots by setting ` UPDATE_SNAPS=true ` when running tests:
30+ This replays each recorded ` request ` in ` testdata/cassettes ` and capture the
31+ response body as a snapshot using
32+ [ ` go-snaps ` ] ( https://github.com/gkampitakis/go-snaps ) ; subsequent runs will
33+ compare the response body with the existing snapshot and report any differences.
34+
35+ By default, any differences in existing snapshots will be considered a failure -
36+ you can have the snapshots updated instead by setting ` UPDATE_SNAPS=true ` :
3737
3838``` shell
3939UPDATE_SNAPS=true go test ./...
4040```
41+
42+ Before the test suite is actually run, the cassettes will be "cleaned" so that
43+
44+ - the ` body ` of each ` request ` will be formatted as a multi-line string, to make
45+ it easier to understand what the query parameters are
46+ - the ` response ` is property is not present, to reduce the size of each cassette
0 commit comments