-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Remove orphaned snapshots #64
base: main
Are you sure you want to change the base?
Conversation
let mut orphans = false; | ||
for entry in entries { | ||
let Ok(entry) = entry else { | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you remove the semicolon here (and on the other continue
s), rustfmt should collapse these to a single line, which I think looks a bit nicer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very neat
|
||
let file_name = file_name_str.to_owned(); | ||
if !names.contains(&file_name) { | ||
orphans = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there are orphaned snapshots, instead of always deleting the files and always failing, can you branch on should_write_snapshot()
and either delete the snapshots and succeed, or fail and leave the snapshots be?
remove_orphan_snapshots("tests/snaps/vine", &vine_tests); | ||
}); | ||
t.test("vine_fail", move || { | ||
remove_orphan_snapshots("tests/snaps/vine_fail", &vine_fail_tests); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you change this to fail/vine
? should make tab completing nicer
It's not very robust atm, so I'm thinking if there's a nice way to do it without pulling in a dependency like https://docs.rs/ignore/latest/ignore/ |
IMO it's fine for it to depend on the non-existence of other things in those directories |
This PR will now make any invocation of
cargo test
remove any snapshots with no corresponding test file.We have moved the
vine/fail
tests to its own foldervine_fail
Closes #49