Skip to content

Add rules from "Common mistakes with React Testing Library" #165

Closed
@nickserv

Description

@nickserv

There are some great suggestions in Common mistakes with React Testing Library, a few of which we could probably check statically:

  1. Using wrapper as the variable name for the return value from render
  2. Wrapping things in act unnecessarily (might be tricky, but maybe we could filter AST nodes and only error if something is used that isn't from testing-library)
  3. Having multiple assertions in a single waitFor callback

Already implemented but should maybe be enabled by default:

  1. Using cleanup
  2. Using container to query for elements
  3. Passing an empty callback to waitFor

Related issues: #133 #134 #162

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needednew ruleNew rule to be included in the pluginquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions