Hacker News new | past | comments | ask | show | jobs | submit login

I know how to make tests for _logic_, that's usually in Typescript functions (e. g., React hooks).

But for components, that call some of those hooks and then render some JSX, I've never been able to write a test that found a bug later on. Every single time one of them failed, either the change made was so large that the whole build failed to compile anyway, or it was because there was new desired behaviour and the test needed changing, not the code.

If a type of test doesn't help find bugs, it's a waste of space.




I've given an example of a whole repository, that is now 4 years old, full of the types of tests you're talking about. It isn't that hard.

If the desired behavior is changing, then the test should fail and yes, you need to rewrite it. That's how testing works.


It's not hard, but they just make the build of our monorepo take longer and longer without finding actual bugs, in my experience. I feel most unit tests should be commented out once the thing under test is done.


You are arguing against tests. It is not a winnable argument.


No, people are arguing against frontend tests because they're orthogonal to test driven development


I really don't understand this comment at all.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: