test: fix failed test cases and restore vitest.config.ts

This commit is contained in:
mingholy.lmh
2025-11-06 10:46:08 +08:00
parent 7975a0da72
commit 9d26095bd6
2 changed files with 27 additions and 2 deletions

View File

@@ -686,6 +686,9 @@ describe('CoreToolScheduler with payload', () => {
getUseSmartEdit: () => false, getUseSmartEdit: () => false,
getUseModelRouter: () => false, getUseModelRouter: () => false,
getGeminiClient: () => null, // No client needed for these tests getGeminiClient: () => null, // No client needed for these tests
isInteractive: () => true, // Required to prevent auto-denial of tool calls
getIdeMode: () => false,
getExperimentalZedIntegration: () => false,
} as unknown as Config; } as unknown as Config;
const scheduler = new CoreToolScheduler({ const scheduler = new CoreToolScheduler({
@@ -1006,6 +1009,9 @@ describe('CoreToolScheduler edit cancellation', () => {
getUseSmartEdit: () => false, getUseSmartEdit: () => false,
getUseModelRouter: () => false, getUseModelRouter: () => false,
getGeminiClient: () => null, // No client needed for these tests getGeminiClient: () => null, // No client needed for these tests
isInteractive: () => true, // Required to prevent auto-denial of tool calls
getIdeMode: () => false,
getExperimentalZedIntegration: () => false,
} as unknown as Config; } as unknown as Config;
const scheduler = new CoreToolScheduler({ const scheduler = new CoreToolScheduler({
@@ -1658,6 +1664,9 @@ describe('CoreToolScheduler request queueing', () => {
getUseSmartEdit: () => false, getUseSmartEdit: () => false,
getUseModelRouter: () => false, getUseModelRouter: () => false,
getGeminiClient: () => null, // No client needed for these tests getGeminiClient: () => null, // No client needed for these tests
isInteractive: () => true, // Required to prevent auto-denial of tool calls
getIdeMode: () => false,
getExperimentalZedIntegration: () => false,
} as unknown as Config; } as unknown as Config;
const testTool = new TestApprovalTool(mockConfig); const testTool = new TestApprovalTool(mockConfig);
@@ -1687,7 +1696,10 @@ describe('CoreToolScheduler request queueing', () => {
const onAllToolCallsComplete = vi.fn(); const onAllToolCallsComplete = vi.fn();
const onToolCallsUpdate = vi.fn(); const onToolCallsUpdate = vi.fn();
const pendingConfirmations: Array< const pendingConfirmations: Array<
(outcome: ToolConfirmationOutcome) => void (
outcome: ToolConfirmationOutcome,
payload?: ToolConfirmationPayload,
) => Promise<void>
> = []; > = [];
const scheduler = new CoreToolScheduler({ const scheduler = new CoreToolScheduler({
@@ -1758,7 +1770,7 @@ describe('CoreToolScheduler request queueing', () => {
// Approve the first tool with ProceedAlways // Approve the first tool with ProceedAlways
const firstConfirmation = pendingConfirmations[0]; const firstConfirmation = pendingConfirmations[0];
firstConfirmation(ToolConfirmationOutcome.ProceedAlways); await firstConfirmation(ToolConfirmationOutcome.ProceedAlways);
// Wait for all tools to be completed // Wait for all tools to be completed
await vi.waitFor(() => { await vi.waitFor(() => {

13
vitest.config.ts Normal file
View File

@@ -0,0 +1,13 @@
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
projects: [
'packages/cli',
'packages/core',
'packages/vscode-ide-companion',
'integration-tests',
'scripts',
],
},
});