Hacker News
Jest/Vitest interactive course (runs in the browser)
felooboolooomba
|next
[-]
halflife
|next
|previous
[-]
Use proper mocks with ts mockito and it will force you to write better code.
anon7000
|root
|parent
|next
[-]
Anyways I mostly agree, it’s very annoying to use mocks in jest even past the code smell. But I also find certain DI codebases to be highly annoying too. Exceptionally verbose for what it actually accomplishes at times.
howToTestFE
|root
|parent
|previous
[-]
in JS (with Jest/Vitest) it is far too easy to call mock()...
jitl
|root
|parent
[-]
Your course should mention these techniques! Without them tests are unsound!
We do some dependency injection of our framework-level service objects like ServerApiService or RouterService or RecordCacheService (usually with a subclass of the actual implementation) but it hardly needs to be ubiquitous or typical for product developer code.
howToTestFE
|next
|previous
[-]
epolanski
|previous
[-]
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.