Skip to content

Installation

shell
npm install --save-dev @vue/test-utils
shell
yarn add --dev @vue/test-utils

Usage

Vue Test Utils is framework agnostic - you can use it with whichever test runner you like.

Vitest is the recommended test runner for Vue projects. It is built on Vite, supports .vue files out of the box, and provides a fast, modern testing experience with native ESM support.

shell
npm install --save-dev vitest

No additional transform configuration is needed when using Vitest with a Vite-based project. See the Vitest getting started guide for more details.

Jest

You can also use Jest with Vue Test Utils. To load .vue files with Jest, you will need vue-jest. You can install it with vue-jest@next and configure it with Jest's transform option.

Continue reading to learn more about Vue Test Utils.

Released under the MIT License.