-
-
Notifications
You must be signed in to change notification settings - Fork 119
Add --last-failed functionality to rerun only failed tests #2472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Similar to pytest's --last-failed feature, this adds the ability to rerun only tests that failed in the previous run. This helps developers iterate faster when fixing failing tests. New CLI options: - --last-failed / --lf: Run only tests that failed in the previous run - --failed-last / --fl: Run all tests, but prioritize failed tests first - --clear-failed: Clear the failed test history Failed tests are stored in target/nextest/<profile>/<profile>-last-failed.json and are automatically updated after each test run. Tests that pass are removed from the failed list. This implementation: - Adds a new last_failed module in nextest-runner for data persistence - Integrates with the test execution flow to track failures - Uses the existing test filtering mechanism for --last-failed - Updates documentation to describe the new feature
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2472 +/- ##
==========================================
- Coverage 79.42% 79.38% -0.04%
==========================================
Files 107 108 +1
Lines 23964 24171 +207
==========================================
+ Hits 19033 19188 +155
- Misses 4931 4983 +52 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The integration tests were expecting specific output messages from the --last-failed, --clear-failed, and --last-failed with no history cases. Updated the messages to match test expectations.
82a7bdf
to
197ac74
Compare
Thank you for the contribution! This is definitely a feature I would like to add to nextest. However I would go about this in a more composable manner:
The goal is to use the event log not just for rerunning tests but also for replaying test runs, etc. I know it's more work, but would you be willing to do it? It would be really valuable. |
Actually I like passing in |
I do not really have capacity for this at this time but perhaps I can work on it a bit later. I'd love to see something like this at sometime though. I'd love bundling |
Warning: I made this with AI. If you think this is a good design, I can manually refactor the code to make it more readable.
Inspiration: https://x.com/mitsuhiko/status/1939105797448872265 mentions how LLMs perform better when they only need to rerun failed tests and there is not an easy way to do this in Rust.
Similar to pytest's --last-failed feature, this adds the ability to rerun only tests that failed in the previous run. This helps developers iterate faster when fixing failing tests.
New CLI options:
--last-failed
/--lf
: Run only tests that failed in the previous run--failed-last
/--fl
: Run all tests, but prioritize failed tests first--clear-failed
: Clear the failed test historyFailed tests are stored in target/nextest//-last-failed.json and are automatically updated after each test run. Tests that pass are removed from the failed list.
This implementation:
--last-failed