diff --git a/NOTICE b/NOTICE index dcad7ee..f24fe33 100644 --- a/NOTICE +++ b/NOTICE @@ -1165,7 +1165,7 @@ fetch-blob under the MIT license. node-domexception under the MIT license. web-streams-polyfill under the MIT license. formdata-polyfill under the MIT license. -pixelmatch under the ISC license. +blazediff under the MIT license. vite-plugin-eslint2 under the MIT license. @types/eslint under the MIT license. @types/json-schema under the MIT license. diff --git a/source/frontend/package-lock.json b/source/frontend/package-lock.json index b4f4533..db27a38 100644 --- a/source/frontend/package-lock.json +++ b/source/frontend/package-lock.json @@ -51,6 +51,7 @@ "@babel/plugin-transform-runtime": "^7.9.6", "@babel/preset-env": "^7.8.7", "@babel/preset-react": "^7.8.3", + "@blazediff/core": "^1.0.0", "@testing-library/jest-dom": "^6.4.2", "@testing-library/react": "^14.2.1", "@testing-library/user-event": "^14.5.2", @@ -67,7 +68,6 @@ "jsdom": "^22.1.0", "msw": "^2.4.9", "node-fetch": "^3.3.1", - "pixelmatch": "^7.1.0", "playwright": "^1.51.1", "pngjs": "^7.0.0", "prettier": "^3.0.0", @@ -8670,6 +8670,22 @@ "node": ">=18" } }, + "node_modules/@blazediff/core": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@blazediff/core/-/core-1.0.0.tgz", + "integrity": "sha512-k+SQhaWhf6NiTTDHkIM1OaWu2HhN8/1LsGv6G7a18CKmPrLHEG9qRJzKrMq3MlqlwtzzIQcQNB4VfNbnAoEPpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@blazediff/types": "1.0.0" + } + }, + "node_modules/@blazediff/types": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@blazediff/types/-/types-1.0.0.tgz", + "integrity": "sha512-uV3SnRogVgXeSgFY9PVDOneHI6/jmx/KSXkzPYBTwLOpb94YTm7aVWkJMoIDasCXShu9B3JBOVF7l/+JsMqVJg==", + "dev": true + }, "node_modules/@bundled-es-modules/cookie": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@bundled-es-modules/cookie/-/cookie-2.0.1.tgz", @@ -19217,19 +19233,6 @@ "node": ">= 6" } }, - "node_modules/pixelmatch": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-7.1.0.tgz", - "integrity": "sha512-1wrVzJ2STrpmONHKBy228LM1b84msXDUoAzVEl0R8Mz4Ce6EPr+IVtxm8+yvrqLYMHswREkjYFaMxnyGnaY3Ng==", - "dev": true, - "license": "ISC", - "dependencies": { - "pngjs": "^7.0.0" - }, - "bin": { - "pixelmatch": "bin/pixelmatch" - } - }, "node_modules/playwright": { "version": "1.51.1", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.51.1.tgz", diff --git a/source/frontend/package.json b/source/frontend/package.json index 0f88b5d..f2a3d0b 100644 --- a/source/frontend/package.json +++ b/source/frontend/package.json @@ -14,6 +14,7 @@ "@babel/plugin-transform-runtime": "^7.9.6", "@babel/preset-env": "^7.8.7", "@babel/preset-react": "^7.8.3", + "@blazediff/core": "^1.0.0", "@testing-library/jest-dom": "^6.4.2", "@testing-library/react": "^14.2.1", "@testing-library/user-event": "^14.5.2", @@ -30,7 +31,6 @@ "jsdom": "^22.1.0", "msw": "^2.4.9", "node-fetch": "^3.3.1", - "pixelmatch": "^7.1.0", "playwright": "^1.51.1", "pngjs": "^7.0.0", "prettier": "^3.0.0", diff --git a/source/frontend/src/tests/vitest/commands/screenshot.js b/source/frontend/src/tests/vitest/commands/screenshot.js index 0c7771a..9f87c8e 100644 --- a/source/frontend/src/tests/vitest/commands/screenshot.js +++ b/source/frontend/src/tests/vitest/commands/screenshot.js @@ -3,7 +3,7 @@ import {promises as fs} from 'node:fs'; import path from 'node:path'; -import pixelmatch from 'pixelmatch'; +import blazediff from '@blazediff/core'; import {PNG} from 'pngjs'; /** @@ -30,7 +30,7 @@ export const compareScreenshot = async (context, screenshotPath, options) => { testName, baselineDir = `${testDir}/__image_snapshots__`, diffDir = `${testDir}/__image_diffs__`, - threshold = 0.1, // recommended default in pixelmatch docs + threshold = 0.1, // recommended default in blazediff docs maxDiffPercentage = 1.0, updateBaseline = process.env.UPDATE_SNAPSHOTS === 'true', } = options; @@ -73,12 +73,12 @@ export const compareScreenshot = async (context, screenshotPath, options) => { }; } - // Create empty diff image buffer (pixelmatch will mutate this buffer to store the diff) + // Create empty diff image buffer (blazediff will mutate this buffer to store the diff) const {width, height} = img1; const diff = new PNG({width, height}); // Compare images - const numDiffPixels = pixelmatch( + const numDiffPixels = blazediff( img1.data, img2.data, diff.data,