mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-16 17:11:04 -07:00
chore: fix session browser test and skip hook system tests (#14099)
This commit is contained in:
@@ -260,7 +260,9 @@ echo '{
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('AfterModel Hooks - LLM Response Modification', () => {
|
describe('AfterModel Hooks - LLM Response Modification', () => {
|
||||||
it('should modify LLM responses with AfterModel hooks', async () => {
|
it.skipIf(process.platform === 'win32')(
|
||||||
|
'should modify LLM responses with AfterModel hooks',
|
||||||
|
async () => {
|
||||||
await rig.setup('should modify LLM responses with AfterModel hooks', {
|
await rig.setup('should modify LLM responses with AfterModel hooks', {
|
||||||
fakeResponsesPath: join(
|
fakeResponsesPath: join(
|
||||||
import.meta.dirname,
|
import.meta.dirname,
|
||||||
@@ -325,7 +327,8 @@ echo '{
|
|||||||
// Should generate hook telemetry
|
// Should generate hook telemetry
|
||||||
const hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
const hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||||
expect(hookTelemetryFound).toBeTruthy();
|
expect(hookTelemetryFound).toBeTruthy();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('BeforeToolSelection Hooks - Tool Configuration', () => {
|
describe('BeforeToolSelection Hooks - Tool Configuration', () => {
|
||||||
@@ -523,7 +526,9 @@ echo '{
|
|||||||
describe('Sequential Hook Execution', () => {
|
describe('Sequential Hook Execution', () => {
|
||||||
// Note: This test checks telemetry for hook context in API requests,
|
// Note: This test checks telemetry for hook context in API requests,
|
||||||
// which behaves differently with mocked responses. Keeping real LLM calls.
|
// which behaves differently with mocked responses. Keeping real LLM calls.
|
||||||
it('should execute hooks sequentially when configured', async () => {
|
it.skipIf(process.platform === 'win32')(
|
||||||
|
'should execute hooks sequentially when configured',
|
||||||
|
async () => {
|
||||||
await rig.setup('should execute hooks sequentially when configured');
|
await rig.setup('should execute hooks sequentially when configured');
|
||||||
// Create two hooks that modify the input sequentially
|
// Create two hooks that modify the input sequentially
|
||||||
const hook1Script = `#!/bin/bash
|
const hook1Script = `#!/bin/bash
|
||||||
@@ -611,7 +616,8 @@ echo '{
|
|||||||
}
|
}
|
||||||
expect(hasBeforeAgentHookContext).toBeTruthy();
|
expect(hasBeforeAgentHookContext).toBeTruthy();
|
||||||
expect(hasAfterToolHookContext).toBeTruthy();
|
expect(hasAfterToolHookContext).toBeTruthy();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Hook Input/Output Validation', () => {
|
describe('Hook Input/Output Validation', () => {
|
||||||
@@ -682,7 +688,9 @@ fi`;
|
|||||||
describe('Multiple Event Types', () => {
|
describe('Multiple Event Types', () => {
|
||||||
// Note: This test checks telemetry for hook context in API requests,
|
// Note: This test checks telemetry for hook context in API requests,
|
||||||
// which behaves differently with mocked responses. Keeping real LLM calls.
|
// which behaves differently with mocked responses. Keeping real LLM calls.
|
||||||
it('should handle hooks for all major event types', async () => {
|
it.skipIf(process.platform === 'win32')(
|
||||||
|
'should handle hooks for all major event types',
|
||||||
|
async () => {
|
||||||
await rig.setup('should handle hooks for all major event types');
|
await rig.setup('should handle hooks for all major event types');
|
||||||
// Create hook scripts for different events
|
// Create hook scripts for different events
|
||||||
const beforeToolScript = `#!/bin/bash
|
const beforeToolScript = `#!/bin/bash
|
||||||
@@ -799,7 +807,8 @@ echo '{"decision": "allow", "hookSpecificOutput": {"hookEventName": "BeforeAgent
|
|||||||
}
|
}
|
||||||
expect(hasBeforeAgentHookContext).toBeTruthy();
|
expect(hasBeforeAgentHookContext).toBeTruthy();
|
||||||
expect(hasAfterToolHookContext).toBeTruthy();
|
expect(hasAfterToolHookContext).toBeTruthy();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Hook Error Handling', () => {
|
describe('Hook Error Handling', () => {
|
||||||
|
|||||||
@@ -138,11 +138,14 @@ const createSession = (overrides: Partial<SessionInfo>): SessionInfo => ({
|
|||||||
|
|
||||||
describe('SessionBrowser component', () => {
|
describe('SessionBrowser component', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
vi.useFakeTimers();
|
||||||
|
vi.setSystemTime(new Date('2025-11-01T12:00:00Z'));
|
||||||
keypressHandlers.length = 0;
|
keypressHandlers.length = 0;
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
vi.useRealTimers();
|
||||||
vi.restoreAllMocks();
|
vi.restoreAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user