-
-
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
Fix --onlyfailures flag to work in non-watch mode #10678
Conversation
This is ready for review @SimenB . Thanks! |
be5fcc0
to
0412466
Compare
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.
Thanks! This looks really good.
The only thing I think is missing is an integration test. A test that:
- runs some tests where one fail (but one or more passes)
- runs jest again with
--onlyFailures
and verify that only one test triggered (and it failed) - make a change that fixes said test
- runs jest again with
--onlyFailures
passed - still only that test should run, but this this it should pass - run jest yet again with
--onlyFailures
passed and it should run no tests printing the warning
newOptions.onlyChanged = newOptions.watch; | ||
newOptions.onlyFailures = newOptions.watch; |
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.
this is a change in behavior for the watch
flag, but I like it
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.
hmm, coming back to this, I don't 😅 If I run in watch mode I want to run all tests I specify, not just the ones that failed last time (unless I opt in to this behavior)
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.
When I said I liked it, what I thought at the time this did was, that in addition to running the specified files, we'll run any failing tests. But that's not what this does
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.
There is no way to opt out of this behaviour without using the command line Press f
as far as I can tell. It's broken running jest in watch mode in webstorm as you cannot interact with the CLI. This behaviour is a pain.
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.
@domarmstrong reverted in #10692, will make a new release once #10690 is solved
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.
Brilliant thanks for the info 👍
1c1d40e
to
4ad6f9f
Compare
4ad6f9f
to
2b3630b
Compare
@SimenB I've added the integration test |
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.
Thanks! This is a great contribution 👍
@SimenB has this been released in stable release? Cannot get it to work |
It was released in 26.6.1. If it doesn't work, please open up a new issue |
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. |
Fixes #6470 .
Previously, upon passing the
--onlyFailures
flag in non-watch mode, all the tests were run instead of just the failed tests.This PR fixes the bug. Now, the
--onlyFailures
flag will work as expected in non-watch mode.