mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-25 06:00:08 +01:00
Fix paths of snapshot tests
This commit is contained in:
parent
4b7fd4dfae
commit
12920f2a4f
@ -17,14 +17,15 @@ pub fn default_db_snapshot_settings_for_test(name: Option<&str>) -> insta::Setti
|
|||||||
let mut settings = insta::Settings::clone_current();
|
let mut settings = insta::Settings::clone_current();
|
||||||
settings.set_prepend_module_to_snapshot(false);
|
settings.set_prepend_module_to_snapshot(false);
|
||||||
let path = Path::new(std::panic::Location::caller().file());
|
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);
|
settings.set_omit_expression(true);
|
||||||
let test_name = std::thread::current().name().unwrap().rsplit("::").next().unwrap().to_owned();
|
let test_name = std::thread::current().name().unwrap().rsplit("::").next().unwrap().to_owned();
|
||||||
|
|
||||||
if let Some(name) = name {
|
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 {
|
} 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
|
settings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user