computedStyleSupportsPseudoElements
It is set as true in the case window.getComputedStyle supports a second argument. Old browser such as Internet Explorer 8 or earlier versions doesn't support this property. However, currently, the jsdom does not support the second argument. This includes versions of jsdom prior to version 16.4.0.
defaultHidden
It has a default value of false. It is the default value of the getByRole hidden option.
showOriginalStackTrace
The waitFor ensures that the stack trace for errors thrown by the Testing Library is shortened so that it becomes easier for the developer to identify the part of code that resulted in the error. To disable this the setshowOriginalStackTrace is set to false.
throwSuggestions
Default value false. When throwSuggestions is set to true, it will fail a test that has better query availability and will provide a suggested query instead.
{suggest:false} can be added as an option to avoid suggestions for a single query.
screen.getByTestId('foo', {suggest: false})
testIdAttribute
Defaults to data-testid.This attribute is used by the getByTestId and related queries.
getElementError
This function returns the error used when a get or find query fails. It takes the error message and container object as arguments.
asyncUtilTimeout
Defaults to 1000ms.This global timeout value in milliseconds is required by waitFor utilities.
FAQs
-
What is a testing library?
The Testing Library family of libraries is a very lightweight solution for testing without all the implementation details. The principal utilities it provides involve querying for nodes similarly to how users would find them. In this way, the testing library helps ensure your tests give you confidence in your UI code.
-
What is throwSuggestions option in Configuration Options?
Default value false. When throwSuggestions is set to true, it will fail a test that has better query availability and will provide a suggested query instead.
-
Who created the testing library?
Testing Library was developed by Kent C. Dodds, a React educator and an open-source developer.
-
What is getElementError option in Configuration Options?
This function returns the error used when a get or find query fails. It takes the error message and container object as arguments.
-
What is the asyncUtilTimeout option in Configuration Options?
Defaults to 1000ms.This option is a global timeout value in milliseconds is required by waitFor utilities.
Key Takeaways
In this article, we have extensively discussed the Configuration Options in Testing Library.If you are Preparing for interview and don't know where to start, we have got you covered, check out our expert curated courses on our website, You can also check out Coding Ninjas Studio to practice frequently asked interview problems. We hope that this blog has helped you enhance your knowledge regarding Configuration Options and if you would like to learn more, check out our articles. Do upvote our blog to help other ninjas grow. Happy Coding!”