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

Testing composables

How do you test a composable in Vitest?

Answer options

  • Only inside a mounted component
  • Composables cannot be unit tested
  • Only through E2E tests in a browser
  • By importing and calling the composable directly in the test, checking returned values

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