Skip to content

Conversation

@gipcompany
Copy link

@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

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
15245 1 15244 0
View the top 1 failed test(s) by shortest run time
tests/index.test.ts > should export all existing rules
Stack Traces | 0.0106s run time
AssertionError: expected [ 'await-async-events', …(27) ] to include 'prefer-user-event-setup'
 ❯ tests/index.test.ts:18:21
 ❯ tests/index.test.ts:17:13

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

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

2 participants