I think unit testing FE to be borderline useless and very expensive to maintain.
I have seen so many broken products where leads where obsessed with 100% coverage and quality tests I just don't believe the methodology.
E2Es are the only tests that tell you whether the product is making money or not with a good approximation.
You have to invest in reducing flakiness and their run time, but if my 5 men team maintaining 6 products could, I think it can be done by more people, yet so many seem to be burned on their 10 year old experience..
Of course there are situations you want to test via normal unit tests and even do TDD (parsers/encoders/math stuff, etc) or you're writing libraries, but the people testing react components and such are involved in delusional productivity porn if that's not the case.
I strongly prefer Playwright over frontend unit tests, just doing what the user does against the system in its entirety, jiggle parameters like resolution and locale / timezone to really lock it down. A good Playwright test suite makes a lot of backend e2e and unit tests redundant.
Mostly agree. I do find that FE unit tests are a decent litmus test for complexity though. IMO the more difficult it is to test your react component, the more you probably need to think about breaking your component down.
The value of FE unit testing is inversely proportional to the amount of mocking in said tests. I once worked on a complex admin dashboard with lots of business edge cases. The unit tests for the forms and the settings didn’t have any mocks and therefore we could catch legitimate bugs. On the other hand I have worked on code bases with so much mocking that I couldn’t make the tests to fail by intentionally bricking the component.