Browse Source

fix: stop spying fs.mkdirSync as no-op in cache 'keeps working' test

The test spied fs.mkdirSync as a no-op, which broke preparePackageUpdate's
internal mkdirSync -> mkdtempSync staging-dir creation (ENOENT on CI). Let
mkdirSync actually create dirs; the test only asserts the dependency spec
is written and the result is non-null.
Michael Henke 3 weeks ago
parent
commit
5a665c6db8
1 changed files with 0 additions and 6 deletions
  1. 0 6
      src/hooks/auto-update-checker/cache.test.ts

+ 0 - 6
src/hooks/auto-update-checker/cache.test.ts

@@ -155,7 +155,6 @@ describe('auto-update-checker/cache', () => {
       );
       const writeSpy = spyOn(fs, 'writeFileSync').mockImplementation(() => {});
       const rmSyncSpy = spyOn(fs, 'rmSync').mockReturnValue(undefined);
-      const mkdirSyncSpy = spyOn(fs, 'mkdirSync').mockReturnValue(undefined);
       const { preparePackageUpdate } = await import(
         `./cache?test=${importCounter++}`
       );
@@ -169,7 +168,6 @@ describe('auto-update-checker/cache', () => {
       readSpy.mockRestore();
       writeSpy.mockRestore();
       rmSyncSpy.mockRestore();
-      mkdirSyncSpy.mockRestore();
     });
   });
 
@@ -186,10 +184,6 @@ describe('auto-update-checker/cache', () => {
     function createPrepared(root: string, version: string) {
       const parent = join(root, 'packages');
       fs.mkdirSync(parent, { recursive: true });
-      // ponytail: re-ensure parent exists right before mkdtemp to avoid a
-      // transient ENOENT on CI runners where the dir created above isn't
-      // yet visible to mkdtempSync in the same tick.
-      fs.mkdirSync(parent, { recursive: true });
       const stagingDir = fs.mkdtempSync(join(parent, '.staging-'));
       return {
         stagingDir,