
I was reviewing some codes using ava and found this pattern repeating often:
try {
await request(requestOptions);
} catch (error) {
t.true(error.statusCode === 500);
}
This can be written instead as:
const error = await t.throws(request(requestOptions));
t.true(error.statusCode === 500);
I think the latter should be preferred.
IssueHunt Summary
Backers (Total: $82.00)
Submitted pull Requests
Tips
I was reviewing some codes using ava and found this pattern repeating often:
This can be written instead as:
I think the latter should be preferred.
IssueHunt Summary
Backers (Total: $82.00)
Submitted pull Requests
requestandoptionstobeforeErrorhook stateTips