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

Matcher toEqual vs toBe

What is the difference between toBe() and toEqual() in Vitest?

Answer options

  • There is no difference
  • toBe is faster, toEqual is deprecated
  • toBe works only with numbers, toEqual only with strings
  • toBe checks reference (===), toEqual does a deep comparison of values

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