Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Disallow using findBy* inside a waitFor block #910

Copy link
Copy link
Closed
@neriyarden

Description

@neriyarden
Issue body actions

Name for new rule

no-findby-in-waitfor

Description of the new rule

This new rule should prevent the usage of a findBy* method inside a waitFor.

Testing Library feature

waitFor and findBy

Testing Library framework(s)

all

What category of rule is this?

Suggests an alternate way of doing something

Optional: other category of rule

No response

Code examples

Incorrect usage

await waitFor(() => {
  const button = await findByRole("button", { name: "Submit" });
  expect(button).toBeInTheDocument()
};

Correct usage

  const button = await findByRole("button", { name: "Submit" });
  expect(button).toBeInTheDocument()

Anything else?

No response

Do you want to submit a pull request to make the new rule?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.