Commit 12487535 authored by Lukas Eipert's avatar Lukas Eipert

Remove unused pixelmatch dependency

We recently removed favicon specs from karma, which were the only ones
utilizing the pixelmatch library.

See: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50530
parent 595accbe
import pixelmatch from 'pixelmatch';
export default {
toImageDiffEqual: () => {
const getImageData = (img) => {
const canvas = document.createElement('canvas');
canvas.width = img.width;
canvas.height = img.height;
canvas.getContext('2d').drawImage(img, 0, 0);
return canvas.getContext('2d').getImageData(0, 0, img.width, img.height).data;
};
return {
compare(actual, expected, threshold = 0.1) {
if (actual.height !== expected.height || actual.width !== expected.width) {
return {
pass: false,
message: `Expected image dimensions (h x w) of ${expected.height}x${expected.width}.
Received an image with ${actual.height}x${actual.width}`,
};
}
const { width, height } = actual;
const differentPixels = pixelmatch(
getImageData(actual),
getImageData(expected),
null,
width,
height,
{ threshold },
);
return {
pass: differentPixels < 20,
message: `${differentPixels} pixels differ more than ${
threshold * 100
} percent between input and output.`,
};
},
};
},
};
......@@ -12,7 +12,6 @@ import Vue from 'vue';
import { getDefaultAdapter } from '~/lib/utils/axios_utils';
import Translate from '~/vue_shared/translate';
import customMatchers from './matchers';
import { FIXTURES_PATH, TEST_HOST } from './test_constants';
// Tech debt issue TBD
......@@ -57,7 +56,6 @@ beforeAll(() => {
inline: window.__karma__.config.color,
}),
);
jasmine.addMatchers(customMatchers);
});
// globalize common libraries
......
......@@ -9346,13 +9346,6 @@ pirates@^4.0.1:
dependencies:
node-modules-regexp "^1.0.0"
pixelmatch@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/pixelmatch/-/pixelmatch-4.0.2.tgz#8f47dcec5011b477b67db03c243bc1f3085e8854"
integrity sha1-j0fc7FARtHe2fbA8JDvB8wheiFQ=
dependencies:
pngjs "^3.0.0"
pkg-dir@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b"
......@@ -9374,11 +9367,6 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0:
dependencies:
find-up "^4.0.0"
pngjs@^3.0.0:
version "3.3.3"
resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.3.3.tgz#85173703bde3edac8998757b96e5821d0966a21b"
integrity sha512-1n3Z4p3IOxArEs1VRXnZ/RXdfEniAUS9jb68g58FIXMNkPJeZd+Qh4Uq7/e0LVxAQGos1eIUrqrt4FpjdnEd+Q==
pofile@1.0.x:
version "1.0.11"
resolved "https://registry.yarnpkg.com/pofile/-/pofile-1.0.11.tgz#35aff58c17491d127a07336d5522ebc9df57c954"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment