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): sync userEvent.setup() should not be reported #817

Merged
merged 1 commit into from
Sep 23, 2023
Merged

fix(await-async-events): sync userEvent.setup() should not be reported #817

merged 1 commit into from
Sep 23, 2023

Conversation

justintoman
Copy link
Contributor

@justintoman justintoman commented Sep 22, 2023

Checks

Changes

  • Skipping nodes named "setup" in the await-async-events rule

Context

Fixes #800

This is my first open source PR. I'd rather base the logic on the type of the call expression (is it a Promise?), but I don't believe that information is available in the AST so I just went off of the identifier name.

@justintoman justintoman changed the title fix: prevent non-async userEvent.setup() from triggering await-async-events fix(await-async-events): prevent non-async userEvent.setup() from triggering await-async-events Sep 22, 2023
@justintoman justintoman changed the title fix(await-async-events): prevent non-async userEvent.setup() from triggering await-async-events fix(await-async-events): non-async userEvent.setup() should not be invalid Sep 22, 2023
@Belco90 Belco90 self-requested a review September 23, 2023 13:01
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 for your contribution!

@Belco90 Belco90 changed the title fix(await-async-events): non-async userEvent.setup() should not be invalid fix(await-async-events): sync userEvent.setup() should not be reported Sep 23, 2023
@Belco90 Belco90 merged commit c0b6e6f into testing-library:main Sep 23, 2023
29 checks passed
@github-actions
Copy link

🎉 This PR is included in version 6.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Belco90
Copy link
Member

Belco90 commented Sep 28, 2023

@all-contributors please add @justintoman for code and test

@allcontributors
Copy link
Contributor

@Belco90

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

@moeyashi
Copy link

@Belco90 Isn't it okay to not have a such test?

const user = userEvent.setup()
user.click(button) // invalid, this needs await

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.

userEvent.setup API does not return a Promise.
3 participants