Skip to content

Commit ff4ea44

Browse files
committed
docs: document labeling support
1 parent cbbd84d commit ff4ea44

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ Every subsequent test run will compare the actual value against the inline snaps
325325
- `Width`: The maximum width in characters before wrapping json output (default: 80)
326326
- `Indent`: The indentation string to use for nested structures (default: 1 spaces)
327327
- `SortKeys`: Whether to sort json object keys alphabetically (default: true)
328+
- a label to add to the end of snapshot ids, to help when reviewing `snaps.Label("stdout")`
328329
- a custom serializer function for non-structured snapshots `snaps.Serializer(func(any) string {...})`
329330
- a helper serializer function `snaps.Raw()` that uses `fmt.Sprint` to serialize the value as is without any formatting or indentation.
330331

@@ -336,6 +337,7 @@ t.Run("snapshot tests", func(t *testing.T) {
336337
snaps.Dir("my_dir"),
337338
snaps.Filename("json_file"),
338339
snaps.Ext(".json"),
340+
snaps.Label("JSON"),
339341
snaps.Update(false),
340342
snaps.Serializer(func(v any) string {
341343
// custom serializer logic

0 commit comments

Comments
 (0)