When debugging our tests, one important part is understanding how our UI looks after our component renders or after we apply some changes to it.
In this lesson, we are going to review one util that allows us to print to our console a representation of the DOM tree of our elements: the debug
Instructor: [0:04] If at any test case, you want to be sure you have queried for the right thing, you can leverage debug. Besides allowing you to see the current way your container looks, if you pass an element to it, it will show it to you. All we need to do is call debug.
[0:13] You can destructure it from render, or just call screen.debug. Then what you need to do is pass it the element you want to pre-reprint to your DOM. If you run your test, you should not see it printed there.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!