Closed
Description
Description
The output for a failed t.throws()
assertion should be clearer when the actual and expected constructors do not match.
Currently, it simply says that there was an unexpected exception and shows the error object. It is not immediately clear at first glance that the constructor is what caused the assertion to fail.
Test Source
const foo = async () => {
throw new TypeError('Uh oh');
};
test('foo() does stuff', async (t) => {
await t.throws(foo(), RangeError);
});
Output
Threw unexpected exception:
TypeError {
message: 'Uh oh',
}
Environment
Node 8.1.4
npm 5.3.0
ava 0.21.0
darwin 16.6.0