Skip to content

Install the Vitest plugin

vitest-plugin-vis provides visual testing for tests running in Vitest Browser Mode.

Vitest 4 adds Visual Regression Test support natively. You can choose which method to use based on your needs.

Here is a comparison of the features between Vitest Visual Regression Test and vitest-plugin-vis.

Feature Vitest Visual Regression Test vitest-plugin-vis
Manual snapshot creation ✅ ✅
Automatic snapshot creation ❌ ✅
Multi-theme snapshots ❌ ✅
Comparison methods pixel, ssim, custom pixel, ssim
Threshold customization ✅ ✅
Fine-grained snapshot variations ❌ ✅
Masking elements ✅ 🚧

vitest-plugin-vis works with Vitest 2 or later.

For Vitest 2 or 3, please use vitest-plugin-vis v3.

Terminal window
npm install --save-dev vitest-plugin-vis
pnpm add --save-dev vitest-plugin-vis
yarn add --save-dev vitest-plugin-vis