Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@
// and use that in the call to MkDirAll
dir := filepath.Dir(path)

// If clean is set, erase the snapshot directory and then carry on
// If clean is set, erase the entire snapshot directory then carry on,
// re-populating it with the fresh snaps
if s.clean {
if err := os.RemoveAll(dir); err != nil {
s.tb.Fatalf("failed to delete %s: %v", dir, err)

toRemove := filepath.Join("testdata", "snapshots")
if err := os.RemoveAll(toRemove); err != nil {
s.tb.Fatalf("failed to delete %s: %v", toRemove, err)

Check warning on line 83 in snapshot.go

View check run for this annotation

Codecov / codecov/patch

snapshot.go#L81-L83

Added lines #L81 - L83 were not covered by tests
return
}
}
Expand All @@ -91,7 +92,6 @@
content, err := val.Snap()
if err != nil {
s.tb.Fatalf("%T implements Snapper but Snap() returned an error: %v", val, err)

return
}

Expand All @@ -101,7 +101,6 @@
content, err := json.MarshalIndent(val, "", " ")
if err != nil {
s.tb.Fatalf("%T implements json.Marshaler but MarshalJSON() returned an error: %v", val, err)

return
}

Expand All @@ -110,7 +109,6 @@
content, err := val.MarshalText()
if err != nil {
s.tb.Fatalf("%T implements encoding.TextMarshaler but MarshalText() returned an error: %v", val, err)

return
}

Expand Down
Loading