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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update: added empty error array check for false negative #13200
Update: added empty error array check for false negative #13200
Conversation
Interesting, I can confirm that test cases such as this one will indeed pass in the actual version: invalid: [
{
code: "some_valid_code_for_this_rule",
errors: []
}
] I think we should fix this.
RuleTester is public API, so this would be at least |
If we decide to fix RuleTester to fail on |
true, I will add check for this as well.
I think fix might be better cause of false results . |
Agreed that we should fix this. I would also support adding this as a semver-minor bug fix (or in our current major release cycle if this gets approved in time). Can we change the commit message to from |
428edef
to
a3360c6
Compare
@mdjermanovic I added check for |
This should be already caught when the tester compares the expected number with the number of actual errors, though it does make sense to check that explicitly. I don't have a strong opinion on this. |
I think we should keep that as the current one cause that will help more than just a message saying it can't be negative. |
Anything else is needed for this ? |
The change looks good in general, let's wait to see if it will get accepted before reviewing details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good change, but I do want to note that this is a breaking change (which is particularly concerning right after we just finished a major release). I would support landing this as a semver-minor bug fix, since I do think the current behavior is not intentional.
Sorry for the delay! |
@aladdin-add Can you confirm your concerns have been addressed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for the late, LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[X] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Currently in test files for rules and internal rules, if a valid test case in added to invalid test case and have
errors
set to an empty array, it simply passes the test which should be an error as it is false negative.Added a check for empty-ness of the array and it will throw error if the
errors
is empty arrayIs there anything you'd like reviewers to focus on?
Nonenot sure whether it is of type
Fix
orChore
cause I think it is addressing false negative of test cases. let me know 馃憤