Skip to content

[code-infra] Add react-testing-library eslint plugin #173

@oliviertassinari

Description

@oliviertassinari

configure eslint-plugin-testing-library and fix issues

See mui/toolpad#3648 as an implementation example.

Could also be helpful in:

-import { render } from '@testing-library/react';
+import { render, screen } from '@testing-library/react';

   test('renders content correctly', async () => {
-    const { getByText } = render(<AppProvider>Hello world</AppProvider>);
+    render(<AppProvider>Hello world</AppProvider>);

-    expect(getByText('Hello world')).toBeTruthy();
+    expect(screen.getByText('Hello world')).toBeTruthy();
   });
 });

For example mui/material-ui#41061 (comment)

Metadata

Metadata

Assignees

Labels

scope: code-infraInvolves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd).test

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions