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

completion: support promises #282

Merged
merged 1 commit into from
Oct 21, 2015
Merged

Conversation

LinusU
Copy link
Contributor

@LinusU LinusU commented Oct 19, 2015

This fixes #278

I had to rework the helper to support async tests since promises defer things to the next tick, and since I have to use nextTick as to not swallow any fatal errors and just never report them.

A promise polyfill is included as a **dev-**dependency and is used during the tests.

@bcoe
Copy link
Member

bcoe commented Oct 19, 2015

@LinusU this looks solid, I'll look a bit closer tonight when I'm not at work.

process.emit = function (ev, value) {
if (ev === 'uncaughtException') {
done()
cb(value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything wrong with changing this to cb(value, done()) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, didn't want it to also return the result thought. I don't think it's best practice to include both error and result, and with the move towards promises it won't be possible anymore.

@nexdrew
Copy link
Member

nexdrew commented Oct 19, 2015

LGTM 👍 Thanks, @LinusU!

@LinusU
Copy link
Contributor Author

LinusU commented Oct 19, 2015

No problems, happy to help!

bcoe added a commit that referenced this pull request Oct 21, 2015
@bcoe bcoe merged commit 197f541 into yargs:master Oct 21, 2015
@bcoe
Copy link
Member

bcoe commented Oct 21, 2015

@LinusU your work is published to yargs' next release candidate, give it a shot:

npm install yargs@next

Assuming we don't run into any issues, I'll promote the release tomorrow.

@LinusU
Copy link
Contributor Author

LinusU commented Oct 21, 2015

Super! Thanks \o/

@LinusU LinusU deleted the completion-promise branch October 21, 2015 06:15
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.

completion promise support
3 participants