Skip to content

feat(prefer-find-by): report presence assertions - #450

Merged
Belco90 merged 11 commits into
testing-library:mainfrom
zaicevas:pr/find-by-presence-matchers
Aug 24, 2021
Merged

Belco90 merged 11 commits into
testing-library:mainfrom
zaicevas:pr/find-by-presence-matchers

Conversation

@zaicevas

@zaicevas zaicevas commented Aug 9, 2021

Copy link
Copy Markdown
Contributor

Checks

  • I have read the contributing guidelines.
  • If some rule is added/updated/removed, I've regenerated the rules list.
  • If some rule meta info is changed, I've regenerated the plugin shared configs.

Changes

  • Enhances prefer-find-by by reporting presence assertions

Context

Closes #420
Not gonna lie, took much more effort and AST parsing than I initially thought 😄

@Belco90

Belco90 commented Aug 11, 2021

Copy link
Copy Markdown
Member

@zaicevas oh wow, it seems complex indeed!

I'll try to take a look at the end of the week, thanks ✨

@Belco90 Belco90 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks great in general! I just requested an additional test.

The implementation to detect the waitFor + presence/absence assertion seems a bit brittle since it's too tight to a particular tree. But I guess this is what it is, right?

I'm surprised the auto-fix works for this new invalid usage reported 😮

Comment thread tests/lib/rules/prefer-find-by.test.ts Resolved
Comment thread lib/rules/prefer-find-by.ts Resolved
Comment thread lib/rules/prefer-find-by.ts Resolved
Comment thread lib/rules/prefer-find-by.ts Resolved
@zaicevas

Copy link
Copy Markdown
Contributor Author

The implementation to detect the waitFor + presence/absence assertion seems a bit brittle since it's too tight to a particular tree. But I guess this is what it is, right?

Yeah :S I guess one can't escape that.

I'm surprised the auto-fix works for this new invalid usage reported 😮

Yep, that's because it relies on a few variables (such as queryMethod, queryVariant) so it was enough to fill these properly.


I've noticed github actions are failing because of what seems to be unrelated reasons. Would you mind helping with that?

@Belco90 Belco90 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good from my side. Thanks again!

@Belco90
Belco90 merged commit 94758f1 into testing-library:main Aug 24, 2021
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.12.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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(prefer-find-by): report waitFor with presence matchers

3 participants