-
Notifications
You must be signed in to change notification settings - Fork 472
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
Stop HTML DOM output on test error #773
Comments
Looks like you may be able to set the dom-testing-library/src/config.js Lines 26 to 33 in 01e243b
|
Thats awesome! I hadn't seen that, thank you @wyze ! And I can get rid of the callstack, too, with |
@wyze do let me know if you want the credit over on Stack Overflow (https://stackoverflow.com/questions/64045789) - I'll use your answer there for now 👍 |
Didn't know it was also on SO, so I answered there as well. Thanks @IanGrainger! |
The solution above did not work for me. I've tried some variations of it as well including not passing a container at all to my new Error(message). I've set error.stack = null, error.callstack = null but nothing is taking any effect. I should note that I'm using @testing-library/react. Here are a few things I've tried: and more. Any ideas? |
@RobRukavina, I solved this on my build. I used the top answer here: https://stackoverflow.com/questions/64045789/stop-huge-error-output-from-testing-library for details. This worked for me, in
|
Thanks @mcapodici . I have tried that but I don't have a jest.setup.js file and was just trying to do this in my test file itself. Didn't work, but I have since been told that we're not worrying about this anymore so I have moved on |
Thank you for the ideas with
|
Describe the feature you'd like:
Please can we have a way to stop outputting the HTML of the DOM when there's an error? I can't think of a single time I've found this helpful, and outputting 9000 characters for every failed test means I can't read the output in the console window in any sensible way.
This one issue has put off work mates from wanting to use this library! And the library is super awesome!
I'm not sure if testing-library can read my Jasmine conf? But it'd ideally not be an environment variable, because its tricky to get the Karma runner to read them :(
Describe alternatives you've considered:
I've tried setting the PrettyDOM limit to 0 using the env variable - but a) that means I can't then manually run
debug(el)
to see some actually useful HTML and b) it doesn't work with Karma (I'm usingtesting-library
with Karma in an Angular project, which I realise is pretty unusual - but I love it too much!!).The text was updated successfully, but these errors were encountered: