4 ms·
That's a shame, because there are plenty of use cases where testing a shallow render makes much more sense than fully rendering the component—for example, when
by RussianCow 5y ago
That's a shame, because there are plenty of use cases where testing a shallow render makes much more sense than fully rendering the component—for example, when you're wrapping a third-party library and simply need to test that the correct props are being passed, instead of testing the library's functionality.
- danabramov 5y agoUsually you can do this by mocking that specific library out at the module level. E.g. Jest has functionality for this.
- RussianCow 5y agoSure, but using Enzyme has been easier and far less brittle in my experience by being less reliant on hacky, library-specific mocking techniques. (Then again, I suppose you could argue that Enzyme is itself a giant hack, but it worked very well for me in the past.)