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-style] doesn't report when using .toBe(variable) #384

Open
StyleShit opened this issue Dec 9, 2024 · 0 comments

Comments

@StyleShit
Copy link

  • eslint-plugin-jest-dom version: 5.5.0
  • node version: 18.20.3
  • npm version: 10.2.3

Relevant code or config:

// eslintrc.js
{
	// ...
	rules: {
		'jest-dom/prefer-to-have-style': 'error',
	}
}
// component.test.js

expect(node.style.color).toBe('red'); // Works

const red = 'red';
expect(node.style.color).toBe(red); // Doesn't work

What happened:

I'm referencing a variable in the toX() methods, but the rule doesn't report.
I would've expected it to report. Is it intentional? Didn't find other issues mentioning this, but the selectors in the code don't seem to handle it.

Reproduction repository:

StackBlitz

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