mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
This commit is contained in:
@@ -1369,9 +1369,13 @@ describe('LocalAgentExecutor', () => {
|
||||
(async function* () {
|
||||
await new Promise<void>((resolve) => {
|
||||
// This promise resolves when aborted, ending the generator.
|
||||
signal?.addEventListener('abort', () => {
|
||||
resolve();
|
||||
});
|
||||
signal?.addEventListener(
|
||||
'abort',
|
||||
() => {
|
||||
resolve();
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
});
|
||||
})(),
|
||||
);
|
||||
@@ -1681,7 +1685,9 @@ describe('LocalAgentExecutor', () => {
|
||||
(async function* () {
|
||||
// This promise never resolves, it waits for abort.
|
||||
await new Promise<void>((resolve) => {
|
||||
signal?.addEventListener('abort', () => resolve());
|
||||
signal?.addEventListener('abort', () => resolve(), {
|
||||
once: true,
|
||||
});
|
||||
});
|
||||
})(),
|
||||
);
|
||||
@@ -1734,7 +1740,9 @@ describe('LocalAgentExecutor', () => {
|
||||
// eslint-disable-next-line require-yield
|
||||
(async function* () {
|
||||
await new Promise<void>((resolve) =>
|
||||
signal?.addEventListener('abort', () => resolve()),
|
||||
signal?.addEventListener('abort', () => resolve(), {
|
||||
once: true,
|
||||
}),
|
||||
);
|
||||
})(),
|
||||
);
|
||||
@@ -1745,7 +1753,9 @@ describe('LocalAgentExecutor', () => {
|
||||
// eslint-disable-next-line require-yield
|
||||
(async function* () {
|
||||
await new Promise<void>((resolve) =>
|
||||
signal?.addEventListener('abort', () => resolve()),
|
||||
signal?.addEventListener('abort', () => resolve(), {
|
||||
once: true,
|
||||
}),
|
||||
);
|
||||
})(),
|
||||
);
|
||||
|
||||
@@ -346,12 +346,16 @@ describe('SessionSummaryService', () => {
|
||||
10000,
|
||||
);
|
||||
|
||||
abortSignal?.addEventListener('abort', () => {
|
||||
clearTimeout(timeoutId);
|
||||
const abortError = new Error('This operation was aborted');
|
||||
abortError.name = 'AbortError';
|
||||
reject(abortError);
|
||||
});
|
||||
abortSignal?.addEventListener(
|
||||
'abort',
|
||||
() => {
|
||||
clearTimeout(timeoutId);
|
||||
const abortError = new Error('This operation was aborted');
|
||||
abortError.name = 'AbortError';
|
||||
reject(abortError);
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -1043,10 +1043,13 @@ describe('mcp-client', () => {
|
||||
if (options?.signal?.aborted) {
|
||||
return reject(new Error('Operation aborted'));
|
||||
}
|
||||
options?.signal?.addEventListener('abort', () => {
|
||||
reject(new Error('Operation aborted'));
|
||||
});
|
||||
// Intentionally do not resolve immediately to simulate lag
|
||||
options?.signal?.addEventListener(
|
||||
'abort',
|
||||
() => {
|
||||
reject(new Error('Operation aborted'));
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
}),
|
||||
),
|
||||
listPrompts: vi.fn().mockResolvedValue({ prompts: [] }),
|
||||
|
||||
@@ -242,7 +242,7 @@ export abstract class BaseToolInvocation<
|
||||
}
|
||||
};
|
||||
|
||||
abortSignal.addEventListener('abort', abortHandler);
|
||||
abortSignal.addEventListener('abort', abortHandler, { once: true });
|
||||
|
||||
timeoutId = setTimeout(() => {
|
||||
cleanup();
|
||||
|
||||
@@ -350,9 +350,13 @@ describe('FixLLMEditWithInstruction', () => {
|
||||
if (abortSignal?.aborted) {
|
||||
return reject(new DOMException('Aborted', 'AbortError'));
|
||||
}
|
||||
abortSignal?.addEventListener('abort', () => {
|
||||
reject(new DOMException('Aborted', 'AbortError'));
|
||||
});
|
||||
abortSignal?.addEventListener(
|
||||
'abort',
|
||||
() => {
|
||||
reject(new DOMException('Aborted', 'AbortError'));
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user