prefer-to-have-value having unintended effects
See original GitHub issueeslint-plugin-jest-dom
version: 3.5.0node
version: 10.22.0npm
version: 6.14.6
Relevant code or config
const gen = someGeneratorFunction();
expect(gen.next().value).toEqual(someYieldedValue);
What you did: ^
What happened: Prefer .toHaveValue() over other attribute checks
Problem description:
The new rule prefer-to-have-value
is causing unintended warnings when checking the value
key on objects that are not DOM elements.
Suggested solution:
I’m not sure if there’s a graceful solution that can allow for triggering warnings on element.value
but not on obj.value
(let me know if I’m wrong!). But I think a reasonable middle ground would be to allow a configuration option to only trigger a warning on expect(element).toHaveAttribute('value', 'someValue')
so I don’t have to individually turn off the rule everywhere I’m testing generators.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:13 (12 by maintainers)
Top Results From Across the Web
eslint-plugin-jest-dom/prefer-to-have-value.md at main - GitHub
This rule is an autofixable rule that encourages the use of toHaveValue over checking the value attribute. Rule Details. This rule checks for...
Read more >Documentation - React Test
toHaveValue (). Checks whether the element has the given value. Only works for input, textarea, and select tags. For input types of checkbox ......
Read more >You Always Have Value -- Here's How to Nurture It
You are always a valuable, worthwhile human being – not because anybody says so, not because you're suc.
Read more >Ethics Exam 3: Quizzes Flashcards - Quizlet
If you think something is valuable, we can see it in your actions because you will act on the reasons it gives you....
Read more >Intrinsic vs. Extrinsic Value
Most philosophers who have written on the question of what has intrinsic value have not been hedonists; like Plato and Aristotle, they have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@benmonro That would be the best of both worlds, sounds like the way to go! I can mess around with it and see about a PR this weekend
doh, yes it was a mis-click sorry