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

[await-async-utils] false positive promise all #227

Closed
Mikeysauce opened this issue Sep 8, 2020 · 3 comments · Fixed by #236
Closed

[await-async-utils] false positive promise all #227

Mikeysauce opened this issue Sep 8, 2020 · 3 comments · Fixed by #236
Assignees
Labels
bug Something isn't working released

Comments

@Mikeysauce
Copy link

Hello,

Take the following example:

await Promise.all([
    waitFor(() =>
      expect(getByText('first-item')).toBeTruthy()
    ),
    waitFor(() =>
      expect(getByText('second-item')).toBeTruthy()
    ),
  ]);

This is flagged up as an error: "Promise returned from waitFor must be handled", which I believe is a false positive, as the Promise is indeed being handled by the Promise.all.

Thanks

@gndelia
Copy link
Collaborator

gndelia commented Sep 8, 2020

Hi Mikey!
If you are waiting for of those two to appear, perhaps you could consider findByText as an alternative

await Promise.all([findByText('first-item'), findByText('second-item')])

As of the code itself, yeah it sounds like a bug

Thanks for opening the ticket!

@gndelia gndelia added the bug Something isn't working label Sep 8, 2020
@Mikeysauce
Copy link
Author

Thanks gndelia,

I'm in agreement with you regarding findBy being more suitable here with it having a built in waitFor behaviour, but some colleagues find the intent of waitFor to be more explicit and so here we are unfortunately. I appreciate the quick reply!

@Belco90
Copy link
Member

Belco90 commented Oct 12, 2020

🎉 This issue has been resolved in version 3.9.1 🎉

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