-
Notifications
You must be signed in to change notification settings - Fork 535
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
Enable timeout ensureSynchronized everywhere (Solution #1) #12278
Conversation
4c8960c
to
2f77477
Compare
Timeouts usually do not work :) Is the reason to add them - aid in debuggability where it's hard to figure out for developers why tests hang? Anything we can do to improve it without using timeouts? Like maybe mocha has some facility to run code when test fails and for code like that to provide extra info for easier debugging? |
@vladsud yes, the purpose is to aid in debuggability so that they know where it hangs. mocha test has timeout, but when it does, it only kill the test and show a generic timeout message. It doesn't give you any idea where it hangs, especially around promises. With this, we will have the stack and a message at least. @anthony-murphy added the timeout concept for promises used in test, and I am just follow the same pattern here, not inventing something new. I don't know if he has other alternatives. I did a quick search and didn't see any mocha functionality to trap (near) timeout and kill the test. We can implement our own "test" timeout mechanism that and have our Promise reject when we reach the test timeout overall, but that is similar idea to what we have here as well. I understand timeout can be unreliable generally, and abort the promise wait on test timeout would be better. Barring we found an alternative mechanism get mocha notifying before timing out , I think this way works most of the time and probably good enough for test purpose at the moment? |
@vladsud @anthony-murphy I did an alternative change. Please look at #12303, which instead of estimating using a half the timeout. #12303 will trap test run and calculate how long until the test would timeout and set the duration for promise wait until just before the test timeout. |
Closing in favor of #12303 |
Provide the mocha test timeout
LoaderContainerTracker
to limit how long to wait forensureSynchronized
. Currently it is set to half of test time. The purpose is to provide a better error message and stack ifensureSynchronized
got stuck.Also, change the behavior for
timeoutPromise
, when duration is <=0 or Infinity. Instead of waiting for the default amount, it will now mean it won't timeout at all. This is so that we can avoid timeout when debugging.Fix AB#2175