47
loading...
This website collects cookies to deliver better user experience
While other options like React Testing Library have gained traction within Airbnb,
we will still be using and contributing to Enzyme for the foreseeable future.
i am the only enzyme developer, to be clear.
Class components are going to be around for years to come—for example, there are tens of thousands in production at Facebook already. However, we do recommend that new apps be built with function components and Hooks, which is why we want those docs front and center. The class component docs will remain available for folks working with those components, and class components themselves might one day be spun out into their own package—but if that did happen, we're provide migration scripts to automate that transition :)
While tangential to the issue, I think it’s worth noting that if you can use a project like React Testing Library that doesn’t depend on React internals, it’s generally a good idea. At FB we’ve frozen Enzyme tests to stay on an old version of React that won’t be upgraded for this reason, and we banned using it in any new tests. I don’t want to hijack this issue with an unrelated discussion, but for people who feel blocked by this, I want to provide some encouragement that it’s a worthwhile investment to use a different approach.
.props()
method, called directly and asserted to be called.jsdom
implementation of those) which is extremely powerful. It doesn't require you to learn any extra APIs, there's just native browser's API we all know.