busterjs/referee — pull request #9 by johlrogge (2013-02-24 21:03:09+00:00)
Title: raw asserts and assertions can return promises

All asserts expose a raw assert (that doesn't emit events etc, just return a promise that is rejected or resolved depending on the outcome of the assert).

Since raw asserts return a promise to communicate it's outcome I made it possible for an assert function to return a promise as an alternative to just `true` or `false`. This opens up for asynchronous asserts but a deferred resolution will not work ATM for integrators that rely on exceptions to be thrown as failures.

The current tests for failure in test-helper spy on `referee.fail`. This makes things a bit harder than if they would just look for emission of fail, error or pass. If calling of fail was not part of the contract one could make have more elegant handling of exceptions for failures.

Don't be afraid to hurt my feelings codewise. I think the rawAssert could be more elegant in supporting promises from assert-function but my imagination failed me at the moment.