Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Fix paths of snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Lecrenier committed Aug 10, 2022
1 parent d47ffe3 commit a95122d
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions milli/src/snapshot_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ pub fn default_db_snapshot_settings_for_test(name: Option<&str>) -> insta::Setti
let mut settings = insta::Settings::clone_current();
settings.set_prepend_module_to_snapshot(false);
let path = Path::new(std::panic::Location::caller().file());
let path = path.strip_prefix("milli/src").unwrap();
let filename = path.file_name().unwrap().to_str().unwrap();
settings.set_omit_expression(true);
let test_name = std::thread::current().name().unwrap().rsplit("::").next().unwrap().to_owned();

if let Some(name) = name {
settings.set_snapshot_path(Path::new("snapshots").join(path).join(test_name).join(name));
settings
.set_snapshot_path(Path::new("snapshots").join(filename).join(test_name).join(name));
} else {
settings.set_snapshot_path(Path::new("snapshots").join(path).join(test_name));
settings.set_snapshot_path(Path::new("snapshots").join(filename).join(test_name));
}

settings
Expand Down

0 comments on commit a95122d

Please sign in to comment.