Skip to content
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

Error output is incredibly long for failed queries #491

Open
jrolfs opened this issue Sep 1, 2022 · 0 comments
Open

Error output is incredibly long for failed queries #491

jrolfs opened this issue Sep 1, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@jrolfs
Copy link
Member

jrolfs commented Sep 1, 2022

The pretty-dom + getElementError error that Testing Library outputs is super long for the e2e use case since we're working with entire pages instead of small units. So far, we're thinking of addressing this with either or both of the following:

  • Modify the default getElementError to better suit our use case (strip <style /> + <script />? — see last comment below for details/ideas)
  • Support the getElementError configuration option from Testing Library

Original Discussion

One other thing -- is there any way that we could allow users to configure getElementError? I'm finding the length of the error messages incredibly long as it prints out a bunch of HTML and CSS and I have to scroll up a long way to find the actual error message.

Okay, so this is something I've wanted to address since I created this library. I'd be curious if you have an idea of what a better default implementation/output would be. I do think we can add support for this option, but I really think we also need a better default because the e2e use case just always produces so much output. I also want to figure out how to preserve the ANSI formatting in the Testing Library errors.

I agree that we might want to change the default getElementError and have a few suggestions.

  • It outputs huge amounts of inline CSS/HTML in our case. This seems to be because of pretty-dom which sets a length limit of 7000 by default (!!!). My recommendation would be to inline getElementError but without the postfixed prettifiedDOM (and with a comment linking back to their original implementation). Actually, for now I can set DEBUG_PRINT_LIMIT=0 to get the same behaviour...!
  • I've also found the logic which prints out roles found on the screen is controlled by a hidden config._disableExpensiveErrorDiagnostics option (which they switch on/off during waitFor). I wonder if we could have this be switched on/off via an environment variable? I don't currently know whether it should default to true or false as although it buries the error message it's incredibly helpful!
@jrolfs jrolfs self-assigned this Sep 1, 2022
@jrolfs jrolfs added the enhancement New feature or request label Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant