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

feat: add Vitest test parser support#17

Merged
kubrickcode merged 1 commit intomainfrom
develop/shlee/5
Dec 3, 2025
Merged

feat: add Vitest test parser support#17
kubrickcode merged 1 commit intomainfrom
develop/shlee/5

Conversation

@kubrickcode
Copy link
Member

Extract Jest parsing logic to shared/jstest package for reuse with Vitest

  • shared/jstest: common module for describe/it/test pattern parsing
  • vitest: distinguish from Jest by detecting 'vitest' import in file
  • Vitest matches before Jest with higher priority

fix #5

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

/gemini review

@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 significantly enhances the system's ability to parse JavaScript/TypeScript test files by adding explicit support for the Vitest framework. It achieves this by refactoring the existing Jest parsing logic into a new, shared "jstest" module, which both Jest and the newly introduced Vitest parser now utilize. This modular approach improves code organization and allows for more robust and accurate detection of test files based on their content and framework-specific characteristics.

Highlights

  • Vitest Support Added: Introduced a new parsing strategy for Vitest, enabling the system to correctly identify and parse Vitest test files.
  • Shared JavaScript Test Parsing Logic: Extracted common parsing functions and constants previously used by Jest into a new "shared/jstest" package, promoting code reuse and maintainability.
  • Prioritized Framework Detection: The Vitest parsing strategy is configured with a higher priority than Jest, ensuring that files containing Vitest-specific imports are correctly attributed to Vitest.
  • Enhanced Test File Detection: Vitest files are now identified not only by standard naming conventions (".test", ".spec") but also by checking for the presence of a 'vitest' import within the file content.
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.

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 support for Vitest by refactoring the existing Jest parser into a shared jstest package. This is an excellent change for modularity and code reuse, aligning well with the repository's coding conventions. The new vitest strategy correctly identifies Vitest files and leverages the shared parser. The changes are well-structured and include comprehensive tests for the new and shared components. I've identified a few areas for improvement regarding context propagation, code duplication, and function ordering, which are detailed in the comments below. Overall, this is a solid contribution.

@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 refactors the Jest test parser by extracting common logic into a new shared/jstest package. This shared logic is then used to implement a new parser for Vitest. This is a great improvement for modularity and code reuse.

My review focuses on adherence to the repository's style guide and improving the robustness of the new Vitest parser. I've left a few comments:

  • In vitest.go, I've suggested replacing a magic number with a constant and improving the logic for detecting Vitest files.
  • In shared/jstest/parser.go, I've noted that the function order could be adjusted to better match the style guide's recommendation for top-down call order.
  • In shared/jstest/helpers.go, I've pointed out that some explanatory comments were removed from a complex function, and suggested restoring them for better maintainability.

Overall, this is a well-structured pull request that significantly improves the parser's architecture.

@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 is a great refactoring effort to support the Vitest test framework. By extracting the common parsing logic for describe/it/test patterns from the Jest strategy into a new shared jstest package, you've made the codebase more modular and maintainable, which is a great application of the modularization principle in our style guide. The introduction of the Vitest parser, which reuses this shared logic, is clean and well-implemented. The new Vitest strategy correctly uses a higher priority to ensure it's selected over the Jest strategy for files containing Vitest imports. The test coverage for the new shared package and the Vitest strategy is thorough.

I've found a couple of areas for improvement: one related to handling a specific test case pattern and another to make the Vitest file detection more robust. I've also included a style suggestion to improve code readability by reordering functions according to our style guide.

Overall, this is a high-quality contribution.

@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 is a great refactoring effort. You've successfully extracted the common parsing logic for Jest-like frameworks into a shared jstest package, which is a prime example of good modularization as promoted by the repository's style guide. This made the implementation of the new Vitest parser clean and straightforward.

My review includes a few points:

  • A high-severity bug in how .each test cases are parsed, which can lead to incorrect test names.
  • Some medium-severity style guide violations regarding function ordering in the new shared files. Adhering to the "call order" convention will improve readability.
  • A couple of minor maintainability improvements in the test files.

Overall, excellent work on improving the parser's architecture.

Extract Jest parsing logic to shared/jstest package for reuse with Vitest
- shared/jstest: common module for describe/it/test pattern parsing
- vitest: distinguish from Jest by detecting 'vitest' import in file
- Vitest matches before Jest with higher priority

fix #5
@kubrickcode kubrickcode merged commit 314db19 into main Dec 3, 2025
1 check passed
@kubrickcode kubrickcode deleted the develop/shlee/5 branch December 3, 2025 15:03
@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.

vitest parsing feature

1 participant