Skip to content

Features of the Vitest plugin

Each row names one capability, says what it does, and links to the page that teaches it.

Feature What it does Guide
Automatic snapshots Takes a snapshot at the end of every test that rendered content. Automatic snapshots
Manual snapshots Takes a snapshot of an element, a locator or a base64 image where you call the matcher. Manual snapshots
Page and full-page snapshots Captures the viewport, or the whole scrollable page. Full-page and viewport snapshots
Snapshot subject Snapshots a chosen element instead of document.body. Automatic snapshots
Snapshot existence check page.hasImageSnapshot() tells whether a snapshot exists. Manual snapshots
Feature What it does Guide
Themes One snapshot per theme for each test. Themes
Viewports and browsers One set of snapshots per Vitest browser instance. Viewports and multiple instances
Workspaces Separate options and snapshot folders for each Vitest project. Workspaces and multiple configs
Feature What it does Guide
Pixel and SSIM comparison Chooses how two images are compared. Thresholds and comparison
Failure thresholds Allows a number or a percentage of pixels to differ. Thresholds and comparison
Per-test overrides Changes the options for one file, one test or one call. Thresholds and comparison
Diff image, regions file and review image Written next to the diff when a snapshot fails. Reviewing failures
Agent review A skill that tells a coding agent to read the review image first. Reviewing failures with agents
Creating baselines Writes a missing baseline with vitest -u or createMissingBaseline. Manual snapshots
Feature What it does Guide
Per-platform baselines Keeps a baseline folder for each operating system on CI. CI
Snapshot paths Changes the root folder, the sub-path and the key. Configuration reference
Long path shortening Keeps paths within Windows limits. shortenLongSnapshotPaths
Playwright and WebdriverIO Works with either Vitest browser provider. Configuration
llms.txt Lists the pages and the public API for coding agents. llms.txt
Feature What it does Reference
Client API The browser-side building blocks that storybook-addon-vis uses. client-api
Server utilities Folder constants and path helpers for Node.js code. server-utils
Testing helpers A sample image and a stub for testing your own integration. testing