Skip to content

prefer-screen-queries: false positives when query used from within #116

Closed
@Belco90

Description

@Belco90

Rule prefer-screen-queries is throwing false positives when a query is called from within util:

import { render, within, screen } from 'react-testing-library';

// ...
render(<SomeComponent />);
const section = screen.getByTestId('some-id');

// this is fine but the rule complains about it.
const submit = within(section).getByText(/submit/i);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions