Skip to content

feat: support filter test by full test name#916

Merged
9aoy merged 2 commits intomainfrom
filter-test-with-suite-name
Jan 28, 2026
Merged

feat: support filter test by full test name#916
9aoy merged 2 commits intomainfrom
filter-test-with-suite-name

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Jan 28, 2026

Summary

support filter test by full test name.

image

Related Links

#911

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @9aoy, 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 feature that allows users to filter tests by their full name, providing more control over which tests are executed. It modifies the core testing logic to support this filtering and updates the documentation to explain the new functionality.

Highlights

  • Test Filtering: Introduces the ability to filter tests by their full name, enhancing precision in test execution.
  • Code Modifications: Updates task.ts and helper.ts to correctly handle test name filtering with the suite name delimiter.
  • Documentation: Expands documentation on test filtering, detailing keyword matching, full test name matching, and regular expression matching.
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
Copy Markdown
Contributor

@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 feature to filter tests by their full name, using > as a delimiter between suite and test names. This is a great addition for more precise test selection. The changes include new e2e tests to verify this functionality and updated documentation in both English and Chinese.

My main feedback is on the implementation of the filtering logic in packages/core/src/runtime/runner/task.ts. The current approach uses a heuristic to decide which name format to match against, which can be brittle. I've suggested a more robust implementation that checks against both space-separated and >-separated full names, which should make the feature more reliable.

Comment on lines +45 to 54
const delimiter = testNamePattern?.toString().includes(TEST_DELIMITER)
? TEST_DELIMITER
: '';

if (
testNamePattern &&
!getTaskNameWithPrefix(test, '').match(testNamePattern)
!getTaskNameWithPrefix(test, delimiter).match(testNamePattern)
) {
return true;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The current logic for determining which delimiter to use for constructing the test name is based on a heuristic (checking if testNamePattern contains >). This can be brittle. For example, if a test or suite name itself contains a > character, and a user tries to match it with a regex, the filtering might not work as expected.

A more robust approach would be to check the pattern against both possible full name formats (one with spaces, and one with >). This removes the need for the heuristic and makes the filtering more reliable and predictable.

  if (testNamePattern) {
    // Check against space-separated name for keyword matching.
    const nameWithSpaces = getTaskNameWithPrefix(test, '');
    if (nameWithSpaces.match(testNamePattern)) {
      return false;
    }

    // Check against `>`-separated name for full name matching.
    const nameWithDelimiter = getTaskNameWithPrefix(test, TEST_DELIMITER);
    if (nameWithDelimiter.match(testNamePattern)) {
      return false;
    }

    return true;
  }

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying rstest with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5fe4ffa
Status: ✅  Deploy successful!
Preview URL: https://1ed905fb.rstest.pages.dev
Branch Preview URL: https://filter-test-with-suite-name.rstest.pages.dev

View logs

Copy link
Copy Markdown
Member

@fi3ework fi3ework left a comment

Choose a reason for hiding this comment

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

what if a test case contains >, e.g. expect('var a > b + c')

@fi3ework
Copy link
Copy Markdown
Member

tbh i like this feature, even not for agent. i often directly copy and paste the full name and hope to run it with -t.

@9aoy
Copy link
Copy Markdown
Collaborator Author

9aoy commented Jan 28, 2026

what if a test case contains >, e.g. expect('var a > b + c')

At the moment, we can’t distinguish whether > comes from the test case itself or from Rstest’s name separator. Supporting a user custom delimiter could be a better way to avoid this ambiguity.

@9aoy 9aoy merged commit 491c2f3 into main Jan 28, 2026
10 checks passed
@9aoy 9aoy deleted the filter-test-with-suite-name branch January 28, 2026 10:29
@fi3ework fi3ework mentioned this pull request Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants