-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
add only-failures mode #4886
add only-failures mode #4886
Conversation
This is failing CI |
Can this be plugged in with the new approach introduced in #4841? /cc @wbinnssmith |
In the current form, the plugin system doesn't allow it. |
Codecov Report
@@ Coverage Diff @@
## master #4886 +/- ##
==========================================
- Coverage 60.74% 60.72% -0.02%
==========================================
Files 198 200 +2
Lines 6605 6638 +33
Branches 4 4
==========================================
+ Hits 4012 4031 +19
- Misses 2593 2607 +14
Continue to review full report at Codecov.
|
@wbinnssmith Thoughts on the comment above about this feature not being possible to implement with the pluggable watch mode? |
@@ -5,6 +5,7 @@ Array [ | |||
" | |||
Watch Usage | |||
› Press a to run all tests. | |||
› Press f to enable \\"only-failures\\" mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we phrase it in a way that is more similar to "to run only failed tests" so that we don't expose the "only-failures" keyword?
@@ -60,5 +61,9 @@ export default (globalConfig: GlobalConfig, options: Options): GlobalConfig => { | |||
newConfig.passWithNoTests = true; | |||
} | |||
|
|||
if ('onlyFailures' in options) { | |||
newConfig.onlyFailures = options.onlyFailures || false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to cast onlyFailures to boolean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did that because of Flow warning.
@@ -224,6 +229,12 @@ export default function watch( | |||
}); | |||
startRun(globalConfig); | |||
break; | |||
case KEYS.F: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should pressing C
also clear this filter?
@@ -130,7 +130,14 @@ async function jasmine2( | |||
}, | |||
}); | |||
|
|||
if (globalConfig.testNamePattern) { | |||
if (globalConfig.enabledTestsMap) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would this work with jest-circus
? cc: @aaronabramov @cpojer
return globalConfig; | ||
} | ||
// $FlowFixMe Object.assign | ||
const newConfig: GlobalConfig = Object.assign({}, globalConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be done through import updateGlobalConfig from './lib/update_global_config';
It would be really nice if we make plugins robust enough to support this as an independent plugin 😄 |
@lsentkiewicz thoughts on the feedback? This also needs a rebase |
@SimenB |
Signed-off-by: Łukasz Sentkiewicz <[email protected]> lint fixes Signed-off-by: Łukasz Sentkiewicz <[email protected]> fix tests Signed-off-by: Łukasz Sentkiewicz <[email protected]> fix tests Signed-off-by: Łukasz Sentkiewicz <[email protected]>
Signed-off-by: Łukasz Sentkiewicz <[email protected]>
Let's do it for Jest 22. @lsentkiewicz thanks so much for sending this PR and thanks to all the reviewers for getting this into a good shape. I still have concerns that this will make people unaware of tests that start failing while in this mode that won't be captured by this, and that may be confusing for people. I'm fine with this because I think it still speeds up the process of fixing a bunch of tests even if you have to run all tests once at the end and fix up other stuff. |
I share the same concern. I see how this can make fixing some bugs faster but I'm unsure if the benefit outweighs the risk of some failing tests going unnoticed. This mode can also increase the user's cognitive load. Since it re-tests only the originally failing tests, the user has to remember which tests were failing to know what was actually tested. After the tests pass it shows a text "No failed test found.". This can be misleading since there might actually be other failing tests. It would be more clear if after the tests have been fixed it would show the list of all the originally failing tests with a "PASS" label next to them. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Requested in #3634.
Solution:
When pressing
f
it re-runs only failed tests. Newly added tests are ignored.See demo http://take.ms/g4Oyt
There are flow issues and I will fix it later. Let me know your feedback.