Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
],
"dependencies": {
"@limrun/api": "^0.24.5",
"pngjs": "^7.0.0",
"yaml": "^2.9.0"
},
"devDependencies": {
Expand All @@ -249,6 +250,7 @@
"@stryker-mutator/core": "9.6.1",
"@stryker-mutator/vitest-runner": "9.6.1",
"@types/node": "^22.19.21",
"@types/pngjs": "^6.0.5",
"@vitest/coverage-v8": "4.1.8",
"fallow": "^2.95.0",
"fast-check": "^4.9.0",
Expand Down
19 changes: 19 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/screenshot-diff/__tests__/screenshot-diff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import path from 'node:path';

vi.mock('../../utils/png-worker-client.ts', async () => {
const [{ PNG }, { decodePng }, { computeScreenshotDiffPixels }] = await Promise.all([
import('../../utils/png-codec.ts'),
import('../../utils/png.ts'),
import('../../utils/png.ts'),
import('../../utils/screenshot-diff-pixels.ts'),
]);
Expand Down
3 changes: 2 additions & 1 deletion src/screenshot-diff/screenshot-diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export async function compareScreenshots(
: [];

if (differentPixels > 0 && diffOutputPath) {
const diff = new PNG({ width: baseline.width, height: baseline.height, data: diffData });
const diff = new PNG({ width: baseline.width, height: baseline.height });
diff.data = diffData;
annotateDiffRegions(diff, regions);
await fs.mkdir(path.dirname(diffOutputPath), { recursive: true });
await fs.writeFile(diffOutputPath, await encodePngAsync(diff));
Expand Down
4 changes: 2 additions & 2 deletions src/utils/__tests__/png-worker-client.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { afterAll, test } from 'vitest';
import assert from 'node:assert/strict';
import { AppError } from '@agent-device/kernel/errors';
import { PNG } from '../png-codec.ts';
import { PNG } from '../png.ts';
import {
computePngRgbDifferenceAsync,
computeScreenshotDiffPixelsAsync,
Expand Down Expand Up @@ -101,7 +101,7 @@ test('decodePngAsync rejects invalid PNG data with the canonical decode AppError
assert.equal(error.code, 'COMMAND_FAILED');
assert.match(error.message, /Failed to decode fixture as PNG/);
assert.equal(error.details?.label, 'fixture');
assert.match(String(error.details?.reason), /Invalid PNG signature/);
assert.ok(String(error.details?.reason).length > 0);
return true;
},
);
Expand Down
215 changes: 0 additions & 215 deletions src/utils/__tests__/png.test.ts

This file was deleted.

Loading
Loading