-
Notifications
You must be signed in to change notification settings - Fork 149
fix(prefer-screen-queries): false positives when using within method #119
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
fix(prefer-screen-queries): false positives when using within method #119
Conversation
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.
Hey Gonzalo, thanks for your PR!
The implementation and tests seem fine. You are right about the other scenario: it should cover destructuring queries from within
too. I think it should be addressed here, so take your time to investigate that. There are similar behaviors around the plugin code, you can probably spot how to do something similar in other rules! If you struggle with this, let me know so I can guide you to proper way of checking that.
Additionally, there is something weird in your branch. Commits are from "unknown", and it's causing issues as travis-ci stopping pipelines because it's not secure or something. Could you take a look at that?
sure, I will take a look. I will fix that problem about my user (probably a git config error 🤔 ) and I will try to address the destructuring scenario during the week. Thanks for the feedback! |
58fa568
to
ba73d0f
Compare
Fixed the author issue 😁 edit: Now that my email is properly set I'm getting the CI errors - I Will fix it. I will increase the coverage |
ba73d0f
to
d2274f6
Compare
Pushed an update the following scenario should now work
the only pending scenario is
and after that, the PR should be ready |
@gndelia Awesome, nice work! We are about to release a migration to TypeScript tho, maybe you prefer to wait until that's released to keep working on it. Just FYI. |
thanks! I see. I will rebase my work once that one is released - I have experience working with TS so it should be straightforward to adapt my changes to it. thanks for the FYI |
TS version of the package moved. Let us know if you need help rebasing your changes or adapting the code to TS! |
thank you! I will try to do it during the week, worst-case scenario in the weekend. |
5441e71
to
d6d2392
Compare
I added that last case - PR is ready! My only doubt is that coverage is failing and I am not sure why. It states that this line is not being covered in the tests, but that does not make sense, as the following line is... any ideas? Thanks! |
Our current coverage check it's too picky, isn't it? I'd like to migrate from forced 100% coverage threshold form jest to codecov checking the current coverage isn't decreased. Meanwhile, I'm afraid we need to try to cover that line. I'll try to check it later. However, the PR itself is looking fine so far! I'll try to do deeper review later too. Thanks. |
Btw I still see all the pipeline executions from this PR as "abuse detected" on travis: https://travis-ci.org/github/testing-library/eslint-plugin-testing-library/requests This is the first time I see something like that. |
a96746d
to
d0c4bed
Compare
really not sure what's that about 🤷 I sent an email to travis support to see if they can help. As of the build, here's a screenshot of the coverage as you can see, line 69 does not seem covered, though I don't know why 😞 |
d0c4bed
to
a17239c
Compare
after talking with Travis support, the builds fail normally and my account does not appear as "abuse detected" anymore 😄 now I need to figure out why that line appear as not tested in coverage lol |
@gndelia Cool, I see the CI working fine now! I hope I can check the coverage threshold soon, I'll let you know when I find something. |
a17239c
to
f97f691
Compare
I see, thanks for checking ! my first thought was about that else, but I thought the following scenario const [myVariable] = render()
myVariable.getByText(baz) was verifying it. Now I see it doesn't. I added another test, perhaps not so valid as const [myVariable] = within()
myVariable.${queryMethod}(baz) I'd rather keep the coverage for the rules as the maximum, as it's reading all kinds of code, so at least we should cover a wide variety of examples. Having said that, if you still consider the threshold should be lowered, I can just do a separated PR, no problem 😃 the PR now should be ready, the build passed 🎉 |
That's even better! Thank you so much for your effort. Approving and merging 🚀 |
🎉 This PR is included in version 3.1.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@all-contributors please add @gndelia for code, tests and doc |
I've put up a pull request to add @gndelia! 🎉 |
I am pretty new to writing/fixing ESlint rules, so I might be doing something wrong 😄
This should fix #116 so this code
should now be valid
I think this scenario is still pending
perhaps I could do another PR for that one. I am still new to AST so there's probably a better way to do this one.
Thank you very much!