diff --git a/e2e/helpers.ts b/e2e/helpers.ts index 7760b065b..1d169016c 100644 --- a/e2e/helpers.ts +++ b/e2e/helpers.ts @@ -1,7 +1,7 @@ import { E2EMessage } from './types'; import { PNG } from 'pngjs'; import fs from 'node:fs'; -import pixelmatch from 'pixelmatch'; +import blazediff from '@blazediff/core'; const replacer = (key: string, value: any) => { if (key === 'type' && typeof value !== 'string') return value.displayName; @@ -36,7 +36,7 @@ export const compareImages = ( width: referencePng.width, }); - const pixelDiff = pixelmatch( + const diff = blazediff( referencePng.data, responsePng.data, diffPng.data, @@ -53,5 +53,5 @@ export const compareImages = ( if (opts.diffFilePath) { fs.writeFileSync(opts.diffFilePath, PNG.sync.write(diffPng)); } - return pixelDiff; + return diff; }; diff --git a/e2e/references/1.png b/e2e/references/1.png index 8b034a502..26630e001 100644 Binary files a/e2e/references/1.png and b/e2e/references/1.png differ diff --git a/e2e/references/2.png b/e2e/references/2.png index f1db43845..2d0e5249e 100644 Binary files a/e2e/references/2.png and b/e2e/references/2.png differ diff --git a/e2e/references/3.png b/e2e/references/3.png index 2724d2ea2..5ca40662a 100644 Binary files a/e2e/references/3.png and b/e2e/references/3.png differ diff --git a/package.json b/package.json index fe86447c3..c0c070d6e 100644 --- a/package.json +++ b/package.json @@ -77,12 +77,12 @@ "devDependencies": { "@babel/core": "^7.25.2", "@babel/preset-env": "^7.25.3", + "@blazediff/core": "^1.1.0", "@react-native/babel-preset": "^0.77.0", "@react-native/eslint-config": "^0.77.0", "@types/css-tree": "^1.0.3", "@types/jest": "^27.5.2", "@types/node": "*", - "@types/pixelmatch": "^5.2.0", "@types/pngjs": "^6.0.5", "@types/react": "^18.3.12", "@types/ws": "^8.5.13", @@ -105,7 +105,6 @@ "lint-staged": "^13.0.3", "peggy": "4.0.3", "pegjs": "^0.10.0", - "pixelmatch": "5.3.0", "pngjs": "^7.0.0", "prettier": "3.0.1", "puppeteer": "^22.12.1", diff --git a/yarn.lock b/yarn.lock index 2259d76c6..69b2589bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1093,6 +1093,18 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@blazediff/core@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@blazediff/core/-/core-1.1.0.tgz#c3134e1f3831f31a00c7978dddf9b4eb324aac63" + integrity sha512-f1qdZ2Z0f9bqityiH07mFz29uVGBL9QySKFpBz6dyTjt5ucCdW0pb4umTepZI5rKJVzaw0ZAsE7VoGC56usO/g== + dependencies: + "@blazediff/types" "1.1.0" + +"@blazediff/types@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@blazediff/types/-/types-1.1.0.tgz#84aee46e986c310d8341c461b7f676eaade42204" + integrity sha512-yNTG53982iTy6sFzEdxnt0pLcFyMuLVY+FKaeMQiyeCaOjELGmELmamDxltIHfDnr8/laxijPgdnmTRy58sOiQ== + "@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" @@ -2480,13 +2492,6 @@ resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.2.tgz#5950e50960793055845e956c427fc2b0d70c5239" integrity sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw== -"@types/pixelmatch@^5.2.0": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@types/pixelmatch/-/pixelmatch-5.2.6.tgz#fba6de304ac958495f27d85989f5c6bb7499a686" - integrity sha512-wC83uexE5KGuUODn6zkm9gMzTwdY5L0chiK+VrKcDfEjzxh1uadlWTvOmAbCpnM9zx/Ww3f8uKlYQVnO/TrqVg== - dependencies: - "@types/node" "*" - "@types/pngjs@^6.0.5": version "6.0.5" resolved "https://registry.yarnpkg.com/@types/pngjs/-/pngjs-6.0.5.tgz#6dec2f7eb8284543ca4e423f3c09b119fa939ea3" @@ -8078,13 +8083,6 @@ pirates@^4.0.4, pirates@^4.0.6: resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22" integrity sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA== -pixelmatch@5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/pixelmatch/-/pixelmatch-5.3.0.tgz#5e5321a7abedfb7962d60dbf345deda87cb9560a" - integrity sha512-o8mkY4E/+LNUf6LzX96ht6k6CEDi65k9G2rjMtBe9Oo+VPKSvl+0GKHuH/AlG+GA5LPG/i5hrekkxUc3s2HU+Q== - dependencies: - pngjs "^6.0.0" - pkg-dir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" @@ -8106,11 +8104,6 @@ pkg-up@^3.1.0: dependencies: find-up "^3.0.0" -pngjs@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-6.0.0.tgz#ca9e5d2aa48db0228a52c419c3308e87720da821" - integrity sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg== - pngjs@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-7.0.0.tgz#a8b7446020ebbc6ac739db6c5415a65d17090e26"