Question · Vue.js course · Module 12: Testing & Deploy

Mocking with vi.fn()

What is vi.fn() used for in Vitest?

Answer options

  • Creating real API connections
  • Creating mock functions that simulate dependencies
  • Formatting test output in the console
  • Automatically fixing code errors

You can check the correct answer by solving this task in the CodeWorlds game.