-
Notifications
You must be signed in to change notification settings - Fork 467
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
Allow narrowing down the part of the DOM that is printed when queries fail #902
Comments
Facing the same issue with karma. Though I wouldn't narrow it by container. That breaks down once you're UI library supports portals and you can actually have rendered element in a "container" and body. It seems to me that we should just ignore |
Is there no way to specify where portals should be rendered? Or do they always render in the body tag? |
That's not really relevant here. You shouldn't change the implementation just for tests. |
Started the effort in master...eps1lon:feat/pretty-dom-noise. Though it seems like
from
which isn't ideal. So either I'm missing some API in pretty-format or we first need to add "return nothing" as a feature to |
Could we update this line to the following, that way we can override some tags? export const DEFAULT_IGNORE_TAGS = process.env.DEFAULT_IGNORE_TAGS || 'script, style'; I'd like to hide svg |
Seems like updating this config option should work: https://testing-library.com/docs/dom-testing-library/api-configuration/#defaultignore, but I am not seeing what I would expect. |
This is working for me after upgrading to the latest version ( |
Describe the feature you'd like:
When a query fails, the default behavior appears to be to log the entire
<body />
in the error message. In our case, even during tests, the body contains a lot of<script>
tags, which makes the output so long that we don't get to see the actual interesting part, where the error is.It would be great if we could specify which part of the DOM we want to be logged, as I control the wrapping element, and know how to query it. So a kind of config that says
onErrorQuery: '.test-wrapper'
could query for that element and print it?Here's an example
The text was updated successfully, but these errors were encountered: