DEV Community

Discussion on: What do you think of React Testing Library?

Collapse
 
hesto22 profile image
Carter Hesterman

What are some of the "land mines" in enzyme that you try to steer people away from?

Collapse
 
kentcdodds profile image
Kent C. Dodds
  • Shallow rendering (kcd.im/shallow)
  • Anything that allows you to reference a component instance (like .instance() .state(), .setState(), .props(), .setProps())
  • Anything that allows you to query for a component by the component's displayName (like .find())

Fundamentally, it's about testing implementation details, which enzyme enables and encourages. This leads to very poor tests which have many false positives and false negatives. Learn more from my blog post Testing Implementation Details.