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

feat(vitest/valid-expect-in-promise): add rule #569

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

cardoso
Copy link
Contributor

@cardoso cardoso commented Nov 11, 2024

Adapted from jest/valid-expect-in-promise.

This is the only rule I'm missing after migrating from jest, so it'd be nice to have it in order to depend only on @vitest/eslint-plugin .

@veritem
Copy link
Member

veritem commented Nov 12, 2024

@cardoso this pr looks great. would you mind making necessary changes to support this?

- expect.poll(() => getElement()).toBeVisible()
+ await expect.poll(() => getElement()).toBeVisible()

@cardoso
Copy link
Contributor Author

cardoso commented Nov 12, 2024

@veritem After trying a bit I'm starting to think the expect.poll or expect.element case should be covered by a separate rule. This one is very specific about finding expect inside promises and I couldn't find a simple way to also cover those cases. What do you think?

@veritem
Copy link
Member

veritem commented Nov 12, 2024

@cardoso i agree.

Copy link
Member

@veritem veritem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants