test(acp): add missing coverage for extensions command error paths#23060
test(acp): add missing coverage for extensions command error paths#23060Br1an67 wants to merge 1 commit intogoogle-gemini:mainfrom
Conversation
Add test coverage for error paths in DisableExtensionCommand and UninstallExtensionCommand that were not previously tested: - DisableExtensionCommand: error when disableExtension() throws (e.g. extension does not exist) - UninstallExtensionCommand: error when uninstallExtension() throws for a non-existent extension - Both: usage message when no args provided - Both: success path verification - UninstallExtensionCommand: --all with empty extension list Each test asserts the exact output format including extension name and propagated error message to prevent regressions in user-facing error reporting. Closes google-gemini#22934 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the robustness of the CLI's extension management commands by introducing dedicated test coverage for various error conditions and edge cases. By simulating failures and incorrect usage, the changes ensure that Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive test coverage for the error paths and happy paths of DisableExtensionCommand and UninstallExtensionCommand within the ACP extension commands. The new test cases effectively validate the expected behavior, including error message formatting, usage message display, and successful execution. The createMockContext helper provides a clean and isolated environment for testing, ensuring the command logic is thoroughly verified. The changes significantly improve the robustness of the extension management commands by ensuring their error handling is correct and user-friendly. No high or critical severity issues were identified in this change.
|
@googlebot I signed it. |
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we have updated our contribution policy (see Discussion #17383). We only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. All other community pull requests are subject to closure after 14 days if they do not align with our current focus areas. For this reason, we strongly recommend that contributors only submit pull requests against issues explicitly labeled as 'help-wanted'. This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding and for being part of our community! |
|
@Br1an67, apologies for the bot closing this PR! We have reopened it. Please sync your branch to the latest |
Summary
Adds test coverage for error paths in ACP extension commands (
DisableExtensionCommandandUninstallExtensionCommand) that were not previously tested. These commands are inpackages/cli/src/acp/commands/extensions.ts.Details
New test cases (8 total)
DisableExtensionCommand:returns error when disabling fails— verifies error message format whenextensionManager.disableExtension()throws (e.g. extension does not exist)returns usage message when no args provided— verifies usage hint is shownreports success when disable succeeds— happy path baselineUninstallExtensionCommand:returns error when uninstalling a non-existent extension— verifies error message includes extension name and propagated errorreturns usage message when no args and no --all flag— verifies usage hintreports success when uninstall succeeds— happy path baselinereports "No extensions installed" for --all with empty list— edge case for--allflag with no installed extensionsApproach
Uses a
createMockContext()helper that constructs a minimalCommandContextwith a mockExtensionManager(set viaObject.setPrototypeOfto pass theinstanceofcheck in the command implementations). This isolates the command logic from the full extension manager infrastructure.Related Issues
Closes #22934
Related to #22798
How to Validate
npm run test --workspace @google/gemini-cli -- src/acp/commands/extensions.test.tsPre-Merge Checklist