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
The debug command is not printing the entire component. #503
Comments
Output is truncated https://testing-library.com/docs/dom-testing-library/api-helpers#debugging Set the env var |
Thanks mate! |
It should ideally be an option of the |
Wow it took me so long to realize that my output was getting truncated... I was very confused as to why my component wasn't rendering properly. and now that i've realized it I agree with @eric-burel that this should be an option of |
I would argue that the default should be extremely high (or set to infinity) as setting an env var to increase this is strange and not intuitive. At least an optional param as @eric-burel mentions would be a big step forward. |
So as I was looking over this again, I realized that So if you do |
a neat trick is to use |
FWIW it's screen.debug(undefined, Infinity) if you want to use correct types 😄 |
still doesn't work in some cases |
This work for me:
Note: if I do not put the "highlight: false" it does not print everything and it is cut off I took it from this page: |
Even using this command or the one above it my output is still cutoff. I think it's due to the async nature of my test and the fact that the next line is errorring for not being able to find the element, and the test is failing before the entire output is written? Not sure but I'm getting a ... at the end out my debug output before the error so it must be truncating the output still right? |
Okay confirmed. The truncated output was due to my screen.findAllByText() failing the test before the screen.debug() output was able to finish. I'm not super familiar with JS async stuff but there ought to be some way to make the screen.debug() block until it's finished writing to console, or have some kind of timed delay after the call to ensure the buffer is flushed to output? |
react-testing-library
version: 9.2.0react
version: 16.8.1node
version: 11.6.0npm
(oryarn
) version: 6.9.0Relevant code or config:
What you did:
I'm just testing a component and doing a debug of the component
What happened:
The debug that was printed was just half of what I was expecting.
Reproduction:
Problem description:
The Debug is not printing the entire component, I think it is probably something related to the terminal.
Suggested solution:
The text was updated successfully, but these errors were encountered: