Keep a private reference to Process.clock_gettime#18
Conversation
`timeout 0.3.0` broke our test suite because we have some tests that stubs `Process.clock_gettime` making it return a value in the past, causing `Timeout` to trigger almost immediately. I beleive it wasn't a problem before because it was relying on `Process.sleep`.
07e5d86 to
171eef4
Compare
|
The fix seems reasonable. |
|
Note that I said Timecop, but it actually doesn't do it (travisjeffery/timecop#220), it was a "manual" mocha stub.
Well, as long as some code
These tests are old, and AFAIK that's the first time they break. But yes, we could probably also cleanup our code and have a small indirection we could stub instead. If you're unconfortable with this change, I'm fine with closing. I mostly thought it was worthy of discussion, not necessarily of merging. |
|
drawback of this is that if someone wants to stub |
timeout 0.3.0broke our test suite because we have some tests that stubsProcess.clock_gettimemaking it return a value in the past, causingTimeoutto trigger almost immediately.I believe it wasn't a problem before because it was relying on
Process.sleep.cc @eregon what do you think? I agree this one is debatable, as if you are messing with time primitive you're on your own, but it's a common thing to do in tests suites with tools such as
Timecop.