Skip to content
PluginStats

vitest-image-snapshot weekly downloads statistics

npm · Testing

Visual regression testing for images. Compare rendered outputs against reference images to catch visual bugs.

View on npm Fresh · Dec 6, 2026

vitest-image-snapshot has 7,766 recorded weekly downloads on npm, a decrease of 59.9% over the past 30 days, ranking #1368 of 3,247 tracked listings.

Weekly downloads
7,766
Official API · Dec 5, 2026
7-day growth
+45.7%
+2.4K weekly downloads
30-day growth
-59.9%
-11.6K weekly downloads
90-day growth
-39.9%
-5.2K weekly downloads
Rank
#1368
▲ 106 in 7 days

About vitest-image-snapshot

Image Snapshot Testing

Visual regression testing for images. Compare rendered outputs against reference images to catch visual bugs.

  • Native vitest integratio
  • Accepts ImageData or PNG buffers - test WebGPU, Canvas, or any image processing
  • Aggregated HTML diff report for visual failures

Setup

1. Install
pnpm install --save-dev vitest-image-snapshot
2. Import in your test file
import { imageMatcher } from "vitest-image-snapshot";

imageMatcher(); // Call once at the top level
3. (Optional) Configure HTML diff report

Configure the reporter in vitest.config.ts:

import { defineConfig } from 'vitest/config'
import { fileURLToPath } from 'node:url'
import { dirname, join } from 'node:path'

const __dirname = dirname(fileURLToPath(import.meta.url))

export default defineConfig({
  test: {
    include: ['src/test/**/*.test.ts'],
    reporters: [
      'default',
      ['vitest-image-snapshot/reporter', {
        reportPath: join(__dirname, '__image_diff_report__'),  // Absolute path recommended for monorepos
        autoOpen: 'failures',  // Auto-open report in browser on failures (or 'always' to always open or 'never')
      }]
    ],
  },
})

Default behavior (no configuration):

  • Report location: {vitest.config.root}/__image_diff_report__/index.html
  • Auto-open: failures (can override with IMAGE_DIFF_AUTO_OPEN=always or IMAGE_DIFF_AUTO_OPEN=never env var)

Configuration options:

  • reportPath: Absolute or relative to config.root (default: '__image_diff_report__')
  • autoOpen: Auto-open report in browser on failures, always or never (default: 'failures' or 'never' on CI)
  • port: Port for html report server (default: 4343)

Basic Usage

Accepts standard browser ImageData or Buffer (pre-encoded PNGs):

// With ImageData (from canvas, shader tests, etc.)
await expect(imageData).toMatchImage("snapshot-name");

// With Buffer (pre-encoded PNG)
await expect(pngBuffer).toMatchImage("snapshot-name");

// Auto-generated name from test name (single snapshot per test only)
await expect(imageData).toMatchImage();
Options
await expect(imageData).toMatchImage({
  name: "edge-detection",
  threshold: 0.2,  // Allow more color variation
});

See Match Options for all available configuration options.

Updating Snapshots

When you intentionally change shader behavior:

# Update all snapshots
pnpm vitest -- -u

# Update specific test file
pnpm vitest ImageSnapshot.test.ts -- -u

Diff Report

If you added ImageSnapshotReporter to vitest.config.ts, failed tests generate a self-contained HTML report with:

  • Expected vs Actual side-by-side
  • Diff visualization (mismatched pixels highlighted)
  • Mismatch statistics
  • All images copied to report directory (portable and shareable)

Default location: {vitest.config.root}/__image_diff_report__/index.html

Monorepo behavior: In workspace mode (running tests from workspace root), each package's report goes to its own directory when using absolute paths in config.

Auto-open on failure:

IMAGE_DIFF_AUTO_OPEN=failures pnpm vitest

# Always auto-open
IMAGE_DIFF_AUTO_OPEN=always pnpm vitest

Or enable via inline reporter config:

reporters: [
  'default',
  ['vitest-image-snapshot/reporter', { autoOpen: 'failures' /* or 'always' or 'never' */ }]
]

IMAGE_DIFF_AUTO_OPEN will override reporter config if both are set.

CI

When a CI environment is detected then IMAGE_DIFF_AUTO_OPEN and config options are ignored and autoOpen is set to "never".

The report is still generated and can be saved as an artifact for review or published to a static hosting service if you prefer.

Directory Structure

package-root/
├── src/test/
│   ├── ImageSnapshot.test.ts
│   ├── __image_snapshots__/       # Reference images (commit to git)
│   │   └── snapshot-name.png
│   ├── __image_actual__/          # Current test outputs (gitignore, always saved)
│   │   └── snapshot-name.png
│   └── __image_diffs__/           # Diff visualizations (gitignore, only on failure)
│       └── snapshot-name.png
└── __image_diff_report__/         # HTML report (gitignore, self-contained)
    ├── index.html
    └── src/test/                  # Copied images preserving directory structure
        ├── __image_snapshots__/
        ├── __image_actual__/
        └── __image_diffs__/

Notes:

  • __image_actual__/ saves on every run (pass or fail) for manual inspection
  • Report copies all images to __image_diff_report__/ preserving directory structure
  • Report is self-contained and portable (can be zipped, shared, or committed)

API Reference

toMatchImage()

Vitest matcher for comparing images against reference snapshots.

await expect(imageData).toMatchImage(nameOrOptions?)
Parameters:
  • imageData: ImageData | Buffer - Image to compare
  • nameOrOptions?: string | MatchImageOptions - Snapshot name or options
Match Options:
interface MatchImageOptions {
  name?: string;                    // Snapshot name (default: auto-generated from test name)
  threshold?: number;               // Color difference threshold 0-1 (default: 0.1)
  allowedPixelRatio?: number;       // Max ratio of pixels allowed to differ 0-1 (default: 0)
  allowedPixels?: number;           // Max absolute pixels allowed to differ (default: 0)
  includeAA?: boolean;              // Disable AA detection if true (default: false)
}
How Comparison Works

Image comparison uses pixelmatch, which converts RGB to YIQ color space for perceptually-weighted comparison. YIQ separates luminance (Y) from chrominance (I, Q), making the comparison more aligned with human perception than raw RGB byte comparison.

The threshold option (0-1) controls sensitivity to color differences in YIQ space.…

Description from the npm listing.

  • image
  • snapshot
  • testing
  • visual-regression
  • vitest
  • vitest-plugin

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

vitest-image-snapshot weekly downloads on npm, last 90 days: 7,766 weekly downloads as of Dec 5, 2026, -39.9% over 90 days.vitest-image-snapshotWeekly downloads on npm · Last 90 days7,766downloads / week-39.9% over 90 days05K10K15K20KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
vitest-image-snapshot weekly downloads on npm, last 90 days: 7,766 weekly downloads as of Dec 5, 2026, -39.9% over 90 days.

7/30/90-day growth

vitest-image-snapshot weekly downloads growth on npm: +45.7% over 7 days, -59.9% over 30 days, -39.9% over 90 days.vitest-image-snapshotWeekly downloads growth on npm7,766downloads / week now7-day growth+2,437 weekly downloads+45.7%30-day growth-11,577 weekly downloads-59.9%90-day growth-5,160 weekly downloads-39.9%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
vitest-image-snapshot weekly downloads growth on npm: +45.7% over 7 days, -59.9% over 30 days, -39.9% over 90 days.

Ranking history

vitest-image-snapshot npm ranking history: currently #1368 (by weekly downloads).vitest-image-snapshotnpm ranking · by weekly downloads · Last 90 days#1368current rank#400#600#800#1000#1200#1400#1600Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 17, 2026 – Dec 6, 2026 · 45 observations · Updated Dec 5, 2026pluginstats.com
vitest-image-snapshot npm ranking history: currently #1368 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 69, #8 (overall #1,368)
All npm: every listing in weekly downloads order

Listing placement

Testing26 listings · 2 pages · page 1, #5 (overall #5)
Testing: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (592)
Recent weekly downloads observations for vitest-image-snapshot
Date (UTC)Weekly downloadsChange vs. previous
7,766+58
7,708+120
7,588+1.2K
6,405+786
5,619+515
5,104-126
5,230-99
5,329-369
5,698-1.3K
7,015-818
7,833-106
7,939-92
8,031-1K
9,038—

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/vitest-image-snapshot. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.