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

Support promises in tests and setup / teardown #536

Closed
rluba opened this issue Feb 27, 2016 · 2 comments
Closed

Support promises in tests and setup / teardown #536

rluba opened this issue Feb 27, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@rluba
Copy link
Contributor

@rluba rluba commented Feb 27, 2016

I know that this had been done in #342 and undone in #419 due to the complexity and overhead — but I believe that it can be implemented far simpler than #342 and without a performance penalty for those that don’t want to use promises.

It would remove a lot of error-prone boilerplate code for those of us that do want to use promises.

Currently, I have to write:

it('some test', (done) => {

    someAsyncCode()
        .then(() => {
             someAssertion();
             done();
        })
        .catch(done);
});

instead of just

it('some test', () => {

    return someAsyncCode()
        .then(() => {
             someAssertion();
        });
});

If you are open to supporting the latter, I can provide a PR that will add this feature.

@Marsup

This comment has been minimized.

Copy link
Member

@Marsup Marsup commented Feb 27, 2016

👍 I also think this doesn't need to be that complex but since I don't have time to pick it up, you should, @geek seems open to that.

@Marsup Marsup added the request label Feb 27, 2016
@rluba

This comment has been minimized.

Copy link
Contributor Author

@rluba rluba commented Feb 27, 2016

Here you go!

@geek geek added feature and removed request labels Feb 28, 2016
@geek geek added this to the 10.1.0 milestone Feb 28, 2016
@geek geek self-assigned this Feb 28, 2016
@geek geek closed this Feb 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.