Skip to content

Commit 82cf61d

Browse files
authored
fix: do not remove snapshots directory before running the test suite (foundry-rs#9645)
* do not remove snapshots directory before running the test suite, the side effect is that any custom group names or file name changes are not reflected - this is delegated to the end user * do not remove the `snapshots` directory upon running `forge clean`
1 parent 70cd140 commit 82cf61d

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

crates/config/src/lib.rs

-6
Original file line numberDiff line numberDiff line change
@@ -1059,12 +1059,6 @@ impl Config {
10591059
remove_test_dir(&self.fuzz.failure_persist_dir);
10601060
remove_test_dir(&self.invariant.failure_persist_dir);
10611061

1062-
// Remove snapshot directory.
1063-
let snapshot_dir = project.root().join(&self.snapshots);
1064-
if snapshot_dir.exists() {
1065-
let _ = fs::remove_dir_all(&snapshot_dir);
1066-
}
1067-
10681062
Ok(())
10691063
}
10701064

crates/forge/bin/cmd/test/mod.rs

-11
Original file line numberDiff line numberDiff line change
@@ -301,17 +301,6 @@ impl TestArgs {
301301
// Create test options from general project settings and compiler output.
302302
let project_root = &project.paths.root;
303303

304-
// Remove the snapshots directory if it exists.
305-
// This is to ensure that we don't have any stale snapshots.
306-
// If `FORGE_SNAPSHOT_CHECK` is set, we don't remove the snapshots directory as it is
307-
// required for comparison.
308-
if std::env::var_os("FORGE_SNAPSHOT_CHECK").is_none() {
309-
let snapshot_dir = project_root.join(&config.snapshots);
310-
if snapshot_dir.exists() {
311-
let _ = fs::remove_dir_all(project_root.join(&config.snapshots));
312-
}
313-
}
314-
315304
let should_debug = self.debug;
316305
let should_draw = self.flamegraph || self.flamechart;
317306

0 commit comments

Comments
 (0)