When calling one of these custom queries created with buildQueries it'll try to suggest better queries which often don't work because these queries are custom for a reason.
What happened:
Testing Library will fail the test and suggest a different query despite it not being correct.
Reproduction:
It's not easy to reproduce in CodeSandbox but hopefully the description here is clear enough.
Problem description:
Using custom queries require { suggest: false } options in many places as tests are incorrectly failing due to bad suggestions.
Suggested solution:
Easiest solution, give an option to disable suggestions when using buildQueries. Custom queries should rarely if ever be treated the same as native queries and suggestions don't make sense for them.
The perfect world solution would be to make throwSuggestions aware of all custom queries to be able to accurately suggest those too and take them into account. But I highly doubt this is possible or reasonable.
@testing-library/dom
version: 8.19.0Relevant code or config:
(Actual example of real-world custom queries from shadow-dom-testing-library.)
What you did:
When calling one of these custom queries created with
buildQueries
it'll try to suggest better queries which often don't work because these queries are custom for a reason.What happened:
Testing Library will fail the test and suggest a different query despite it not being correct.
Reproduction:
It's not easy to reproduce in CodeSandbox but hopefully the description here is clear enough.
Problem description:
Using custom queries require
{ suggest: false }
options in many places as tests are incorrectly failing due to bad suggestions.Suggested solution:
Easiest solution, give an option to disable suggestions when using
buildQueries
. Custom queries should rarely if ever be treated the same as native queries and suggestions don't make sense for them.The perfect world solution would be to make
throwSuggestions
aware of all custom queries to be able to accurately suggest those too and take them into account. But I highly doubt this is possible or reasonable.