DEV Community

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

Collapse
 
aisflat439 profile image
Devin Fitzsimons

I'm sure RTL has been a lot of work and I'm not trying to call you out. It seems you're really passionate about this and legitimately open to feedback.

I think it doesn't solve the biggest problems with testing. Testing should be easy and perhaps even fun. I've yet to ever once try to install RTL on a site and have it just work. Instead I get stuck in configuration land. It does little to improve mocking, which is one of the more frustrating parts of testing, especially for a beginner. Once going is it better than Enzyme? Sure, I guess. But only because it's opinionated and so you do less. I'd say RTL is acceptable but doesn't improve the testing landscape in a meaningful way overall. For those familiar with testing it's a nice little api that's moderately helpful.

I suppose this isn't the goal of RTL. The goal is to test the things that need testing, not implementation details. I think that's a worthy goal, it's just never going to be improved until testing is easy to do. RTL doesn't really move the needle on ease of use. As such it's a needless improvement in my view. You could have done the entire RTL task with a VSCode package that highlights or underlines when bad enzyme practices are being used.