Skip to content

fix: improve detection of userEvent.setup() calls #1056

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

puglyfe
Copy link
Contributor

@puglyfe puglyfe commented Aug 2, 2025

Checks

Changes

  • Improve detection of async event methods called on userEvent sessions

Context

I had a little bit of familiarity with this from a previous fix, so figured I would take a shot at resolving the issue. There are a huge number of edge cases in trying to support this pattern, and I almost certainly haven't covered them all. But I specifically addressed the example in the original bug report as well as the related example that's shown in the testing-library docs.

Fixes #812

Copy link

codecov bot commented Aug 2, 2025

Codecov Report

❌ Patch coverage is 98.73418% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.52%. Comparing base (2e7e1b6) to head (347b2cd).

Files with missing lines Patch % Lines
lib/rules/await-async-events.ts 98.48% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1056      +/-   ##
==========================================
+ Coverage   96.46%   96.52%   +0.05%     
==========================================
  Files          50       50              
  Lines        2687     2760      +73     
  Branches     1112     1154      +42     
==========================================
+ Hits         2592     2664      +72     
- Misses         95       96       +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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

await-async-events doesn't seem to check calls from user sessions returned by userEvent.setup()
1 participant