-
-
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
Passing --onlyFailures
doesn't run failed tests only
#6470
Comments
The flag is intended for watch mode. I do agree it should probably work, though. And if not, we should throw when the flag is provided outside of watch mode. @rickhanlonii @thymikee thoughts? |
Sounds reasonable to make it work in regular runs too 👍 |
+1, nice feature to add |
I agree, I think this flag should work in a single run mode as well |
Agree that this would be very helpful in single-run mode to fit more workflows. |
Any news on that? |
I was surprised when this flag didn't work :( |
searching for same issue, |
Many 3rd parties introduce verbose output which sometimes we use with Jest, making this flag work will make the output of Jest much more clear and helpful to debug. This is a big thing. |
I was looking for a way to run only the failed tests and ended up here 😄 |
This is what we end up using so far: npx jest --runInBand --ci --testNamePattern="$(python -c "from xml.dom import minidom;import re;print('|'.join([i.parentNode.attributes['name'].value.strip() for i in minidom.parse('junit.xml').getElementsByTagName('failure')]))")" This requires jest-junit reports to be installed and configured, and python for parsing XML. |
Is it time to consider removing this flag, if it hasn't worked in at least 26 months? |
@SimenB May I give this a try? |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
Passing
--onlyFailures
doesn't run failed tests only.To Reproduce
./node_modules/jest/bin/jest.js
=> 1 passed, 1 failed as expected../node_modules/jest/bin/jest.js --onlyFailures
. Unexpectedly, all tests are run again.Expected behavior
A single failed test is rerun.
Link to repl or repo (highly encouraged)
https://repl.it/@sergey_simonchik/rerun-failed-tests
Run
npx envinfo --preset jest
The text was updated successfully, but these errors were encountered: