Skip to content

feat: support rerun failed tests via f shortcut#456

Merged
9aoy merged 2 commits intomainfrom
rerun-failed-tests
Aug 8, 2025
Merged

feat: support rerun failed tests via f shortcut#456
9aoy merged 2 commits intomainfrom
rerun-failed-tests

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Aug 8, 2025

Summary

support rerun only failed tests via f 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 8, 2025 06:38
@netlify
Copy link
Copy Markdown

netlify bot commented Aug 8, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit c5163f3
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/68959cd1306f3800085da3b3
😎 Deploy Preview https://deploy-preview-456--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 implements a new CLI shortcut feature that allows users to rerun only failed tests by pressing f during watch mode. The feature provides a quick way to focus on fixing failing tests without re-running the entire test suite.

  • Adds a new f CLI shortcut for rerunning failed tests
  • Implements file filtering to only build and run tests that previously failed
  • Adds build hash tracking to optimize rebuild performance for filtered test runs

Reviewed Changes

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

File Description
packages/core/src/core/runTests.ts Adds failed test tracking, implements runFailedTests function, and integrates with CLI shortcuts
packages/core/src/core/rsbuild.ts Extends getRsbuildStats to support file filtering and adds build hash tracking
packages/core/src/core/cliShortcuts.ts Registers the new f shortcut for rerunning failed tests

totalTime: testTime + buildTime,
buildTime,
totalTime: testTime + currentBuildTime,
buildTime: currentBuildTime,
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

[nitpick] The logic for determining currentBuildTime could be clearer. Consider renaming the variable to actualBuildTime or adding a comment explaining that build time is set to 0 when the hash hasn't changed (indicating no rebuild occurred).

Copilot uses AI. Check for mistakes.
} else if (sourceEntries[entry]) {
if (
fileFilters?.length &&
!fileFilters.includes(sourceEntries[entry])
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

The file filtering logic iterates through all entries and uses includes() which has O(n) complexity for each check. For better performance with large numbers of failed tests, consider converting fileFilters to a Set for O(1) lookup time.

Suggested change
!fileFilters.includes(sourceEntries[entry])
fileFiltersSet &&
!fileFiltersSet.has(sourceEntries[entry])

Copilot uses AI. Check for mistakes.
@9aoy 9aoy merged commit 6c44a96 into main Aug 8, 2025
16 checks passed
@9aoy 9aoy deleted the rerun-failed-tests branch August 8, 2025 07:14
@9aoy 9aoy mentioned this pull request Aug 8, 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