Skip to content

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
@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

3 participants