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

An option to call "simultaneous" handlers in reverse order #24

Closed
rpominov opened this issue Aug 27, 2015 · 1 comment
Closed

An option to call "simultaneous" handlers in reverse order #24

rpominov opened this issue Aug 27, 2015 · 1 comment

Comments

@rpominov
Copy link

Currently when two handlers set to be called at the same time, lolex guarantees that they will be called in the order they were set.

For example in the following setup foo is always called first:

setTimeout(foo, 1000);
setTimeout(bar, 1000);

Although this is not guaranteed by the real implementations of setTimeout and friends:

So while tests may pass, the code might fail in real life.

I suggest to add an option to clock.tick(ms[, shouldRunSimultaneousHandlersInReversOrder]) as an API for test writers who want to test against this problem. The option basically will affect these lines (maybe only last two ifs), I think.


More context: https://github.com/rpominov/kefir/issues/134 https://github.com/rpominov/kefir/pull/135
cc @agentme

@fatso83
Copy link
Contributor

fatso83 commented Mar 7, 2016

This feature request is very unlikely to be prioritized by us, so I am closing this, but you could submit a PR. The API might have to be discussed a bit though, but that's just details.

@fatso83 fatso83 closed this as completed Mar 7, 2016
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