Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sindresorhus opened this issue Sep 12, 2017 · 4 comments · May be fixed by #326
Open

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

sindresorhus opened this issue Sep 12, 2017 · 4 comments · May be fixed by #326
Labels
💵 Funded on Issuehunt This issue has been funded on Issuehunt enhancement help wanted

Comments

@sindresorhus
Copy link
Member

sindresorhus commented Sep 12, 2017

Issuehunt badges

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

For example: sindresorhus/p-queue@80e8e25

// 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$/


IssueHunt Summary

Backers (Total: $60.00)

Submitted pull Requests


Become a backer now!

Or submit a pull request to get the deposits!

Tips

@sindresorhus
Copy link
Member Author

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

@novemberborn
Copy link
Member

@sindresorhus avajs/ava#1125

@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 2, 2019
@IssueHuntBot
Copy link

@IssueHunt has funded $60.00 to this issue.


@rahgurung
Copy link
Contributor

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

@GMartigny GMartigny linked a pull request Mar 24, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💵 Funded on Issuehunt This issue has been funded on Issuehunt enhancement help wanted
Projects
None yet
4 participants