Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[jest-dom/prefer-to-have-class] wrong autofix for toBeTrue() #380

Open
@danielrentz

Description

  • eslint-plugin-jest-dom version: 5.4.0
  • node version: 20.9
  • npm version: 9.8.1

Relevant code or config

Using jest-extended's method toBeTrue() does not work with autofixer of jest-dom/prefer-to-have-class

expect(node.classList.contains('a')).toBe(true);
expect(node.classList.contains('b')).toBeTrue();

What you did:

Run auto-fixer for jest-dom/prefer-to-have-class assertions

What happened:

expect(node).toHaveClass('a');
expect(node).not.toHaveClass('b');

Problem description:

toBeTrue() will be fixed to not.toHaveClass()

Suggested solution:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /