4 comments

  • halflife46 minutes ago
    Jest mocks allow developers to write bad code. Instead of separating concerns with DI, jest mocks overwrite the importing mechanism without any type safety. Also, if you wish to migrate to native node test runner, the mocks lock you into jest.<p>Use proper mocks with ts mockito and it will force you to write better code.
    • howToTestFE38 minutes ago
      100%. its a horrible code smell, and AI loves to jest.mock (or vi.mock()). (The most recent blog post on my site covers this as one of the things to look out for in AI generated tests...)<p>in JS (with Jest&#x2F;Vitest) it is far too easy to call mock()...
  • felooboolooomba56 minutes ago
    Vitest is a brilliant software. I wish that the vitest vscode extension would be managed in a more careful manner though, too buggy for me to use.
    • howToTestFE51 minutes ago
      yup vitest is great (my default choice for new projects).<p>vitest browser mode is really nice too. (new-ish feature, although at this point it isn&#x27;t exactly new).
  • howToTestFE2 days ago
    learn step by step the main features of both Jest and Vitest (they&#x27;re very similar for most common usages) in these interactive4 lessons
  • epolanski9 minutes ago
    I think unit testing FE to be borderline useless and very expensive to maintain.<p>I have seen so many broken products where leads where obsessed with 100% coverage and quality tests I just don&#x27;t believe the methodology.<p>E2Es are the only tests that tell you whether the product is making money or not with a good approximation.<p>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..<p>Of course there are situations you want to test via normal unit tests and even do TDD (parsers&#x2F;encoders&#x2F;math stuff, etc) or you&#x27;re writing libraries, but the people testing react components and such are involved in delusional productivity porn if that&#x27;s not the case.