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 doesn't recognize the second parameter of expect #503

Closed
fregante opened this issue Aug 13, 2024 · 3 comments · Fixed by #518
Closed

valid-expect doesn't recognize the second parameter of expect #503

fregante opened this issue Aug 13, 2024 · 3 comments · Fixed by #518

Comments

@fregante
Copy link

I have this line of code and valid-expect says it's invalid:

expect(fs.existsSync(filePath), `New feature name "${newName}" not found in source/features`).toBe(true);

You can see that it actually works and that it appears in the types, added in 2022.

Here's a simple version:

expect(false, 'CUSTOM ERROR').toBe(true);
@veritem
Copy link
Member

veritem commented Aug 14, 2024

@fregante valid-expect requires setup maximum args when you use more than one argument. refer to this

options: [{ maxArgs: 2 }]

@veritem veritem closed this as completed Aug 14, 2024
@fregante
Copy link
Author

fregante commented Aug 14, 2024

What's the point? expect(x, message) is valid, why is this rule not accepting it as valid as a default? If anything, specifying a better message should be the preferred version, not considered invalid by default.

@azu
Copy link
Contributor

azu commented Aug 26, 2024

I've created a PR to fix this issue.

This PR allow to use expect(value, "string literal").toBe(1) as exception of this rule.

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

Successfully merging a pull request may close this issue.

3 participants