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

no-wait-for-side-effects erroring in promise #500

Closed
Brianzchen opened this issue Oct 17, 2021 · 3 comments · Fixed by #645
Closed

no-wait-for-side-effects erroring in promise #500

Brianzchen opened this issue Oct 17, 2021 · 3 comments · Fixed by #645
Labels
bug Something isn't working released

Comments

@Brianzchen
Copy link

Plugin version

v4.10.1

ESLint version

v7.31.0

Node.js version

v12.17.0

npm/yarn version

yarn 1.22.10

Operating system

macOS 10.14.6

Bug description

When I use fireEvent within a .then() of waitFor it throws an error

Steps to reproduce

Basically what's shown in the screenshot. I prefer to use .then() as opposed to async await but it throws errors when it shouldn't

Screen Shot 2021-10-18 at 10 13 09 am

Error output/screenshots

No response

ESLint configuration

A few private stuff but the rule sets are

    'testing-library/no-dom-import': 2,
    'testing-library/no-manual-cleanup': 2,
    'testing-library/no-wait-for-empty-callback': 2,
    'testing-library/no-wait-for-side-effects': 2,
    'testing-library/prefer-screen-queries': 2,
    'testing-library/prefer-wait-for': 2,

Rule(s) affected

testing-library/no-wait-for-side-effects

Anything else?

No response

Do you want to submit a pull request to fix this bug?

No

@Brianzchen Brianzchen added the bug Something isn't working label Oct 17, 2021
@Belco90
Copy link
Member

Belco90 commented Oct 18, 2021

Hi @Brianzchen! Thanks for reporting, interesting issue. This is definitely a bug and the rule should discard the statements within .then from waitFor promise.

sjarva added a commit to sjarva/eslint-plugin-testing-library that referenced this issue Sep 12, 2022
Added tests and a mention of edge case to rule documentation

Refs: testing-library#500
@sjarva
Copy link
Collaborator

sjarva commented Sep 12, 2022

Thanks @Brianzchen for reporting this! This was nice and easy to fix in #645 🛠️ 🤗

@github-actions
Copy link

🎉 This issue has been resolved in version 5.6.4 🎉

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
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants