-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
Promise
support
#262
Comments
From #222 (comment):
The problem is that |
Why would wrapping be necessary ? We don’t need any of the capabilities of well behaved promises here. The success callback could even be called on the same tick and tests would still close properly. |
and if current tests return non-promise objects? Absolutely we do need them - those capabilities (including error-catching) are part of the guarantee of promises. If the success callback is called on the same tick than a previously set-up "next tick" operation might not fire, and the test would be invalid. |
Yeah I know about the guarantees promises offer but I think it's unlikely something too bad could happen here. Anyway, couldn't this behavior be namespaced under a new Doesn't |
This would make tape much more complicated. A promise-oriented test library should be a separate project. Tape is a callback-oriented project. I would much rather there were 2 projects focusing on separate, clear conceptions of what they are trying to be than a single monster of a project that mixes a bunch of ideas into an incoherent mess. |
@substack It's unfortunate to hold onto this callback based API, it seems to be the opposite of the direction the language is taking and its causing some weird issues. Anyway, thanks for taking the time to talk ! |
Time to move to promises? |
Would be great to support returning a promise to end the test when the promise is resolved.
tape
with Async Functions to transparently return a promise.to (assuming a function
delay
returning aPromise
resolved aftert
milliseconds)will preserve the expected order (see #222).
Looking at blue-tape it should be doable with something along the lines of
Note that it would not require a
Promise
library nor any configuration. Users wanting to take advantage of this feature would need to provide their ownPromise
implementation if necessary anyway.The text was updated successfully, but these errors were encountered: