-
-
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
feat: add a waitBeforeRetry option to jest.retryTimes (#14737) #14738
Conversation
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
4db36ca
to
f1464f0
Compare
3792d3d
to
0f0f7e1
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! in addition to my inline question, could you update the changelog?
@@ -102,6 +106,10 @@ const _runTestsForDescribeBlock = async ( | |||
// Clear errors so retries occur | |||
await dispatch({name: 'test_retry', test}); | |||
|
|||
if (waitBeforeRetry > 0) { | |||
await new Promise(resolve => setTimeout(resolve, waitBeforeRetry)); |
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.
does this setTimeout
work if fake timers are active? This code runs within the sandbox of user code, so we have to for instance make sure Date.now
is the real one:
jest/scripts/babel-plugin-jest-native-globals.js
Lines 20 to 22 in 6ead171
const nowDeclaration = template(` | |
var jestNow = globalThis[Symbol.for('jest-native-now')] || globalThis.Date.now; | |
`); |
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.
does using const {setTimeout} = globalThis;
solve this?
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.
Yeah, that should work
b001602
to
3707c1a
Compare
Wait, CI seems unhappy |
119e6a5
to
d099675
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 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
Fixes #14737 adding a new option
waitBeforeRetry
to jest.retryTimesTest plan
The tests have been updated.