finds.dev← search

// the find

jaredpalmer/cypress-image-snapshot

★ 888 · JavaScript · MIT · updated Apr 2024

Catch visual regressions in Cypress

A thin adapter that wires jest-image-snapshot's pixel-diffing engine into Cypress commands and plugins, so you can call cy.matchImageSnapshot() inside a normal Cypress test to catch visual regressions. Aimed at teams already running Cypress for e2e who want screenshot diffing without adopting a separate visual-testing service.

It doesn't reinvent diffing — it delegates to jest-image-snapshot's pixelmatch-based comparison, so the threshold/anti-aliasing options are the same ones a lot of teams already know from Jest. Failure feedback is unusually good for a free tool: the Cypress GUI shows the diff inline, there's a composite image output, and an optional terminal reporter that renders diffs directly in iTerm2. Options pass straight through to both cy.screenshot() and jest-image-snapshot, so per-test overrides (threshold, capture area, custom dirs) don't require fighting the API.

The README still documents cypress/plugins/index.js and cypress.json — the config format Cypress deprecated back in v10 in favor of cypress.config.js and setupNodeEvents. There's no mention of the new config anywhere, which means anyone on a current Cypress version has to figure out the migration themselves. Baselines are PNGs committed straight to the repo with no cloud storage or baseline-approval workflow, so visual changes show up as unreviewable binary diffs in PRs and the repo grows with every screenshot. Screenshot diffing is inherently flaky across OS/GPU/font-rendering differences, and nothing here addresses that beyond a basic percent threshold — CI runners and local machines will produce different baselines unless you're careful to run both in Docker. Last push April 2024 with no apparent major-version activity since; worth checking issues for open PRs before betting on it over newer alternatives (e.g. Cypress's own experimental screenshot diffing or cypress-visual-regression).

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →