Bladeren bron

fix(app-boot): drop the unreachable timer guard on the fail-loud release path

The timeout promise's executor runs synchronously while the race is
constructed, so the timer is always assigned; the undefined check was a
dead branch the per-file coverage gate rejected.
Turtle 1 maand geleden
bovenliggende
commit
54e541d33f
1 gewijzigde bestanden met toevoegingen van 4 en 2 verwijderingen
  1. 4 2
      packages/ui/app-boot/src/index.ts

+ 4 - 2
packages/ui/app-boot/src/index.ts

@@ -384,7 +384,9 @@ export function installFailLoud(
       return
     }
     void (async () => {
-      let timer: ReturnType<typeof setTimeout> | undefined
+      // Definitely assigned: the timeout promise's executor runs synchronously
+      // while the race is being constructed, before the first await.
+      let timer!: ReturnType<typeof setTimeout>
       try {
         await Promise.race([
           (async () => release())(),
@@ -396,7 +398,7 @@ export function installFailLoud(
         // The terminal release failed; the fatal exit below is the outcome that
         // matters, and no reporter runs after it.
       }
-      if (timer !== undefined) clearTimeout(timer)
+      clearTimeout(timer)
       proc.exit(1)
     })()
   }