I'm having a hard time getting meaningful failures in tests when I need to check things in a promise.
That's because most testing frameworks use throw
when an assertion fails, but those are absorbed by the then
of promises...
For example, in the following I'd like Mocha to tell me that 'hello'
isn't equal to 'world'
...
Promise.resolve(42).then(function() {
"hello".should.equal("world")
})
With Mocha we can officially return the promise, but this swallows completely the error and is thus much worse...
Note: I'm using mocha
and expect.js
(as I want to be compatible with IE8)