mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-14 04:08:05 +00:00
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:
parent
31e6360901
commit
190ebcc465
4 changed files with 19 additions and 18 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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']]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue