Open jkrems opened 8 years ago
Great idea! :+1: from me, too. :-) Is its opposite already covered by the other wrapper library? Would be good to have both, IMO. On fre 6 nov. 2015 at 16:57 Jan Olaf Krems notifications@github.com wrote:
This is kind of blurring the lines between assertive and assertive-as-promised, but given async functions this is the only thing I keep "poly-filling". For everything else the normal assertive works perfectly fine:
function assertRejects(promise) { return promise.then(() => { throw new Error('Did not fail as expected'); }, error => error); } test('foo', async () => { const error = await assert.rejects(Promise.reject(new Error('My Error'))); assert.equal('My Error', error.message); });
— Reply to this email directly or view it on GitHub https://github.com/groupon/assertive/issues/24.
The opposite is already covered by await fnThatRejects()
, at least for test frameworks that support promises (e.g. mocha & tap).
This is kind of blurring the lines between
assertive
andassertive-as-promised
, but given async functions this is the only thing I keep "poly-filling". For everything else the normalassertive
works perfectly fine: