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

Promise-based async interface #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mikeapr4
Copy link

Code to resolve #105

For the moment the change only applies to it, though Jest/Mocha allows it on the before/after hooks too, so that might be some future work.

The check for a returned Promise matches what Mocha does:
https://github.com/mochajs/mocha/blob/master/lib/runnable.js#L373

Nothing in this code actually requires the Promise class be available, means the code is compatible with pre-v0.12.18 node, although hardly a requirement to go back that far.

I've updated some tests, though more for illustrative purposes, as those tests will not fail if async doesn't work. I've updated the docs too so users know they can use both the done and Promise interfaces.

@mikeapr4
Copy link
Author

Can somebody take a look at this? @mthuret? @therealparmesh? I know this repo hasn't seen a lot of recent activity, but I think you'll find this PR is ready to merge.

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

Successfully merging this pull request may close these issues.

Promise asynchronous interface
1 participant