Open
Description
import { render, getByText } from '@testing-library/react';
import React from 'react';
render(<div>some text</div>);
getByText(document.body, 'some text');
=> testing-library/prefer-screen-queries: Avoid destructuring queries from render result, use screen.getByTestId instead
In this case, we use the function imported from @testing-library/dom
reexported from @testing-library/react
that allows to search for an element in the tree of any other element (like within
). This exact example is of course useless (we can use screen
) but this is to show the problem with a simple testcase. I believe this is a valid use case and shouldn't be flagged by testing-library/prefer-screen-queries
.
What do you think?