chore(deps)(deps-dev): bump pixelmatch from 5.3.0 to 7.2.0#1437
Merged
Conversation
Bumps [pixelmatch](https://github.com/mapbox/pixelmatch) from 5.3.0 to 7.2.0. - [Release notes](https://github.com/mapbox/pixelmatch/releases) - [Commits](mapbox/pixelmatch@v5.3.0...v7.2.0) --- updated-dependencies: - dependency-name: pixelmatch dependency-version: 7.2.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates the visual regression test setup to work with pixelmatch v7 by adjusting the import pattern and disabling checkerboard mode while bumping the pixelmatch dev dependency version and regenerating the lockfile. Sequence diagram for updated pixelmatch usage in visual regression testssequenceDiagram
participant Cypress
participant CypressPlugin as cypress/plugins/index_js
participant pixelmatch
Cypress->>CypressPlugin: invoke compareSnapshots task
CypressPlugin->>pixelmatch: pixelmatch(img1, img2, diff, width, height, { threshold: appliedThreshold, checkerboard: false })
pixelmatch-->>CypressPlugin: diffPixelCount
CypressPlugin-->>Cypress: diffPixelCount
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
const pixelmatch = require('pixelmatch').default || require('pixelmatch');line will executerequire('pixelmatch')twice; consider requiring once (e.g., assign to a temp variable and then use.default ||on that) to avoid redundant module loading. - Since disabling
checkerboardchanges the behavior of the visual diffing, it would help future readers to add an inline comment explaining why this is forced tofalserather than being configurable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `const pixelmatch = require('pixelmatch').default || require('pixelmatch');` line will execute `require('pixelmatch')` twice; consider requiring once (e.g., assign to a temp variable and then use `.default ||` on that) to avoid redundant module loading.
- Since disabling `checkerboard` changes the behavior of the visual diffing, it would help future readers to add an inline comment explaining why this is forced to `false` rather than being configurable.
## Individual Comments
### Comment 1
<location path="cypress/plugins/index.js" line_range="20-23" />
<code_context>
const fs = require('fs');
const path = require('path');
-const pixelmatch = require('pixelmatch');
+const pixelmatch = require('pixelmatch').default || require('pixelmatch');
const PNG = require('pngjs').PNG;
</code_context>
<issue_to_address>
**suggestion:** Avoid requiring the same module twice and reuse the loaded module instead.
This calls `require('pixelmatch')` twice, which is unnecessary and could trigger module init side effects twice. Instead, assign the module once and derive the export:
```js
const pixelmatchModule = require('pixelmatch');
const pixelmatch = pixelmatchModule.default || pixelmatchModule;
```
```suggestion
const fs = require('fs');
const path = require('path');
const pixelmatchModule = require('pixelmatch');
const pixelmatch = pixelmatchModule.default || pixelmatchModule;
const PNG = require('pngjs').PNG;
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
Author
Saksham-Sirohi
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Changed to
to support V7 since in V7,
require('pixelmatch')returns an unexpected object, not an expectedpixelmatechfunction.The advantages of upgrading
pixelmatechfrom 5.3.0 to 7.2.0:Motivation and Context
Take over #1405
How Has This Been Tested?
N/A
Screenshots (if appropriate):
N/A
Types of changes
Checklist:
py/visdom/VERSIONaccording to Semantic VersioningSummary by Sourcery
Update visual regression testing setup to align with the latest pixelmatch release and stabilize screenshot diffs.
Bug Fixes:
Enhancements: