From 535adc64be55e3ef7fd93a2bda2945bb057cedd4 Mon Sep 17 00:00:00 2001 From: David Kaya Date: Mon, 30 Mar 2026 17:18:02 +0200 Subject: [PATCH] fix: enable background update checks in dev builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the isPackaged guard from AutoUpdateService.start() so that background update checks run in both packaged and dev builds. forceDevUpdateConfig already handles dev-mode config correctly via dev-app-update.yml — the start() gate was preventing the 10s initial check and 4h periodic checks from ever being scheduled in dev. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/main/services/autoUpdater.ts | 2 +- tests/main/autoUpdater.test.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/services/autoUpdater.ts b/src/main/services/autoUpdater.ts index eefda72..4089155 100644 --- a/src/main/services/autoUpdater.ts +++ b/src/main/services/autoUpdater.ts @@ -192,7 +192,7 @@ export class AutoUpdateService { } start(): void { - if (this.started || !this.options.isPackaged) { + if (this.started) { return; } diff --git a/tests/main/autoUpdater.test.ts b/tests/main/autoUpdater.test.ts index 4912a02..7394e85 100644 --- a/tests/main/autoUpdater.test.ts +++ b/tests/main/autoUpdater.test.ts @@ -64,18 +64,20 @@ class FakeScheduler implements AutoUpdateScheduler { } describe('AutoUpdateService', () => { - test('does not schedule checks for unpackaged apps but manual checks still work', async () => { + test('schedules checks for unpackaged apps using dev update config', async () => { const updater = new FakeUpdater(); const scheduler = new FakeScheduler(); const service = new AutoUpdateService({ isPackaged: false, scheduler, updater }); service.start(); - expect(scheduler.timeouts).toHaveLength(0); - expect(scheduler.intervals).toHaveLength(0); expect(updater.forceDevUpdateConfig).toBe(true); + expect(scheduler.timeouts).toEqual([{ callback: expect.any(Function), delayMs: 10_000 }]); + expect(scheduler.intervals).toEqual([{ callback: expect.any(Function), delayMs: 4 * 60 * 60 * 1000 }]); + + await scheduler.runTimeout(); + await Promise.resolve(); - await service.checkForUpdates(); expect(updater.checkForUpdatesCalls).toBe(1); });