tlewowski / zurvan

Zurvan fakes timers for your node.js tests.
MIT License
10 stars 4 forks source link

please provide better error description when advanceTime is interrupted #38

Closed PPiszcz closed 8 years ago

PPiszcz commented 8 years ago

in file TimeForwarder, function stopForwarding sth like the following would be nice ;)

TimeForwarder.prototype.stopForwarding = function() { var that = this; return new that.schedule.Promise(function(resolve, reject) { if(that.isExpiringEvents()) { return reject(new Error("Cannot release timers during event expiration. Currently at: << " + that.timeServer.currentTime.toMilliseconds() + " >> ms, target: << " + that.timeServer.targetTime.toMilliseconds() + " ms >>. Forwarding requested from: " + that.forwardingStartedSavedStack)); }

return resolve(); }); };

The faulty scenario was generated when advaceTime was in progress (but not returned as promise in test flow), then test ended and called releaseTimers.

tlewowski commented 8 years ago

Fixed in 21f8801