promise support for async before/after functions and tests #289

Open
jdc0589 opened this Issue Feb 18, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@jdc0589

jdc0589 commented Feb 18, 2014

Adding native support for promises in addition to the done() style callbacks for async before/after functions + tests would really improve the test writing/debugging experience for projects that depend on promises more so than node style callbacks. There are plenty of ways to make it work without native support, but nothing would beat it.

before/after functions:
In addition to signaling completion/failure of the before/after, it would be great if a promise returned from a before/after function that was rejected would cause the error passed to the reject handler to be logged to the console, and then fail every test in the immediate suite.

tests:
returning a promise from a test would simply signal test completion on resolution, or fail the test on rejection.

Has any of this been discussed or considered before?

@legomushroom

This comment has been minimized.

Show comment Hide comment
@legomushroom

legomushroom Dec 13, 2014

👍 for this. Seems native jasmine done promise doesn't work for now. How do you even test async code in jasmine 2.0 without it?

👍 for this. Seems native jasmine done promise doesn't work for now. How do you even test async code in jasmine 2.0 without it?

@jrsinclair

This comment has been minimized.

Show comment Hide comment
@jrsinclair

jrsinclair Feb 18, 2015

I'm seeing the same issues. Although done() should work in theory, it doesn't seem happy when used with the Bluebird promise library. Test execution just randomly stops mid-execution, but sometimes, for no apparent reason it works. Seems to be some kind of race condition going on.

I'm seeing the same issues. Although done() should work in theory, it doesn't seem happy when used with the Bluebird promise library. Test execution just randomly stops mid-execution, but sometimes, for no apparent reason it works. Seems to be some kind of race condition going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment