Skip to content

feat: support filter test name regex pattern via t shortcut#462

Merged
9aoy merged 3 commits intomainfrom
runWithTestNamePattern
Aug 11, 2025
Merged

feat: support filter test name regex pattern via t shortcut#462
9aoy merged 3 commits intomainfrom
runWithTestNamePattern

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Aug 11, 2025

Summary

support filter test name regex pattern via t shortcut.

image

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings August 11, 2025 08:30
@netlify
Copy link
Copy Markdown

netlify bot commented Aug 11, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 925987b
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/6899ac94ff46330008acf423
😎 Deploy Preview https://deploy-preview-462--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for filtering tests by name using a regex pattern through a new t keyboard shortcut in the CLI. This enhancement allows developers to interactively filter tests during watch mode without restarting the test runner.

Key changes:

  • Adds t shortcut to prompt for test name pattern input
  • Updates pool methods to accept context parameter for runtime configuration
  • Implements interactive pattern input with real-time feedback

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
website/docs/zh/guide/basic/cli.mdx Updates Chinese documentation to include the new t shortcut
website/docs/en/guide/basic/cli.mdx Updates English documentation to include the new t shortcut
packages/core/src/pool/index.ts Modifies pool methods to accept context parameter and moves runtime config generation
packages/core/src/core/runTests.ts Adds runWithTestNamePattern function and passes context to pool methods
packages/core/src/core/listTests.ts Passes context parameter to pool's collectTests method
packages/core/src/core/cliShortcuts.ts Implements interactive test name pattern filtering with t shortcut

try {
process.stdin.setRawMode(false);
process.stdin.pause();
} catch {}
Copy link

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

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

The empty catch block silently ignores all errors when setting raw mode to false. Consider logging the error or handling specific expected exceptions to avoid masking unexpected issues.

Suggested change
} catch {}
} catch (err) {
logger.error('Error disabling raw mode or pausing stdin:', err);
}

Copilot uses AI. Check for mistakes.
for (const shortcut of shortcuts) {
if (str === shortcut.key) {
shortcut.action();
void shortcut.action();
Copy link

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

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

Using void to ignore the promise returned by shortcut.action() could mask errors. Consider adding error handling for async shortcut actions to ensure failures are properly logged or handled.

Suggested change
void shortcut.action();
const result = shortcut.action();
if (result instanceof Promise) {
result.catch((err) => {
logger.error('Error executing shortcut action:', err);
});
}

Copilot uses AI. Check for mistakes.
@9aoy 9aoy merged commit 8a76dbe into main Aug 11, 2025
16 checks passed
@9aoy 9aoy deleted the runWithTestNamePattern branch August 11, 2025 08:59
@9aoy 9aoy mentioned this pull request Aug 15, 2025
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