From 190ebcc465db4aed5d9e3df1d2f5495f29fbdb5f Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Mon, 31 Aug 2026 23:37:57 +0000 Subject: [PATCH] style: apply prettier and prefer-const on watch shutdown tests (#3121) Keep CI autofix from re-flagging the same files after the teardown fix. Co-authored-by: Cursor --- gitnexus/src/cli/watch.ts | 5 +---- gitnexus/test/unit/analyze-worker-core.test.ts | 16 ++++++++++------ ...d-incremental-writeback-orchestration.test.ts | 7 ++++--- gitnexus/test/unit/watch-loop-shutdown.test.ts | 9 ++++----- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/gitnexus/src/cli/watch.ts b/gitnexus/src/cli/watch.ts index e406600ef..b8f1e3880 100644 --- a/gitnexus/src/cli/watch.ts +++ b/gitnexus/src/cli/watch.ts @@ -241,10 +241,7 @@ export function shouldStopAfterWatchRefreshFailure( ); } -export function formatFatalWatchRefreshFailure( - error: unknown, - paths: readonly string[], -): string { +export function formatFatalWatchRefreshFailure(error: unknown, paths: readonly string[]): string { const detail = paths.length > 0 ? ` (${paths.length} queued path(s))` : ''; const reason = error instanceof StreamedIncrementalWritebackError diff --git a/gitnexus/test/unit/analyze-worker-core.test.ts b/gitnexus/test/unit/analyze-worker-core.test.ts index abcd9e61c..03333c5f8 100644 --- a/gitnexus/test/unit/analyze-worker-core.test.ts +++ b/gitnexus/test/unit/analyze-worker-core.test.ts @@ -134,12 +134,16 @@ describe('runWorkerAnalysis — finalize guard (#2264 P2)', () => { }); const finalize = vi.fn(async () => undefined); - await runWorkerAnalysis('/repo', {}, { - runFullAnalysis: failingRun, - assertAnalysisFinalized: finalize, - send, - claimTerminal: alwaysClaim, - }); + await runWorkerAnalysis( + '/repo', + {}, + { + runFullAnalysis: failingRun, + assertAnalysisFinalized: finalize, + send, + claimTerminal: alwaysClaim, + }, + ); expect(send).toHaveBeenCalledTimes(1); expect(send).toHaveBeenCalledWith({ diff --git a/gitnexus/test/unit/streamed-incremental-writeback-orchestration.test.ts b/gitnexus/test/unit/streamed-incremental-writeback-orchestration.test.ts index 855d055d0..52305b8d9 100644 --- a/gitnexus/test/unit/streamed-incremental-writeback-orchestration.test.ts +++ b/gitnexus/test/unit/streamed-incremental-writeback-orchestration.test.ts @@ -163,9 +163,10 @@ describe('streamed incremental writeback orchestration', () => { thrown = error; } - expect(thrown, `${(thrown as Error)?.stack ?? String(thrown)}\n${logs.join('\n')}`).toBeInstanceOf( - StreamedIncrementalWritebackError, - ); + expect( + thrown, + `${(thrown as Error)?.stack ?? String(thrown)}\n${logs.join('\n')}`, + ).toBeInstanceOf(StreamedIncrementalWritebackError); expect(analyzeFailureMayHaveMutatedLiveIndex(thrown)).toBe(false); expect(fixture.saveMeta).not.toHaveBeenCalled(); expect(fixture.initLbug).not.toHaveBeenCalled(); diff --git a/gitnexus/test/unit/watch-loop-shutdown.test.ts b/gitnexus/test/unit/watch-loop-shutdown.test.ts index f8999b051..66b3b857f 100644 --- a/gitnexus/test/unit/watch-loop-shutdown.test.ts +++ b/gitnexus/test/unit/watch-loop-shutdown.test.ts @@ -57,9 +57,7 @@ describe('watch loop fatal shutdown', () => { it('does not start another refresh while a slow watcher.close is in flight', async () => { const repo = await makeRepo(); const refreshCalls: string[][] = []; - let loop!: WatchFileLoop; - - loop = await startWatchFileLoop( + const loop: WatchFileLoop = await startWatchFileLoop( repo, 10, async (paths) => { @@ -75,12 +73,13 @@ describe('watch loop fatal shutdown', () => { loops.push(loop); expect(refreshCalls).toEqual([[]]); - lastWatcher!.emit('all', 'change', path.join(repo, 'src/a.ts')); + expect(lastWatcher).toBeDefined(); + lastWatcher.emit('all', 'change', path.join(repo, 'src/a.ts')); await vi.waitFor(() => { expect(refreshCalls.length).toBe(2); }); - expect(lastWatcher!.close).toHaveBeenCalled(); + expect(lastWatcher.close).toHaveBeenCalled(); await new Promise((resolve) => setTimeout(resolve, 400)); expect(refreshCalls).toEqual([[], ['src/a.ts']]);