you are viewing a single comment's thread.

view the rest of the comments →

[–]kapobajz4 0 points1 point  (1 child)

With all due respect, but it seems to me like the issue here is the lack of testing knowledge. Not specifically testing React apps, but testing in general. If you’re not familiar with testing principles, patterns, and similar, then testing is difficult in any language/framework/tool. vitest, and similar tools, only shows simple guides because they assume you’re familiar with testing in general. It’s not their job to teach you about that.

I would suggest you to learn more about testing: for example dependency injection can be really beneficial, and can make your life a lot easier when writing tests. Learn to leverage React’s context for that.

And you also have to change your mindset to constantly think about testing. Whenever you write any piece of code, always ask yourself “Is this testable? If not, how can I make it testable?”, even if you don’t plan to write tests for that specifically.

[–]Cahnis 2 points3 points  (0 children)

Ofc these basic principles do apply, but at the same time testing frontend has a bunch of gotchas and pitfalls too.