Jest/Vitest interactive course (runs in the browser)

(howtotestfrontend.com)

9 points | by howToTestFE 2 days ago

3 comments

  • halflife 35 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.

    Use proper mocks with ts mockito and it will force you to write better code.

    • howToTestFE 27 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...)

      in JS (with Jest/Vitest) it is far too easy to call mock()...

  • felooboolooomba 44 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.
    • howToTestFE 39 minutes ago
      yup vitest is great (my default choice for new projects).

      vitest browser mode is really nice too. (new-ish feature, although at this point it isn't exactly new).

  • howToTestFE 2 days ago
    learn step by step the main features of both Jest and Vitest (they're very similar for most common usages) in these interactive4 lessons