diff --git a/lib/util/git/index.spec.ts b/lib/util/git/index.spec.ts
index 1fda6e3539740f3bdc51aea54ff7f530ac1c31e0..e6537feaaf3f0cbd6a58222883f77985f0911e8c 100644
--- a/lib/util/git/index.spec.ts
+++ b/lib/util/git/index.spec.ts
@@ -110,14 +110,14 @@ describe('util/git/index', () => {
   });
 
   afterEach(async () => {
-    await tmpDir.cleanup();
-    await origin.cleanup();
+    await tmpDir?.cleanup();
+    await origin?.cleanup();
     jest.restoreAllMocks();
   });
 
   afterAll(async () => {
     process.env = OLD_ENV;
-    await base.cleanup();
+    await base?.cleanup();
   });
 
   describe('gitRetry', () => {