fix: handle missing local extension config and skip hooks when disabled (#14744)

This commit is contained in:
Abhi
2025-12-08 20:51:42 -05:00
committed by GitHub
parent 8f43d4851d
commit d35a1fdec7
4 changed files with 83 additions and 9 deletions

View File

@@ -43,6 +43,7 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => {
debugLogger: {
error: vi.fn(),
log: vi.fn(),
warn: vi.fn(),
},
};
});
@@ -263,6 +264,25 @@ describe('github.ts', () => {
ExtensionUpdateState.UP_TO_DATE,
);
});
it('should return NOT_UPDATABLE if local extension config cannot be loaded', async () => {
vi.mocked(mockExtensionManager.loadExtensionConfig).mockImplementation(
() => {
throw new Error('Config not found');
},
);
const ext = {
name: 'local-ext',
version: '1.0.0',
path: '/path/to/installed/ext',
installMetadata: { type: 'local', source: '/path/to/source/ext' },
} as unknown as GeminiCLIExtension;
expect(await checkForExtensionUpdate(ext, mockExtensionManager)).toBe(
ExtensionUpdateState.NOT_UPDATABLE,
);
});
});
describe('downloadFromGitHubRelease', () => {