Skip to content

feat(prefer-find-by): add fixer for waitFor wrapping findBy queries #1013

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

Merged
merged 6 commits into from
May 30, 2025

Conversation

y-hsgw
Copy link
Contributor

@y-hsgw y-hsgw commented May 28, 2025

Hi πŸ‘‹ This is my first contribution β€” thank you for the great work on this project!

Checks

Changes

  • Introduced auto-fix support to the prefer-find-by rule.
  • Fixes cases where findBy* queries are unnecessarily wrapped inside waitFor.

Context

Fixes #910

@Belco90 Belco90 self-requested a review May 29, 2025 05:59
@Belco90 Belco90 added the enhancement New feature or request label May 29, 2025
Copy link

codecov bot commented May 29, 2025

Codecov Report

Attention: Patch coverage is 97.29730% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.30%. Comparing base (26d360e) to head (e68646b).
Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
lib/rules/prefer-find-by.ts 97.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1013      +/-   ##
==========================================
+ Coverage   96.27%   96.30%   +0.02%     
==========================================
  Files          46       47       +1     
  Lines        2472     2516      +44     
  Branches     1025     1041      +16     
==========================================
+ Hits         2380     2423      +43     
- Misses         92       93       +1     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@Belco90 Belco90 left a comment

Choose a reason for hiding this comment

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

Hi @y-hsgw! Thanks for your contribution πŸ™.

I've left a couple of comments. You also need to add more tests to cover extra scenarios (codecov left you some hints about what's not covered).

@y-hsgw
Copy link
Contributor Author

y-hsgw commented May 29, 2025

@Belco90
Thanks for the comments! I’ve made the changes and added some tests β€” appreciate it if you could take another look πŸ™Œ

@y-hsgw y-hsgw requested a review from Belco90 May 29, 2025 12:20
Copy link
Member

@Belco90 Belco90 left a comment

Choose a reason for hiding this comment

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

Sorry, one last change! Please include the new case reported by this rule in its docs.

@y-hsgw
Copy link
Contributor Author

y-hsgw commented May 30, 2025

Added in e68646b!πŸ“•

@y-hsgw y-hsgw requested a review from Belco90 May 30, 2025 13:22
@Belco90 Belco90 merged commit cf02697 into testing-library:main May 30, 2025
31 checks passed
Copy link

πŸŽ‰ This PR is included in version 7.3.0 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

@Belco90
Copy link
Member

Belco90 commented May 30, 2025

@all-contributors please add @y-hsgw for code and test

Copy link
Contributor

@Belco90

I've put up a pull request to add @y-hsgw! πŸŽ‰

@y-hsgw y-hsgw deleted the pr/update-prefer-find-by branch May 30, 2025 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disallow using findBy* inside a waitFor block
2 participants