diff --git a/tooling/nargo_cli/build.rs b/tooling/nargo_cli/build.rs index 9d4338d7c1e..82511f56a77 100644 --- a/tooling/nargo_cli/build.rs +++ b/tooling/nargo_cli/build.rs @@ -168,10 +168,11 @@ fn generate_test_cases( } let test_cases = test_cases.join("\n"); - // Locking the Nargo.toml file in the test directory so that we can run tests exclusively. - // NB a Mutex is not enough on CI because we use `cargo nextest` which can run test cases - // in the group in different processes. - // For some reason the file lock alone doesn't seem to do the trick locally. + // We need to isolate test cases in the same group, otherwise they overwrite each other's artifacts. + // On CI we use `cargo nextest`, which runs tests in different processes; for this we use a file lock. + // Locally we might be using `cargo test`, which run tests in the same process; in this case the file lock + // wouldn't work, becuase the process itself has the lock, and it looks like it can have N instances without + // any problems; for this reason we also use a `Mutex`. let mutex_name = format! {"TEST_MUTEX_{}", test_name.to_uppercase()}; write!( test_file,