Skip to content

Commit d96df92

Browse files
authored
feat: use blazediff to speed up visual diffs (#2023)
* feat: use blazediff to speed up visual diffs * feat: update to latest stable version
1 parent db13493 commit d96df92

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

__tests__/integration/utils/toMatchCanvasSnapshot.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from 'fs';
22
import * as path from 'path';
3-
import pixelmatch from 'pixelmatch';
3+
import blazediff from '@blazediff/core';
44
import { PNG } from 'pngjs';
55

66
export type ToMatchCanvasSnapshotOptions = {
@@ -33,8 +33,8 @@ function diff(
3333
output = diffPNG.data;
3434
}
3535

36-
// @see https://github.com/mapbox/pixelmatch#pixelmatchimg1-img2-output-width-height-options
37-
const mismatch = pixelmatch(img1.data, img2.data, output, width, height, {
36+
// @see https://github.com/teimurjan/blazediff?tab=readme-ov-file#configuration-options
37+
const mismatch = blazediff(img1.data, img2.data, output, width, height, {
3838
threshold: 0.1,
3939
});
4040

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"@babel/preset-env": "^7.25.4",
6060
"@babel/preset-react": "^7.24.7",
6161
"@babel/preset-typescript": "^7.24.7",
62+
"@blazediff/core": "^1.0.0",
6263
"@changesets/cli": "^2.26.2",
6364
"@commitlint/cli": "^8.3.6",
6465
"@commitlint/config-angular": "^9.1.2",
@@ -72,7 +73,6 @@
7273
"@types/fs-extra": "^11.0.4",
7374
"@types/jest": "^29.5.10",
7475
"@types/node": "^16.18.64",
75-
"@types/pixelmatch": "^5.2.6",
7676
"@types/pngjs": "^6.0.4",
7777
"@typescript-eslint/eslint-plugin": "^8.8.1",
7878
"@typescript-eslint/parser": "^8.8.1",
@@ -104,7 +104,6 @@
104104
"lint-staged": "^10.5.4",
105105
"markdownlint-cli": "^0.45.0",
106106
"npm-run-all": "^4.1.5",
107-
"pixelmatch": "^5.3.0",
108107
"playwright": "latest",
109108
"pngjs": "^6.0.0",
110109
"portfinder": "^1.0.32",

0 commit comments

Comments
 (0)