Skip to content

Allow saving "within" to variable for rule "Suggest using screen while querying (testing-library/prefer-screen-queries)" #372

Open
@florianmatz

Description

@florianmatz

According to the rule using

within(screen.getByTestId('section')).getByText('foo');

is allowed.

However, saving the result to a variable

const context = within(screen.getByTestId('section')).getByText('foo');

to re-use it, results in the warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions