From 89fe8dcf4e704e56187653b8c23fbd3eb5d00a92 Mon Sep 17 00:00:00 2001 From: Adolanium <94890352+Adolanium@users.noreply.github.com> Date: Fri, 20 Nov 2026 16:43:01 +0200 Subject: [PATCH] test(binary): throw the cause when restoration setup fails A failed resolveTarget returned after a boolean assertion, so the setup failure showed as a mismatch instead of the typed error. Format the long AnalysisOutputError line that static checks rejected. --- .../binary/BinarySessionRestoration.test.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/application/binary/BinarySessionRestoration.test.ts b/src/application/binary/BinarySessionRestoration.test.ts index 64e002ea61..6f82558704 100644 --- a/src/application/binary/BinarySessionRestoration.test.ts +++ b/src/application/binary/BinarySessionRestoration.test.ts @@ -345,8 +345,7 @@ it("opens another target after a failed switch cannot restore the previous one", }; try { const target = await session.resolveTarget(process.execPath); - expect(target.ok).toBe(true); - if (!target.ok) return; + if (!target.ok) throw target.error; expect( (await session.openResolvedTarget({ target: target.value, route })).ok, ).toBe(true); @@ -409,7 +408,8 @@ it("keeps an imported snapshot when the first open fails and its cleanup fails", binding: null, selection: undefined, createClient: () => ({ - execute: async () => err(new AnalysisOutputError("health", "Open failed")), + execute: async () => + err(new AnalysisOutputError("health", "Open failed")), close: async () => { closes += 1; if (closes === 1) return err(cleanupFailure); @@ -420,8 +420,7 @@ it("keeps an imported snapshot when the first open fails and its cleanup fails", }; try { const target = await session.resolveTarget(process.execPath); - expect(target.ok).toBe(true); - if (!target.ok) return; + if (!target.ok) throw target.error; expect( session.importAnalysisSnapshot( analysisSnapshotSchema.parse({ @@ -487,8 +486,7 @@ it("opens another profile after a failed switch whose cleanup later succeeds", a }; try { const target = await session.resolveTarget(process.execPath); - expect(target.ok).toBe(true); - if (!target.ok) return; + if (!target.ok) throw target.error; expect( (await session.openResolvedTarget({ target: target.value, route })).ok, ).toBe(true);