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

Improve not error messages #101

Closed
sindresorhus opened this issue Jun 21, 2018 · 9 comments · Fixed by #130
Closed

Improve not error messages #101

sindresorhus opened this issue Jun 21, 2018 · 9 comments · Fixed by #130
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Milestone

Comments

@sindresorhus
Copy link
Owner

sindresorhus commented Jun 21, 2018

Issuehunt badges

Right now we just prefix them with [NOT], but this is not very nice.


IssueHunt Summary

alexnoz alexnoz has been rewarded.

Backers (Total: $60.00)

Submitted pull Requests


Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

@SamVerschueren
Copy link
Collaborator

From #71 (comment)

When I started implementing not, I was thinking about rephrasing messages automatically. I thought, If I always use to be, we could change that to not be. But then I had error messages where I couldn't use to be. So if we want clean messages for not, we might want to add an invertedMessage property to the validation object.

@sindresorhus
Copy link
Owner Author

sindresorhus commented Jun 21, 2018

I think we can automate most of it by creating helpers for the most common cases, like to be, and support an invertedMessage option for the few cases we can't automate.


Expected bar to be of type string but received type number

Could be automated to something like:

expectToBeOfType('bar', 'string', 'number');

@SamVerschueren
Copy link
Collaborator

Good idea! I'll take a look when I find some time.

@erdahuja
Copy link

@SamVerschueren @sindresorhus Can you help getting me started here. i want to start my first OS contribution.

@sindresorhus sindresorhus added this to the 1.0.0 milestone Jan 10, 2019
@IssueHuntBot
Copy link

@issuehuntfest has funded $60.00 to this issue. See it on IssueHunt

@alexnoz
Copy link
Contributor

alexnoz commented Jan 28, 2019

AFAIU in almost all cases it's enough to just put not after the first to, like Expected 'value' to not be/have/match ..., and for the cases where this approach won't work, e.g. min/max length, we can add invertedMessage, right? If so, I'm halfway there 🙂

alexnoz pushed a commit to alexnoz/ow that referenced this issue Feb 2, 2019
alexnoz pushed a commit to alexnoz/ow that referenced this issue Feb 2, 2019
alexnoz pushed a commit to alexnoz/ow that referenced this issue Feb 2, 2019
@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 10, 2019
@kainiedziela
Copy link

Any further work being done on this issue? The proposed PR doesn't pass tests. I'm inclined to pick this up.

@alexnoz
Copy link
Contributor

alexnoz commented Jun 1, 2019

@kainiedziela the project's structure has changed since the PR was opened, so it's slightly outdated, I'll revisit the PR and update it tomorrow.

alexnoz pushed a commit to alexnoz/ow that referenced this issue Oct 21, 2019
@issuehunt-oss
Copy link

issuehunt-oss bot commented Nov 7, 2019

@sindresorhus has rewarded $54.00 to @alexnoz. See it on IssueHunt

  • 💰 Total deposit: $60.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $6.00

@issuehunt-oss issuehunt-oss bot added 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt and removed 💵 Funded on Issuehunt This issue has been funded on Issuehunt labels Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants