Skip to content
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

fix(await-async-events): false positives for userEvent.setup() returned #895

Merged

Conversation

Chamion
Copy link
Contributor

@Chamion Chamion commented Apr 12, 2024

Checks

Changes

The circuit-breaker checking for userEvent.setup() was executed after detectEventMethodWrapper so the circuit-breaking only applied to cases where the expression is not returned. It's intended to be applied generally so this PR moves it to the top of its code block.

Context

My last contribution was received well so I picked another open issue.

Fixes #881

This is another false-positive where the root problem is defaulting to report unless a reason not to report is found. If new methods are introduced to userEvent the rule will assume they return promises. I'd like to change the behaviour to check for an allow-list of method names instead of checking it's not specifically setup so future bugs would be false negatives instead of false positives. I didn't do that in this PR because maybe it's the way it is by design.

Copy link

codecov bot commented Apr 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.31%. Comparing base (93a6ab9) to head (7837d4f).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #895      +/-   ##
==========================================
+ Coverage   96.23%   96.31%   +0.08%     
==========================================
  Files          44       44              
  Lines        2419     2445      +26     
  Branches     1000     1023      +23     
==========================================
+ Hits         2328     2355      +27     
+ Misses         91       90       -1     

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

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.

LGTM, thanks @Chamion!

@Belco90 Belco90 changed the title Fix edge case: call expression userEvent.setup() is returned fix(await-async-events): false positives for userEvent.setup() returned Apr 15, 2024
@Belco90 Belco90 added this pull request to the merge queue Apr 15, 2024
@Belco90
Copy link
Member

Belco90 commented Apr 15, 2024

@all-contributors please add @Chamion for code, test

Copy link
Contributor

@Belco90

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

Merged via the queue into testing-library:main with commit fb32c5c Apr 15, 2024
31 checks passed
Copy link

🎉 This PR is included in version 6.2.2 🎉

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.

await-async-events produces false-positives
2 participants