upvote
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.
reply
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.
reply
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.
reply