-
Notifications
You must be signed in to change notification settings - Fork 40
fix(prefer-in-document): false positive on .toHaveLength(1) matcher with *AllBy* query #273
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
Conversation
hey sorry for the delay - would you mind rebasing this so that we've got the CI checks going? then I'll do a review |
…bination of *By* query with .toHaveLength(1) assertion
…cher with *AllBy* query
@G-Rath Sure, I have rebased it. |
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.
Looks good - got some minor changes I'd like made, and you also need to rebase again (sorry 😅) and get CI passing (you're missing a bit of coverage)
* screen.<query>() -> <query> | ||
*/ | ||
function getDTLQueryIdentifierNode(callExpressionNode) { | ||
if (!callExpressionNode || callExpressionNode.type !== "CallExpression") { |
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'm pretty sure we can use optional chaining here:
if (!callExpressionNode || callExpressionNode.type !== "CallExpression") { | |
if (callExpressionNode?.type !== "CallExpression") { |
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 applied the suggestion but it turned out that ESLint does not recognize optional chaining syntax in this project, so I undid the changes.
c429d77
to
e2e4291
Compare
All right, I've merged |
@SevenOutman if you're still interested in this, could you resolve the test failures? |
Sorry, I'm afraid I don't have enough mind bandwidth for this edit right now. |
Can I try taking over this pr? Or should I just create a new one? I really want to fix this. @G-Rath |
@EricKim987 go for it - I think it would be best to create a new PR though |
🎉 This issue has been resolved in version 5.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What:
Close #171
Why:
It's valid to use
.toHaveLength(1)
with*AllBy*
queries to check for "exactly one match".See conclusion of discussions at #171 (comment)
How:
Implement the truth table as described in the link above.
Checklist: