Approval-based snapshot testing library for Go (mirror)

refactor: styling improvements

+5 -5
__snapshots__/test_map.snap __snapshots__/test_map.snap.new
__snapshots__/test_snap_custom_type.snap __snapshots__/test_snap_custom_type.snap.new
__snapshots__/test_snap_multiple.snap __snapshots__/test_snap_multiple.snap.new
__snapshots__/test_snap_string.snap __snapshots__/test_snap_string.snap.new
+5 -4
internal/pretty/boxes.go
··· 26 26 width := TerminalWidth() 27 27 28 28 var sb strings.Builder 29 - sb.WriteString(strings.Repeat("─", width+2) + "\n") 30 - // TODO: "New Snapshot" should be above this line, in default color. 31 - // - color should be on test name and path 32 - sb.WriteString(fmt.Sprintf(" %s \n", Blue("New Snapshot -- \""+snap.Name+"\""))) 29 + sb.WriteString("─── " + "New Snapshot " + strings.Repeat("─", width-15) + "\n\n") 30 + sb.WriteString(fmt.Sprintf(" test: %s\n", Blue("\""+snap.Name+"\""))) 31 + sb.WriteString(fmt.Sprintf(" snapshot: %s\n\n", Gray(files.SnapshotFileName(snap.Name)))) 33 32 34 33 lines := strings.Split(snap.Content, "\n") 35 34 numLines := len(lines) ··· 59 58 // TODO: needs to get overhauled with styling like above 60 59 // - should show line numbers, line numbers with diffs should be the same 61 60 // - should show test name and path in the header section 61 + // TODO: additional styling 62 + // show helper text to say + is new results, - is old snapshot 62 63 func DiffSnapshotBox(old, new *files.Snapshot, diffLines []DiffLine) string { 63 64 width := TerminalWidth() 64 65
-1
utils.go
··· 1 - package freeze