fix(cli): make yargs extension tests language-independent#8242
fix(cli): make yargs extension tests language-independent#8242amsminn wants to merge 1 commit intogoogle-gemini:mainfrom
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @amsminn, 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 addresses an issue where CLI tests were failing on systems configured with non-English locales. By enforcing an English locale for yargs within the test setup, the PR ensures consistent test execution regardless of the host system's language settings, thereby enhancing the reliability and portability of the test suite.
Highlights
- Test Stability: Resolved test failures occurring on non-English systems by explicitly setting the locale for yargs within the CLI test environment. This ensures yargs error messages are consistently in English, preventing mismatches with test expectations.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request addresses an issue with test failures on non-English systems by forcing an English locale within the test setup. The method of setting environment variables is appropriate for this purpose. My review focuses on a small improvement to remove a redundant environment variable setting, which will enhance the clarity and maintainability of the configuration.
|
Thank you for your contribution. I think this is an OK way to do this but I would rather that our tests don't make assumptions that break internationalization. We're currently working with a contributor on landing internationalization in #8060 so it would be counterproductive to hardcode our tests to English. Do you have a list of tests that are broken, and can we make them do less literal string comparison to make them pass? |
6c2c980 to
3cac454
Compare
Thank you for the feedback! |
|
The only failing Windows test, The failing test should toggle setting with Enter key depends on JavaScript object key ordering, which varies between platforms (Windows vs macOS/Linux). Can anyone confirm this issue? |
|
Thank you for the update and for tagging me, @amsminn. I can confirm that the Regarding the "JavaScript object key ordering" issue, while modern JavaScript environments generally preserve insertion order for object keys, relying on this implicitly in tests can sometimes lead to unexpected behavior across different platforms or Node.js versions if the order is critical for the test's assertion. If the test is failing due to an assumed order that isn't explicitly enforced (e.g., by sorting keys before comparison), it could certainly manifest as a platform-specific issue. Given that this test failure appears unrelated to your current changes and seems to highlight a pre-existing issue with the |
@cornmander |
9e39962 to
5ce6631
Compare
275d277 to
019d9b6
Compare
b44bd09 to
6a4c53f
Compare
Done! Commits squashed. Thanks for reviewing |
5c7cf94 to
1852cc0
Compare
1852cc0 to
f1306e5
Compare
|
closing in favor of Something went wrong with merging this PR resulting in an enormous diff. |
TLDR
Fix locale-dependent test failures in yargs extension command tests by removing hardcoded
English error messages and verifying error occurrence instead of specific message content.
Dive Deeper
The yargs library localizes error messages based on system locale. The existing tests were
hardcoded to expect English error messages, causing failures on non-English systems (e.g.,
Korean). Changed assertions from .toThrow('specific message') to .toThrow() to make tests
language-agnostic.
Reviewer Test Plan
Testing Matrix
Linked issues / bugs
This PR makes progress on #8241