avajs/eslint-plugin-ava

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Prevent specifying error type in `t.notThrows()` #178

sindresorhus posted onGitHub

It's an easy mistake to make if you have many t.throws() statements and then some t.notThrows() statements.

For example: https://github.com/sindresorhus/p-queue/commit/80e8e25926a6632d0429ebb526ee78a68f01d565

// Fail
t.notThrows(() => {
 t.pass();
}, TypeError);

// Ok
t.notThrows(() => {
 t.pass();
});

It should fail if it's a variable matching this regex: /^(?:[A-Z][a-z0-9]*)*Error$/


@novemberborn In AVA, I think we should assert it's a string or undefined at runtime. What do you think?

posted by sindresorhus over 7 years ago
posted by novemberborn over 7 years ago

@issuehunt has funded $60.00 to this issue.


posted by IssueHuntBot almost 6 years ago

@sindresorhus @novemberborn I tried to give it a shot please review and guide further. #240

posted by gurrrung almost 6 years ago

Fund this Issue

$60.00
Funded
Only logged in users can fund an issue

Pull requests

Recent activities

gmartigny submitted an output to  avajs/ eslint-plugin-ava# 178
almost 4 years ago
gurungrahul2 submitted an output to  avajs/ eslint-plugin-ava# 178
almost 6 years ago