Skip to content

Commit

Permalink
pin sharp version
Browse files Browse the repository at this point in the history
  • Loading branch information
gugu committed Mar 4, 2024
1 parent 8da9659 commit 224faa9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 324 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:

steps:
- uses: actions/checkout@v4
- run: sudo apt install -y libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
Expand Down
331 changes: 14 additions & 317 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@
"sharp": "^0.33.2"
},
"overrides": {
"jsdom": {
"canvas": "^0.1.50"
}
"jsdom": {
"canvas": "^0.1.50"
},
"sharp": "$sharp"
},
"engines": {
"node": ">=18"
Expand Down
5 changes: 3 additions & 2 deletions src/tests/_common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ export const assertEqual = async (t: ExecutionContext<unknown>, filename: string
`${goldenDir}/${filename}`,
{ strict: true }
);
t.assert(lsRes.equal);
t.assert(lsRes.equal, `Images are different: ${filename}`);

} else if (!filename.endsWith("pdf")) {
const f1 = (await readFile(`${generatedImageDir}/${filename}`)).toString();
const f2 = (await readFile(`${goldenDir}/${filename}`)).toString();
if (f1 !== f2) {
for (const el of diff.diffLines(XMLFormatter(f1), XMLFormatter(f2), { newlineIsToken: true })) {
console.log(el.added ? chalk.bold.green(el.value) : chalk.bold.red(el.value));
};
t.fail();
t.fail(`Files are different: ${generatedImageDir}/${filename} and ${goldenDir}/${filename}`);
} else {
t.pass();
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ interface TestParams {
{
name: "SVG with colors (hex)",
fn: getSVG,
filename: "qr_with_colors.svg",
filename: "qr_with_colors_hex.svg",
params: {
color: '#ff0000',
bgColor: '#00ff00',
Expand Down
1 change: 1 addition & 0 deletions test_data/golden/qr_with_colors_hex.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test_data/golden/qr_with_logo_jpg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 224faa9

Please sign in to comment.