Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
danielrentz opened this issue Aug 15, 2024 · 0 comments
Open

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

danielrentz opened this issue Aug 15, 2024 · 0 comments

Comments

@danielrentz
Copy link

danielrentz commented Aug 15, 2024

  • 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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant