[skip changelog] test: validate hook fixtures via CLI#117
Conversation
Summary of ChangesHello @avifenesh, 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 improves the stability and coverage of the CLI integration tests. It introduces a more robust method for resolving test fixture paths relative to the workspace root, which makes the tests more portable and less prone to environment-specific failures. Furthermore, new tests have been added to specifically validate hook configurations and to enforce the presence of actual content within fixture directories, enhancing the overall quality and reliability of the test suite. 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. 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces several improvements to the integration tests. It refactors test paths to be relative to the workspace root, making them more robust. It also adds two new tests: one to validate hook fixtures via the CLI, and another to ensure no empty fixture directories exist. The changes are well-structured and align with the goal of improving test quality. I have one suggestion to simplify and combine assertions in one of the new tests for better readability and maintainability.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
1 similar comment
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
There was a problem hiding this comment.
Pull request overview
This PR enhances CLI integration testing by resolving fixture paths via workspace root and adding comprehensive validation for hook fixtures and empty directories, addressing issue #75.
Changes:
- Added helper functions (
workspace_root(),workspace_path(),fixtures_config()) to resolve paths relative to workspace root in tests - Updated all existing test paths to use workspace-relative resolution for better portability across different execution contexts
- Added CLI test
test_cli_covers_hook_fixtures_via_cli_validationthat validates hook fixtures through CLI and asserts CC-HK-006 rule detection - Added guard test
test_fixtures_have_no_empty_placeholder_dirsto ensure all fixture directories contain actual test files
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Addressed the review note by combining the CC-HK-006 assertions into a single check. The JSON output reports the file path as ests/fixtures/invalid/hooks/missing-command-field/settings.json (relative to workspace root), so the assertion targets that concrete path to match actual CLI output. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if let Ok(content) = std::fs::read_to_string(&cargo_toml) { | ||
| if content.contains("[workspace]") || content.contains("[workspace.") { |
There was a problem hiding this comment.
The workspace detection logic uses simple string matching with contains("[workspace]") which could match false positives in comments or strings within the Cargo.toml file. Consider using proper TOML parsing with the toml crate (which is already a dependency in this crate's Cargo.toml) to check for a [workspace] section. For example, you could parse the file and check if parsed.get("workspace").is_some().
Summary
Test Plan
Related Issues
Closes #75