Skip to content
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

Incompatible with Lolex #23

Closed
timdp opened this issue Jun 12, 2016 · 4 comments
Closed

Incompatible with Lolex #23

timdp opened this issue Jun 12, 2016 · 4 comments

Comments

@timdp
Copy link

timdp commented Jun 12, 2016

First of all, I'm not sure if this is an issue with Bottleneck or Lolex (used by Sinon to stub setTimeout and friends, usually to speed up tests).

If I install Lolex and then use Bottleneck to schedule two asynchronous operations, only the first of them will execute; the other one will stay pending. Internally, Bottleneck uses setTimeout to schedule, so it looks to me like there's a callback that's not getting executed.

I've created a minimal working example. The same thing happens if I use submit with a callback instead of schedule with a Promise, a well as with Bluebird instead of the native Promise object. Also, the version of Node doesn't seem to matter. Finally, I'm on Windows, but I sure hope that's not the cause.

I've tried to dig into the Bottleneck code but wasn't able to come up with anything useful. I did notice that there's only one clearTimeout and it doesn't get called when I run my example.

Thanks!

@timdp
Copy link
Author

timdp commented Jun 12, 2016

Actually, if I replace Lolex with my own implementation, it works. I'm going to file an issue with Lolex instead. Closing this.

@tjenkinson
Copy link
Contributor

I've only glanced at this but won't this never run because it requires a tick first?

https://github.com/timdp/bottleneck-lolex-issue-demo/blob/lolex-mock/index.js#L27

On 12 Jun 2016, at 19:01, Tim De Pauw notifications@github.com wrote:

Actually, if I replace Lolex with my own implementation, it works. I'm going to file an issue with Lolex instead. Closing this.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@timdp
Copy link
Author

timdp commented Jun 12, 2016

@tjenkinson Not with my mock implementation, which only touches setTimeout, not setInterval.

@tjenkinson
Copy link
Contributor

Cool ok 👍

On 12 Jun 2016, at 19:39, Tim De Pauw notifications@github.com wrote:

@tjenkinson Not with my mock implementation, which only touches setTimeout, not setInterval.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants