Skip to content

Commit 2975f2a

Browse files
authored
chore: ignore almost-empty directories in nargo_cli tests (#6611)
1 parent 9a74dfa commit 2975f2a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tooling/nargo_cli/build.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,22 @@ fn read_test_cases(
8686
let test_case_dirs =
8787
fs::read_dir(test_data_dir).unwrap().flatten().filter(|c| c.path().is_dir());
8888

89-
test_case_dirs.into_iter().map(|dir| {
89+
test_case_dirs.into_iter().filter_map(|dir| {
90+
// When switching git branches we might end up with non-empty directories that have a `target`
91+
// directory inside them but no `Nargo.toml`.
92+
// These "tests" would always fail, but it's okay to ignore them so we do that here.
93+
if !dir.path().join("Nargo.toml").exists() {
94+
return None;
95+
}
96+
9097
let test_name =
9198
dir.file_name().into_string().expect("Directory can't be converted to string");
9299
if test_name.contains('-') {
93100
panic!(
94101
"Invalid test directory: {test_name}. Cannot include `-`, please convert to `_`"
95102
);
96103
}
97-
(test_name, dir.path())
104+
Some((test_name, dir.path()))
98105
})
99106
}
100107

0 commit comments

Comments
 (0)