Skip to content

Commit 9319ccc

Browse files
benmonrokentcdoddstimdeschryver
authored
docs: added showSuggestions (#477)
* docs: added showSuggestions * Update api-configuration.md * Update api-configuration.md * Update api-configuration.md * Update docs/dom-testing-library/api-configuration.md Co-authored-by: Tim Deschryver <[email protected]> Co-authored-by: Kent C. Dodds <[email protected]> Co-authored-by: Tim Deschryver <[email protected]>
1 parent 732aad3 commit 9319ccc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/dom-testing-library/api-configuration.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ for you to identify the part of your code that resulted in the error (async
2424
stack traces are hard to debug). If you want to disable this, then set
2525
`showOriginalStackTrace` to `false`. You can also disable this for a specific
2626
call in the options you pass to `waitFor`.
27+
`throwSuggestions`: (experimental) When enabled, if [better queries](https://testing-library.com/docs/guide-which-query) are available
28+
the test will fail and provide a suggested query to use instead. Default to `false`.
29+
30+
To disable a suggestion for a single query just add `{suggest:false}` as an option.
31+
```js
32+
screen.getByTestId("foo", {suggest:false}); // will not throw a suggestion
33+
```
2734

2835
`testIdAttribute`: The attribute used by [`getByTestId`](api-queries#bytestid)
2936
and related queries. Defaults to `data-testid`.

0 commit comments

Comments
 (0)