From 9566afcea8fbb9498c1e5a8e4463e6bd3ca4cdc8 Mon Sep 17 00:00:00 2001 From: Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com> Date: Thu, 3 Sep 2026 00:32:12 -0400 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20[fix]=20Scope=20Squirrel=20a?= =?UTF-8?q?rtifact=20gate=20to=20Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/run-packaged-smoke.mjs | 7 +++- tests/unit/packaging/runPackagedSmoke.test.ts | 39 +++++++++++++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/scripts/run-packaged-smoke.mjs b/scripts/run-packaged-smoke.mjs index 15f0d50e2..78fad4008 100644 --- a/scripts/run-packaged-smoke.mjs +++ b/scripts/run-packaged-smoke.mjs @@ -258,7 +258,10 @@ export function findForbiddenWindowsPackagingArtifacts(directoryPath) { const entryPath = path.join(currentDirectoryPath, entry.name); const normalizedName = entry.name.toLowerCase(); if ( - normalizedName.includes("squirrel") || + normalizedName === "squirrel.exe" || + normalizedName.includes("squirrel-windows") || + normalizedName.startsWith("fit-file-viewer-squirrel-") || + normalizedName.endsWith(".nupkg") || normalizedName.endsWith("_executionstub.exe") ) { matches.push(entryPath); @@ -285,7 +288,7 @@ function assertNoForbiddenWindowsPackagingArtifacts(directoryPath) { throw new Error( [ - "Packaged app contains forbidden Squirrel packaging artifacts:", + "Packaged app contains forbidden Squirrel.Windows packaging artifacts:", ...forbiddenArtifacts.map((filePath) => `- ${filePath}`), ].join("\n") ); diff --git a/tests/unit/packaging/runPackagedSmoke.test.ts b/tests/unit/packaging/runPackagedSmoke.test.ts index 7ea43c0d8..3c5689d9d 100644 --- a/tests/unit/packaging/runPackagedSmoke.test.ts +++ b/tests/unit/packaging/runPackagedSmoke.test.ts @@ -134,10 +134,18 @@ describe("run-packaged-smoke script", () => { ).toThrow("Packaged Electron executable not found"); }); - it("rejects Squirrel artifacts or helper executables leaked into Windows packages", () => { + it("rejects Squirrel.Windows artifacts without rejecting Electron's macOS updater framework", () => { expect.assertions(3); const releaseDistPath = createTemporaryRoot(); + const macSquirrelFrameworkPath = path.join( + releaseDistPath, + "mac-arm64", + "Fit File Viewer.app", + "Contents", + "Frameworks", + "Squirrel.framework" + ); const squirrelDirectoryPath = path.join( releaseDistPath, "squirrel-windows" @@ -152,22 +160,47 @@ describe("run-packaged-smoke script", () => { "win-unpacked", "Fit File Viewer_ExecutionStub.exe" ); + const squirrelExecutablePath = path.join( + releaseDistPath, + "win-unpacked", + "Squirrel.exe" + ); + const squirrelPackagePath = path.join( + releaseDistPath, + "FitFileViewer-30.0.1-full.nupkg" + ); + const renamedSquirrelInstallerPath = path.join( + releaseDistPath, + "Fit-File-Viewer-squirrel-x64-30.0.1.exe" + ); + mkdirSync(macSquirrelFrameworkPath, { recursive: true }); mkdirSync(squirrelDirectoryPath, { recursive: true }); writeExecutable(executablePath); writeExecutable(executionStubPath); + writeExecutable(squirrelExecutablePath); + writeExecutable(renamedSquirrelInstallerPath); + writeFileSync(squirrelPackagePath, "Squirrel.Windows package"); const commandRunner = vi.fn(); expect( findForbiddenWindowsPackagingArtifacts(releaseDistPath) - ).toStrictEqual([executionStubPath, squirrelDirectoryPath].sort()); + ).toStrictEqual( + [ + executionStubPath, + renamedSquirrelInstallerPath, + squirrelDirectoryPath, + squirrelExecutablePath, + squirrelPackagePath, + ].sort() + ); expect(() => runPackagedSmoke( ["--executable", executablePath], {}, commandRunner ) - ).toThrow("forbidden Squirrel packaging artifacts"); + ).toThrow("forbidden Squirrel.Windows packaging artifacts"); expect(commandRunner).not.toHaveBeenCalled(); }); From 4d0abdc5ce60701a2cb34b57eb9546acbc666b1b Mon Sep 17 00:00:00 2001 From: Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com> Date: Thu, 3 Sep 2026 00:36:25 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20[refactor]=20Split=20S?= =?UTF-8?q?quirrel=20packaging=20regressions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/unit/packaging/runPackagedSmoke.test.ts | 108 ++++++++++-------- 1 file changed, 58 insertions(+), 50 deletions(-) diff --git a/tests/unit/packaging/runPackagedSmoke.test.ts b/tests/unit/packaging/runPackagedSmoke.test.ts index 3c5689d9d..1ade97d61 100644 --- a/tests/unit/packaging/runPackagedSmoke.test.ts +++ b/tests/unit/packaging/runPackagedSmoke.test.ts @@ -134,66 +134,53 @@ describe("run-packaged-smoke script", () => { ).toThrow("Packaged Electron executable not found"); }); - it("rejects Squirrel.Windows artifacts without rejecting Electron's macOS updater framework", () => { - expect.assertions(3); + it("finds known Squirrel.Windows package artifacts", () => { + expect.assertions(1); + + const releaseDistPath = createTemporaryRoot(); + const forbiddenPaths = [ + path.join(releaseDistPath, "squirrel-windows"), + path.join( + releaseDistPath, + "win-unpacked", + "Fit File Viewer_ExecutionStub.exe" + ), + path.join(releaseDistPath, "win-unpacked", "Squirrel.exe"), + path.join(releaseDistPath, "FitFileViewer-30.0.1-full.nupkg"), + path.join( + releaseDistPath, + "Fit-File-Viewer-squirrel-x64-30.0.1.exe" + ), + ]; + mkdirSync(forbiddenPaths[0], { recursive: true }); + for (const forbiddenPath of forbiddenPaths.slice(1)) { + writeExecutable(forbiddenPath); + } + + expect( + findForbiddenWindowsPackagingArtifacts(releaseDistPath) + ).toStrictEqual(forbiddenPaths.sort()); + }); + + it("rejects Squirrel.Windows artifacts before launching an app", () => { + expect.assertions(2); const releaseDistPath = createTemporaryRoot(); - const macSquirrelFrameworkPath = path.join( - releaseDistPath, - "mac-arm64", - "Fit File Viewer.app", - "Contents", - "Frameworks", - "Squirrel.framework" - ); - const squirrelDirectoryPath = path.join( - releaseDistPath, - "squirrel-windows" - ); const executablePath = path.join( releaseDistPath, "win-unpacked", "Fit File Viewer.exe" ); - const executionStubPath = path.join( - releaseDistPath, - "win-unpacked", - "Fit File Viewer_ExecutionStub.exe" - ); - const squirrelExecutablePath = path.join( - releaseDistPath, - "win-unpacked", - "Squirrel.exe" - ); - const squirrelPackagePath = path.join( - releaseDistPath, - "FitFileViewer-30.0.1-full.nupkg" - ); - const renamedSquirrelInstallerPath = path.join( - releaseDistPath, - "Fit-File-Viewer-squirrel-x64-30.0.1.exe" - ); - mkdirSync(macSquirrelFrameworkPath, { recursive: true }); - mkdirSync(squirrelDirectoryPath, { recursive: true }); writeExecutable(executablePath); - writeExecutable(executionStubPath); - writeExecutable(squirrelExecutablePath); - writeExecutable(renamedSquirrelInstallerPath); - writeFileSync(squirrelPackagePath, "Squirrel.Windows package"); - + writeExecutable( + path.join( + releaseDistPath, + "win-unpacked", + "Fit File Viewer_ExecutionStub.exe" + ) + ); const commandRunner = vi.fn(); - expect( - findForbiddenWindowsPackagingArtifacts(releaseDistPath) - ).toStrictEqual( - [ - executionStubPath, - renamedSquirrelInstallerPath, - squirrelDirectoryPath, - squirrelExecutablePath, - squirrelPackagePath, - ].sort() - ); expect(() => runPackagedSmoke( ["--executable", executablePath], @@ -204,6 +191,27 @@ describe("run-packaged-smoke script", () => { expect(commandRunner).not.toHaveBeenCalled(); }); + it("allows Electron's macOS Squirrel updater framework", () => { + expect.assertions(1); + + const releaseDistPath = createTemporaryRoot(); + mkdirSync( + path.join( + releaseDistPath, + "mac-arm64", + "Fit File Viewer.app", + "Contents", + "Frameworks", + "Squirrel.framework" + ), + { recursive: true } + ); + + expect( + findForbiddenWindowsPackagingArtifacts(releaseDistPath) + ).toStrictEqual([]); + }); + it("launches the packaged executable and treats timeout as a healthy startup", () => { expect.assertions(7);