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

[valid-expect]: Make number of args allowed by a "valid" expect configurable #391

Closed
G-Rath opened this issue Aug 13, 2019 · 4 comments · Fixed by #584
Closed

[valid-expect]: Make number of args allowed by a "valid" expect configurable #391

G-Rath opened this issue Aug 13, 2019 · 4 comments · Fixed by #584

Comments

@G-Rath
Copy link
Collaborator

G-Rath commented Aug 13, 2019

Currently we only consider an expect valid if it has a single argument - otherwise we report that it has multiple arguments and thus is invalid.

While this is true for vanilla jest, it's possible to modify expect to be valid w/ more than one argument, such as via jest-expect-message.

Hence, we should make this a configurable option.

@G-Rath G-Rath self-assigned this Aug 13, 2019
@G-Rath
Copy link
Collaborator Author

G-Rath commented Aug 13, 2019

I'll do this in a few hours when I'm off work :)

It'll just be something like "maxArgs" that takes a number.

@SimenB do you know of any other libraries that modify the number of arguments expect can take?

In particular, I'm interested in if there are any that add required arguments (I'd imagine not, but I've not explored the jest ecosystem much).

@erkenberg
Copy link

We stumbled over this issue when adding eslint-plugin-jest to our project.

As valid-expect has more useful check than just the "only 1 argument allowed" we would like to keep it, but have the issue that in several places we use jest-expect-message plugin for an additional message.
Currently we just manually disable the valid-expect rule in those places.

Is ist still planned to add this configurability? Would be awesome :)

@SimenB
Copy link
Member

SimenB commented Feb 11, 2020

A PR would be most welcome 👍

@github-actions
Copy link

🎉 This issue has been resolved in version 23.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants