Skip to content

Conversation

@gipcompany
Copy link
Contributor

@gipcompany gipcompany commented Dec 10, 2025

Checks

Changes

  • Add prefer-user-event-setup rule to encourage using userEvent.setup() pattern over direct method calls
  • Add comprehensive test coverage with 44 test cases covering various usage scenarios
  • Add documentation explaining the rule benefits and correct usage patterns
  • Update README.md with new rule entry in supported rules table

Context

Closes #646

Enforces using userEvent.setup() pattern instead of direct method calls
as recommended in the official user-event documentation.
@gipcompany gipcompany force-pushed the pr/prefer-user-event-setup-rule branch from 3626415 to f89ad18 Compare December 10, 2025 00:45
@gipcompany gipcompany marked this pull request as ready for review December 10, 2025 00:58
@Belco90 Belco90 requested review from Belco90 and Copilot and removed request for Copilot December 10, 2025 06:30
@Belco90 Belco90 added the enhancement New feature or request label Dec 10, 2025
@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.48%. Comparing base (3cc095b) to head (8510411).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1125      +/-   ##
==========================================
+ Coverage   97.40%   97.48%   +0.07%     
==========================================
  Files          48       49       +1     
  Lines        5826     5997     +171     
  Branches     1477     1518      +41     
==========================================
+ Hits         5675     5846     +171     
  Misses        149      149              
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 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.

@gipcompany thanks for your contribution! Great implementation and test cases, just added some minor comments.

@gipcompany gipcompany requested a review from Belco90 December 14, 2025 17:01
@Belco90 Belco90 changed the title feat(prefer-user-event-setup): adding new rule feat(prefer-user-event-setup): add new rule Dec 14, 2025
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.

The rule must be manually exported in lib/rules/index.ts

@gipcompany
Copy link
Contributor Author

The rule must be manually exported in lib/rules/index.ts

This was addressed with 8510411.

@Belco90 Belco90 merged commit 03f8736 into testing-library:main Dec 15, 2025
31 checks passed
@Belco90
Copy link
Member

Belco90 commented Dec 15, 2025

@all-contributors please add @gipcompany for code, test, docs

@allcontributors
Copy link
Contributor

@Belco90

I've put up a pull request to add @gipcompany! 🎉

@github-actions
Copy link

🎉 This PR is included in version 7.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bobaaaaa
Copy link

bobaaaaa commented Dec 15, 2025

awesome new rule. thx @gipcompany ❤️

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.

Recommend using the methods on the instances returned by userEvent.setup() from userEvent

3 participants