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 <cursoragent@cursor.com>
This commit is contained in:
Gergo Magyar 2026-08-31 23:37:57 +00:00
parent 31e6360901
commit 190ebcc465
4 changed files with 19 additions and 18 deletions

View file

@ -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

View file

@ -134,12 +134,16 @@ describe('runWorkerAnalysis — finalize guard (#2264 P2)', () => {
});
const finalize = vi.fn<WorkerAnalysisDeps['assertAnalysisFinalized']>(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({

View file

@ -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();

View file

@ -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']]);