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