From bc278d27cb41cbf18033d53b52dd5ddc56cb9f64 Mon Sep 17 00:00:00 2001 From: Gareth Jones <3151613+G-Rath@users.noreply.github.com> Date: Mon, 9 Mar 2026 10:58:00 +1300 Subject: [PATCH] refactor: determine if we need updating based on the number of obsolete tests --- snaps/clean.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/snaps/clean.go b/snaps/clean.go index 3b4f5d4..d630943 100644 --- a/snaps/clean.go +++ b/snaps/clean.go @@ -251,8 +251,6 @@ func examineSnaps( return nil, isDirty, err } - var needsUpdating bool - registeredTests := occurrences(registry[snapPath], count, snapshotOccurrenceFMT) s := snapshotScanner(f) @@ -267,7 +265,6 @@ func examineSnaps( if !registeredTests.Has(testID) && !testSkipped(testID, runOnly) { obsoleteTests = append(obsoleteTests, testID) - needsUpdating = true removeSnapshot(s) continue @@ -297,7 +294,7 @@ func examineSnaps( // if we're not allowed to update anything, just capture if the snapshot // needs cleaning, and then continue to the next snapshot if !shouldUpdate { - if needsUpdating || needsSorting { + if len(obsoleteTests) > 0 || needsSorting { isDirty = true }