Skip to content

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

Open
@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

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions