Skip to content
PluginStats

vitest-visual-diff weekly downloads statistics

By acoyfellow · npm · Testing

Compare two live elements through structure, computed style, pixels, and accessibility in Vitest Browser Mode.

View on npm Fresh · Dec 6, 2026

vitest-visual-diff has 4 recorded weekly downloads on npm, unchanged over the past 30 days, ranking #3241 of 3,247 tracked listings.

Weekly downloads
4
Official API · Dec 5, 2026
7-day growth
-33.3%
-2 weekly downloads
30-day growth
0.0%
0 weekly downloads
90-day growth
+100%
+2 weekly downloads
Rank
#3241
▼ 150 in 7 days

About vitest-visual-diff

vitest-visual-diff

Docs · source

A Vitest matcher for Browser Mode that answers one question: are these two elements, rendered live in a real browser, actually the same?

import { expect, test } from 'vitest';
import { page } from 'vitest/browser';
import 'vitest-visual-diff';

test('the new checkbox renders the same as the old one', async () => {
  await expect(page.getByTestId('checkbox-new')).toMatchVisualDiff(
    page.getByTestId('checkbox-old'),
  );
});

If the answer is no, the failure tells you why — a missing element, a wrong color, a shifted pixel, or a broken screen-reader state — instead of just "these don't match."


Tutorial: your first comparison

This walks through comparing two elements in a real test, from an empty project to a passing (and then a deliberately failing) assertion.

1. Install it.

bun add -d github:acoyfellow/vitest-visual-diff vitest @vitest/browser @vitest/browser-playwright playwright
bunx playwright install chromium

2. Point Vitest at a real browser. Create vitest.config.ts:

import { defineConfig } from 'vitest/config';
import { playwright } from '@vitest/browser-playwright';

export default defineConfig({
  test: {
    setupFiles: ['vitest-visual-diff'],
    browser: {
      enabled: true,
      provider: playwright(),
      instances: [{ browser: 'chromium' }],
    },
  },
});

setupFiles: ['vitest-visual-diff'] registers toMatchVisualDiff on expect once, for every test file.

3. Write a test that mounts two elements and compares them.

// checkbox.test.ts
import { test, expect } from 'vitest';
import { page } from 'vitest/browser';

test('two identically-styled checkboxes match', async () => {
  const checkbox = (testId: string) => `
    <button data-testid="${testId}" role="checkbox" aria-checked="true"
      style="width:20px; height:20px; background:#2563eb; border-radius:4px;">
      <svg width="12" height="12"><path d="M2 6l3 3 5-7" stroke="white" stroke-width="2" fill="none"/></svg>
    </button>`;

  document.body.innerHTML = `
    <div style="position:fixed; top:0; left:0;">${checkbox('checkbox-old')}</div>
    <div style="position:fixed; top:100px; left:0;">${checkbox('checkbox-new')}</div>
  `;

  const oldCheckbox = page.getByTestId('checkbox-old');
  const newCheckbox = page.getByTestId('checkbox-new');

  await expect(newCheckbox).toMatchVisualDiff(oldCheckbox);
});

Run it: bun run test. It passes — same markup, same styles, same pixels.

4. Break something on purpose and watch the failure explain itself.

Remove the new checkbox's <svg> checkmark before the assertion (a real regression class: "the checkbox looks right until you check it, and then nothing appears"):

newCheckbox.element().querySelector('svg')?.remove();

Run it again. It fails, and the message says exactly what's wrong:

expected candidate to match visual-diff baseline (A=FAIL B=pass C=pass)
  structure: missing overall — {"svg":1,"path":1}

That's the shape of the whole library: every failure names the tier that caught it and the concrete thing that differed.

Why position:fixed on the two containers? Two elements sitting next to each other in normal page flow can round their own box height by a fraction of a pixel differently across browser engines (confirmed on Firefox specifically — see Why two fixed-positioned containers). Giving each container its own fixed position removes that coupling. If you're comparing two elements that are already isolated in their own containers (an iframe, a separate test render), you don't need this.


How-to guides

Compare two elements that don't have a stored baseline file

Use toMatchVisualDiff directly with two live elements — no reference image to commit, no --update workflow. This is the case for A/B component variants, a migration's before/after, or a design-reference iframe next to the real render.

await expect(candidate).toMatchVisualDiff(reference);
Skip the pixel check

Pass { pixels: false } when one side is a bare DOM Element (no screenshot capability) or when you only care about structure and style:

await expect(candidateElement).toMatchVisualDiff(referenceElement, { pixels: false });

pixels defaults to true automatically when both sides are Locators (screenshot-capable) and false when either side is a plain Element.

Catch an accessibility-only regression

Pass a11y: true to add two checks: Tier S compares accessible names, descriptions, and state; Tier R compares relationships such as label[for], aria-labelledby, and aria-describedby. This catches a checkbox whose aria-checked silently flipped and a label that no longer points to its control:

await expect(candidate).toMatchVisualDiff(reference, { a11y: true });
Tune the style comparison tolerance
await expect(candidate).toMatchVisualDiff(reference, {
  style: { tol: 1.5 }, // px tolerance for numeric style values
});
Tune the pixel-diff threshold
await expect(candidate).toMatchVisualDiff(reference, {
  pixelOpts: { threshold: 0.2, flagPct: 2.0 },
});
Run against a different browser engine

Nothing in vitest-visual-diff is Chromium-specific. Add more instances to vitest.config.ts:

browser: {
  enabled: true,
  provider: playwright(),
  instances: [
    { browser: 'chromium' },
    { browser: 'firefox' },
    { browser: 'webkit' },
  ],
}
Run against a different Vitest Browser Mode provider entirely

vitest-visual-diff never imports a provider package — it only uses the Locator/Element and .screenshot() surface Vitest itself hands the test. Swap @vitest/browser-playwright for @vitest/browser-webdriverio and nothing in src/ needs to change:…

Description from the npm listing.

  • vitest
  • vitest-plugin
  • visual-regression
  • visual-diff
  • browser-mode
  • custom-matcher
  • pixelmatch
  • accessibility

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-visual-diff weekly downloads on npm, last 90 days: 4 weekly downloads as of Dec 5, 2026, +100% over 90 days.vitest-visual-diffWeekly downloads on npm · Last 90 days4downloads / week+100% over 90 days02468101214Sep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
vitest-visual-diff weekly downloads on npm, last 90 days: 4 weekly downloads as of Dec 5, 2026, +100% over 90 days.

7/30/90-day growth

vitest-visual-diff weekly downloads growth on npm: -33.3% over 7 days, 0.0% over 30 days, +100% over 90 days.vitest-visual-diffWeekly downloads growth on npm4downloads / week now7-day growth-2 weekly downloads-33.3%30-day growth+0 weekly downloads0.0%90-day growth+2 weekly downloads+100%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
vitest-visual-diff weekly downloads growth on npm: -33.3% over 7 days, 0.0% over 30 days, +100% over 90 days.

Ranking history

vitest-visual-diff npm ranking history: currently #3241 (by weekly downloads).vitest-visual-diffnpm ranking · by weekly downloads · Last 90 days#3241current rank#2000#2200#2400#2600#2800#3000#3200#3400Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
vitest-visual-diff npm ranking history: currently #3241 (by weekly downloads).

Listing placement

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

Listing placement

Testing26 listings · 2 pages · page 2, #6 (overall #26)
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 (170)
Recent weekly downloads observations for vitest-visual-diff
Date (UTC)Weekly downloadsChange vs. previous
40
4-1
5+2
3+1
2-1
3+1
2-4
60
6+1
5-1
6-1
70
70
7—

Similar npm Testing plugins

All 20 vitest-visual-diff alternatives

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-visual-diff. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.