Skip to content

Test ​

vp test runs tests with Vitest.

The bundled runner uses Vitest 5.0.1 and requires Node ^22.18.0 || ^24.11.0 || >=26.0.0. For existing projects, follow Upgrade to Vitest 5 before updating dependencies.

Overview ​

vp test is built on Vitest, so you get a Vite-native test runner that reuses your Vite config and plugins, supports Jest-style expectations, snapshots, and coverage, and handles modern ESM, TypeScript, and JSX projects cleanly.

Vitest APIs are available from vite-plus/test, so a single vite-plus install is enough — you do not need to install vitest directly:

src/example.test.ts
ts
import { describe, expect, it, vi } from 'vite-plus/test';

For the browser mode subpaths (vite-plus/test/browser*), see Migrating Vitest.

INFO

vp test always runs the built-in Vitest command. If your project also has a test script in package.json, run vp run test when you want to run that script instead. See Built-in Commands vs Scripts.

Usage ​

bash
vp test
vp test watch
vp test run --coverage

INFO

Unlike Vitest on its own, vp test does not stay in watch mode by default. Use vp test when you want a normal test run, and use vp test watch when you want to jump into watch mode.

Configuration ​

Put test configuration directly in the test block in vite.config.ts so all your configuration stays in one place. We do not recommend using vitest.config.ts with Vite+.

vite.config.ts
ts
import { defineConfig } from 'vite-plus';

export default defineConfig({
  test: {
    include: ['src/**/*.test.ts'],
  },
});

For the full Vitest configuration reference, see the Vitest config docs.