-
-
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
Support error logging before jest retry #12201
Support error logging before jest retry #12201
Conversation
Hi @zackasaurus! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
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 for the PR! I like the idea.
can you update the documentation as well?
jest.retryTimes(3); | ||
jest.setLogTestErrorsBeforeRetry(true); |
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.
jest.retryTimes(3); | |
jest.setLogTestErrorsBeforeRetry(true); | |
jest.retryTimes(3, {logErrorsBeforeRetry: true});= |
I'd rather we just add an options bag to the existent call than adding a new method entirely
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.
Makes sense, I've updated it. Do we want to handle the Symbol differently as well? Right now, there is still an additional symbol for the logErrorsBeforeRetry
.
Codecov Report
@@ Coverage Diff @@
## main #12201 +/- ##
==========================================
- Coverage 66.93% 66.92% -0.02%
==========================================
Files 329 329
Lines 17344 17352 +8
Branches 5061 5063 +2
==========================================
+ Hits 11610 11612 +2
- Misses 5702 5708 +6
Partials 32 32
Continue to review full report at Codecov.
|
@zackasaurus ping 🙂 |
Hey @SimenB !
and have
|
I think we should just add something to the test result that allows the reporter to print some context, which the reporter can then print after the tests is done. I don't think the reporter needs to be told when it happens? So essentially, look at where circus currently handles the Makes sense? |
@SimenB I've yet to update the tests for this feature, but do the newest changes reflect your vision? I could only get the errors to show up correctly when using jest-serializer, so I'm passing an array of buffers to the reporter through the test result, and had to modify the |
@zackasaurus I need to re-process this PR, might be a few days. Gut feeling is that this solution is more complex than it needs to be, but I need to dig into it. I'll add it to the milestone so I don't forget 🙂 |
@zackasaurus I tweaked the logging a bit, thoughts? |
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'm happy with the current state of this 👍
Co-authored-by: Zachary Bogard <zbogard@microsoft.com>
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. |
Summary
Currently, to my knowledge Jest does not support logging errors before a retry event happens. This makes it difficult to debug why a test failed, especially if the code the test is testing is not deterministic (it will fail once, but will pass during the first retry), and thus no error will be visible as why it failed during the first time.
The need for visibility is a big driver here as I'd like to know if the reason that the retry occurred was due to a
Jest.setTimeout
error or an error that occurred in the test itself.Test plan
Visuals