Testing with Vitest and Vue Test Utils

Vitest is a fast test runner integrated with Vite, and Vue Test Utils provides the tools to mount a component, simulate interactions and check the render. You test visible behavior (displayed text, emitted events) rather than implementation details.

Example

const w = mount(Compteur)
await w.find('button').trigger('click')
expect(w.text()).toContain('1')

Related concepts

The whole glossary