Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Clarify "thenable" #330

Closed
cowwoc opened this Issue · 6 comments

3 participants

@cowwoc

The documentation says that asynchronous tests can return a "thenable" but does not provide a code sample. It's not clear how this would work. Please provide some sample code as part of the documentation.

@briancavalier

@cjohansen can correct me if I'm wrong, but in this case, a "thenable" means any Promises/A+ compliant promise, such as those of when.js, Q, etc., or a "promise-like" object with a then method that is close enough in behavior to Promises/A+, such as jQuery Deferred.

Buster will detect that a test has returned a promise, and will only consider the test to be done when the promise fulfills or rejects, which (I think) will signify the outcome of the test (pass/fail).

Buster uses when.js internally, so it can handle most anything that resembles a thenable promise. As shown here, you can roll your own simple "promise-like" object for very simple cases. Or you can use a full promise implementation to create a promise and return it.

Hope that helps!

@cowwoc

I would recommend linking the word "thenable" to the last link you included.

@briancavalier

@cowwoc Good call

@cjohansen
Owner

Sounds good. @cowwoc where did you find the unlinked "thenable" reference?

@cowwoc

Go to http://docs.busterjs.org/en/latest/overview/ and search for "thenable".

@cjohansen
Owner

Done!

@cjohansen cjohansen closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.