Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

feat: add test file detector for automatic discovery#20

Merged
kubrickcode merged 1 commit intomainfrom
develop/shlee/8
Dec 4, 2025
Merged

feat: add test file detector for automatic discovery#20
kubrickcode merged 1 commit intomainfrom
develop/shlee/8

Conversation

@kubrickcode
Copy link
Member

Implement DetectTestFiles API for automatic test file detection in project directories

  • Default skip patterns: node_modules, .git, vendor, dist, etc.
  • Doublestar glob pattern filtering support (**/*.test.ts)
  • File size limit option (default 10MB)

fix #8

@gemini-code-assist
Copy link

Summary of Changes

Hello @kubrickcode, 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 introduces a new DetectTestFiles API, designed to automate the discovery of test files across a project's directory structure. This feature enhances the system's ability to identify relevant test assets by offering robust filtering mechanisms, including predefined and customizable directory exclusion rules, advanced glob pattern matching for file paths, and a safeguard against processing overly large files. The primary goal is to streamline the initial phase of test analysis or execution by providing an efficient and configurable way to locate test files.

Highlights

  • New Test File Detection API: Introduced a DetectTestFiles API within the parser package to automatically discover test files in project directories.
  • Configurable Skip Patterns: The detection process now includes default skip patterns for common directories like node_modules, .git, vendor, dist, etc., with an option to provide custom skip patterns.
  • Doublestar Glob Pattern Support: Added support for doublestar glob patterns (e.g., **/*.test.ts) to allow for flexible and precise filtering of test files.
  • File Size Limit: Implemented an optional file size limit (defaulting to 10MB) to prevent processing excessively large files during detection.
  • Comprehensive Testing: A new test file detector_test.go has been added, providing extensive unit and integration tests for the DetectTestFiles function and its helper methods, covering various scenarios and configurations.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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

  1. 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.

@github-actions github-actions bot added the feature New feature label Dec 4, 2025
@kubrickcode
Copy link
Member Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new test file detector, which is a great addition. The implementation is solid, using the functional options pattern and covering various test file conventions for Go and JavaScript. The accompanying tests are comprehensive and cover many edge cases.

My review focuses on a few areas to further improve the code's robustness and adherence to the repository's style guide:

  • Context Propagation: Adding context.Context to DetectTestFiles for better control over execution.
  • Error Handling: Improving how errors are handled during file traversal to provide more feedback to the caller.
  • Code Organization: Aligning function and test structures with the conventions outlined in the style guide.
  • Test Practices: Using errors.Is for more robust error checking in tests.

These changes should enhance the maintainability and usability of the new detector. Overall, great work!

@kubrickcode
Copy link
Member Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new test file detector, which is a great feature. The implementation is solid, using the functional options pattern and filepath.WalkDir effectively. The test coverage is also quite good.

My review focuses on improving robustness and adherence to the repository's style guide. The main points are:

  • Error Handling: Several functions currently ignore errors silently. I've suggested changes to report these errors to the user, providing better feedback on invalid inputs or file system issues.
  • Style Guide: I've pointed out a few minor violations of the repository style guide regarding field ordering, magic strings, and test naming conventions.
  • Test Coverage: I've suggested adding tests for specific error scenarios to make the detector even more robust.

Overall, this is a well-structured contribution. Addressing these points will make it even better.

Implement DetectTestFiles API for automatic test file detection in project directories
- Default skip patterns: node_modules, .git, vendor, dist, etc.
- Doublestar glob pattern filtering support (**/*.test.ts)
- File size limit option (default 10MB)

fix #8
@kubrickcode
Copy link
Member Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a valuable feature for automatically detecting test files within a project. The implementation is robust, utilizing filepath.WalkDir for efficient file system traversal and a flexible options pattern for customization. The accompanying tests are comprehensive and cover a wide range of scenarios, ensuring the reliability of the new functionality. I have a few suggestions to enhance adherence to the repository's style guide and to improve error feedback for invalid user input. Overall, this is a well-executed addition to the codebase.

@kubrickcode kubrickcode merged commit f19f68c into main Dec 4, 2025
1 check passed
@kubrickcode kubrickcode deleted the develop/shlee/8 branch December 4, 2025 02:11
@kubrickcode
Copy link
Member Author

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test file detection function

1 participant