enzymejs/enzyme

Documentation does not make it clear when to use `.dive()` vs `.shallow()`

Offen

#1.798 geöffnet am 28.08.2018

 (26 Kommentare) (24 Reaktionen) (0 zugewiesene Personen)JavaScript (1.967 Forks)batch import
docshelp wanted

Repository-Metriken

Stars
 (19.825 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Describe the bug

It's not clear to me what the differences between .dive() and .shallow() are. From the documentation, and the code, it looks like they do the same thing except that .dive() errors if the element is anything but a component. It also looks like .dive() inherits the options of the container it is called on, where .shallow() does not.

Why would one choose to use .dive() over .shallow(), or vice versa? I imagine, it .dive() is preferred over .shallow(), since it's more restrictive, but it would be nice if the documentation called that out explicitly.

Contributor Guide