Skip to content

Commit

Permalink
chore: ignore almost-empty directories in nargo_cli tests (#6611)
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite authored Nov 25, 2024
1 parent 9a74dfa commit 2975f2a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tooling/nargo_cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,22 @@ fn read_test_cases(
let test_case_dirs =
fs::read_dir(test_data_dir).unwrap().flatten().filter(|c| c.path().is_dir());

test_case_dirs.into_iter().map(|dir| {
test_case_dirs.into_iter().filter_map(|dir| {
// When switching git branches we might end up with non-empty directories that have a `target`
// directory inside them but no `Nargo.toml`.
// These "tests" would always fail, but it's okay to ignore them so we do that here.
if !dir.path().join("Nargo.toml").exists() {
return None;
}

let test_name =
dir.file_name().into_string().expect("Directory can't be converted to string");
if test_name.contains('-') {
panic!(
"Invalid test directory: {test_name}. Cannot include `-`, please convert to `_`"
);
}
(test_name, dir.path())
Some((test_name, dir.path()))
})
}

Expand Down

0 comments on commit 2975f2a

Please sign in to comment.