DEV Community

Eduardo Augusto
Eduardo Augusto

Posted on

Enzyme

Hello everyone,

What diference between Shallow and Mount render when I test a React component?

Latest comments (2)

Collapse
 
dorshinar profile image
Dor Shinar

Shallow only mounts the component and "mocks" the rendered output of it's children. Mount renders the entire component tree. You can print wrapper.debug() to see the difference clearly.
Using shallow your tests run much faster, and are less prone to side effects, so the general rule of thumb is that you should always use Shallow, unless you need Mount.

Collapse
 
eduaugustus profile image
Eduardo Augusto

Thks Dor :D