@kiwa-test/visual 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cardene777
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ comparePngBuffers: () => comparePngBuffers,
34
+ expectNoVisualDiff: () => expectNoVisualDiff
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+
38
+ // src/compare.ts
39
+ async function loadPixelmatch() {
40
+ try {
41
+ const mod = await import("pixelmatch");
42
+ return mod.default ?? mod;
43
+ } catch {
44
+ throw new Error('comparePngBuffers requires "pixelmatch". Run `pnpm add -D pixelmatch`.');
45
+ }
46
+ }
47
+ async function loadPng() {
48
+ try {
49
+ const mod = await import("pngjs");
50
+ return mod.PNG ?? mod.default?.PNG ?? mod.PNG;
51
+ } catch {
52
+ throw new Error('comparePngBuffers requires "pngjs". Run `pnpm add -D pngjs`.');
53
+ }
54
+ }
55
+ async function comparePngBuffers(baseline, actual, opts = {}) {
56
+ const png = await loadPng();
57
+ const a = png.sync.read(baseline);
58
+ const b = png.sync.read(actual);
59
+ if (a.width !== b.width || a.height !== b.height) {
60
+ throw new Error(
61
+ `comparePngBuffers: size mismatch ${a.width}x${a.height} vs ${b.width}x${b.height}. Resize before comparing.`
62
+ );
63
+ }
64
+ const pixelmatch = await loadPixelmatch();
65
+ const { width, height } = a;
66
+ const emit = opts.emitDiff ?? true;
67
+ const diff = emit ? Buffer.alloc(width * height * 4) : null;
68
+ const diffPixels = pixelmatch(a.data, b.data, diff, width, height, {
69
+ threshold: opts.threshold ?? 0.1,
70
+ includeAA: opts.includeAA ?? false
71
+ });
72
+ const totalPixels = width * height;
73
+ const diffRatio = totalPixels === 0 ? 0 : diffPixels / totalPixels;
74
+ const maxDiffRatio = opts.maxDiffRatio ?? 5e-3;
75
+ return {
76
+ size: { width, height },
77
+ diffPixels,
78
+ diffRatio,
79
+ ok: diffRatio <= maxDiffRatio + 1e-7,
80
+ diffBuffer: diff ? png.sync.write({ width, height, data: diff }) : null
81
+ };
82
+ }
83
+ function expectNoVisualDiff(result, expect) {
84
+ if (!result.ok) {
85
+ throw new Error(
86
+ `Visual diff exceeded threshold: ${result.diffPixels} pixels (${(result.diffRatio * 100).toFixed(2)}%).`
87
+ );
88
+ }
89
+ expect(result.ok).toBe(true);
90
+ }
91
+ // Annotate the CommonJS export names for ESM import in node:
92
+ 0 && (module.exports = {
93
+ comparePngBuffers,
94
+ expectNoVisualDiff
95
+ });
96
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/compare.ts"],"sourcesContent":["export type { CompareOptions, CompareResult, PixelSize } from './types.js';\nexport { comparePngBuffers, expectNoVisualDiff } from './compare.js';\n","import type { CompareOptions, CompareResult } from './types.js';\n\ninterface PixelmatchFn {\n (\n img1: Uint8Array | Buffer,\n img2: Uint8Array | Buffer,\n output: Uint8Array | Buffer | null,\n width: number,\n height: number,\n options?: { threshold?: number; includeAA?: boolean },\n ): number;\n}\n\ninterface PngStatic {\n sync: {\n read: (buffer: Buffer) => { width: number; height: number; data: Buffer };\n write: (image: { width: number; height: number; data: Buffer | Uint8Array }) => Buffer;\n };\n}\n\nasync function loadPixelmatch(): Promise<PixelmatchFn> {\n try {\n const mod = (await import('pixelmatch')) as unknown as { default?: PixelmatchFn } & {\n default: PixelmatchFn;\n };\n return mod.default ?? (mod as unknown as PixelmatchFn);\n } catch {\n throw new Error('comparePngBuffers requires \"pixelmatch\". Run `pnpm add -D pixelmatch`.');\n }\n}\n\nasync function loadPng(): Promise<PngStatic> {\n try {\n const mod = (await import('pngjs')) as unknown as { PNG: PngStatic } & { default?: { PNG: PngStatic } };\n return mod.PNG ?? mod.default?.PNG ?? (mod as unknown as { PNG: PngStatic }).PNG;\n } catch {\n throw new Error('comparePngBuffers requires \"pngjs\". Run `pnpm add -D pngjs`.');\n }\n}\n\nexport async function comparePngBuffers(\n baseline: Buffer,\n actual: Buffer,\n opts: CompareOptions = {},\n): Promise<CompareResult> {\n const png = await loadPng();\n const a = png.sync.read(baseline);\n const b = png.sync.read(actual);\n if (a.width !== b.width || a.height !== b.height) {\n throw new Error(\n `comparePngBuffers: size mismatch ${a.width}x${a.height} vs ${b.width}x${b.height}. Resize before comparing.`,\n );\n }\n const pixelmatch = await loadPixelmatch();\n const { width, height } = a;\n const emit = opts.emitDiff ?? true;\n const diff = emit ? Buffer.alloc(width * height * 4) : null;\n const diffPixels = pixelmatch(a.data, b.data, diff as Buffer | null, width, height, {\n threshold: opts.threshold ?? 0.1,\n includeAA: opts.includeAA ?? false,\n });\n const totalPixels = width * height;\n const diffRatio = totalPixels === 0 ? 0 : diffPixels / totalPixels;\n const maxDiffRatio = opts.maxDiffRatio ?? 0.005;\n return {\n size: { width, height },\n diffPixels,\n diffRatio,\n ok: diffRatio <= maxDiffRatio + 0.0000001,\n diffBuffer: diff\n ? png.sync.write({ width, height, data: diff })\n : null,\n };\n}\n\nexport function expectNoVisualDiff(\n result: CompareResult,\n expect: { (actual: unknown): { toBe: (expected: unknown) => void } },\n): void {\n if (!result.ok) {\n throw new Error(\n `Visual diff exceeded threshold: ${result.diffPixels} pixels (${(result.diffRatio * 100).toFixed(2)}%).`,\n );\n }\n expect(result.ok).toBe(true);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AA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aAAa,eAAe;AAAA,IAChC,YAAY,OACR,IAAI,KAAK,MAAM,EAAE,OAAO,QAAQ,MAAM,KAAK,CAAC,IAC5C;AAAA,EACN;AACF;AAEO,SAAS,mBACd,QACA,QACM;AACN,MAAI,CAAC,OAAO,IAAI;AACd,UAAM,IAAI;AAAA,MACR,mCAAmC,OAAO,UAAU,aAAa,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC;AAAA,IACrG;AAAA,EACF;AACA,SAAO,OAAO,EAAE,EAAE,KAAK,IAAI;AAC7B;","names":[]}
@@ -0,0 +1,30 @@
1
+ interface PixelSize {
2
+ width: number;
3
+ height: number;
4
+ }
5
+ interface CompareResult {
6
+ size: PixelSize;
7
+ diffPixels: number;
8
+ diffRatio: number;
9
+ ok: boolean;
10
+ diffBuffer: Buffer | null;
11
+ }
12
+ interface CompareOptions {
13
+ /** Maximum mismatched pixel ratio allowed (0-1, default 0.005 = 0.5%) */
14
+ maxDiffRatio?: number;
15
+ /** Pixelmatch threshold (default 0.1) */
16
+ threshold?: number;
17
+ /** Whether to populate the diff PNG buffer (default true) */
18
+ emitDiff?: boolean;
19
+ /** Antialiasing tolerance (default false) */
20
+ includeAA?: boolean;
21
+ }
22
+
23
+ declare function comparePngBuffers(baseline: Buffer, actual: Buffer, opts?: CompareOptions): Promise<CompareResult>;
24
+ declare function expectNoVisualDiff(result: CompareResult, expect: {
25
+ (actual: unknown): {
26
+ toBe: (expected: unknown) => void;
27
+ };
28
+ }): void;
29
+
30
+ export { type CompareOptions, type CompareResult, type PixelSize, comparePngBuffers, expectNoVisualDiff };
@@ -0,0 +1,30 @@
1
+ interface PixelSize {
2
+ width: number;
3
+ height: number;
4
+ }
5
+ interface CompareResult {
6
+ size: PixelSize;
7
+ diffPixels: number;
8
+ diffRatio: number;
9
+ ok: boolean;
10
+ diffBuffer: Buffer | null;
11
+ }
12
+ interface CompareOptions {
13
+ /** Maximum mismatched pixel ratio allowed (0-1, default 0.005 = 0.5%) */
14
+ maxDiffRatio?: number;
15
+ /** Pixelmatch threshold (default 0.1) */
16
+ threshold?: number;
17
+ /** Whether to populate the diff PNG buffer (default true) */
18
+ emitDiff?: boolean;
19
+ /** Antialiasing tolerance (default false) */
20
+ includeAA?: boolean;
21
+ }
22
+
23
+ declare function comparePngBuffers(baseline: Buffer, actual: Buffer, opts?: CompareOptions): Promise<CompareResult>;
24
+ declare function expectNoVisualDiff(result: CompareResult, expect: {
25
+ (actual: unknown): {
26
+ toBe: (expected: unknown) => void;
27
+ };
28
+ }): void;
29
+
30
+ export { type CompareOptions, type CompareResult, type PixelSize, comparePngBuffers, expectNoVisualDiff };
package/dist/index.js ADDED
@@ -0,0 +1,58 @@
1
+ // src/compare.ts
2
+ async function loadPixelmatch() {
3
+ try {
4
+ const mod = await import("pixelmatch");
5
+ return mod.default ?? mod;
6
+ } catch {
7
+ throw new Error('comparePngBuffers requires "pixelmatch". Run `pnpm add -D pixelmatch`.');
8
+ }
9
+ }
10
+ async function loadPng() {
11
+ try {
12
+ const mod = await import("pngjs");
13
+ return mod.PNG ?? mod.default?.PNG ?? mod.PNG;
14
+ } catch {
15
+ throw new Error('comparePngBuffers requires "pngjs". Run `pnpm add -D pngjs`.');
16
+ }
17
+ }
18
+ async function comparePngBuffers(baseline, actual, opts = {}) {
19
+ const png = await loadPng();
20
+ const a = png.sync.read(baseline);
21
+ const b = png.sync.read(actual);
22
+ if (a.width !== b.width || a.height !== b.height) {
23
+ throw new Error(
24
+ `comparePngBuffers: size mismatch ${a.width}x${a.height} vs ${b.width}x${b.height}. Resize before comparing.`
25
+ );
26
+ }
27
+ const pixelmatch = await loadPixelmatch();
28
+ const { width, height } = a;
29
+ const emit = opts.emitDiff ?? true;
30
+ const diff = emit ? Buffer.alloc(width * height * 4) : null;
31
+ const diffPixels = pixelmatch(a.data, b.data, diff, width, height, {
32
+ threshold: opts.threshold ?? 0.1,
33
+ includeAA: opts.includeAA ?? false
34
+ });
35
+ const totalPixels = width * height;
36
+ const diffRatio = totalPixels === 0 ? 0 : diffPixels / totalPixels;
37
+ const maxDiffRatio = opts.maxDiffRatio ?? 5e-3;
38
+ return {
39
+ size: { width, height },
40
+ diffPixels,
41
+ diffRatio,
42
+ ok: diffRatio <= maxDiffRatio + 1e-7,
43
+ diffBuffer: diff ? png.sync.write({ width, height, data: diff }) : null
44
+ };
45
+ }
46
+ function expectNoVisualDiff(result, expect) {
47
+ if (!result.ok) {
48
+ throw new Error(
49
+ `Visual diff exceeded threshold: ${result.diffPixels} pixels (${(result.diffRatio * 100).toFixed(2)}%).`
50
+ );
51
+ }
52
+ expect(result.ok).toBe(true);
53
+ }
54
+ export {
55
+ comparePngBuffers,
56
+ expectNoVisualDiff
57
+ };
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/compare.ts"],"sourcesContent":["import type { CompareOptions, CompareResult } from './types.js';\n\ninterface PixelmatchFn {\n (\n img1: Uint8Array | Buffer,\n img2: Uint8Array | Buffer,\n output: Uint8Array | Buffer | null,\n width: number,\n height: number,\n options?: { threshold?: number; includeAA?: boolean },\n ): number;\n}\n\ninterface PngStatic {\n sync: {\n read: (buffer: Buffer) => { width: number; height: number; data: Buffer };\n write: (image: { width: number; height: number; data: Buffer | Uint8Array }) => Buffer;\n };\n}\n\nasync function loadPixelmatch(): Promise<PixelmatchFn> {\n try {\n const mod = (await import('pixelmatch')) as unknown as { default?: PixelmatchFn } & {\n default: PixelmatchFn;\n };\n return mod.default ?? (mod as unknown as PixelmatchFn);\n } catch {\n throw new Error('comparePngBuffers requires \"pixelmatch\". Run `pnpm add -D pixelmatch`.');\n }\n}\n\nasync function loadPng(): Promise<PngStatic> {\n try {\n const mod = (await import('pngjs')) as unknown as { PNG: PngStatic } & { default?: { PNG: PngStatic } };\n return mod.PNG ?? mod.default?.PNG ?? (mod as unknown as { PNG: PngStatic }).PNG;\n } catch {\n throw new Error('comparePngBuffers requires \"pngjs\". Run `pnpm add -D pngjs`.');\n }\n}\n\nexport async function comparePngBuffers(\n baseline: Buffer,\n actual: Buffer,\n opts: CompareOptions = {},\n): Promise<CompareResult> {\n const png = await loadPng();\n const a = png.sync.read(baseline);\n const b = png.sync.read(actual);\n if (a.width !== b.width || a.height !== b.height) {\n throw new Error(\n `comparePngBuffers: size mismatch ${a.width}x${a.height} vs ${b.width}x${b.height}. Resize before comparing.`,\n );\n }\n const pixelmatch = await loadPixelmatch();\n const { width, height } = a;\n const emit = opts.emitDiff ?? true;\n const diff = emit ? Buffer.alloc(width * height * 4) : null;\n const diffPixels = pixelmatch(a.data, b.data, diff as Buffer | null, width, height, {\n threshold: opts.threshold ?? 0.1,\n includeAA: opts.includeAA ?? false,\n });\n const totalPixels = width * height;\n const diffRatio = totalPixels === 0 ? 0 : diffPixels / totalPixels;\n const maxDiffRatio = opts.maxDiffRatio ?? 0.005;\n return {\n size: { width, height },\n diffPixels,\n diffRatio,\n ok: diffRatio <= maxDiffRatio + 0.0000001,\n diffBuffer: diff\n ? png.sync.write({ width, height, data: diff })\n : null,\n };\n}\n\nexport function expectNoVisualDiff(\n result: CompareResult,\n expect: { (actual: unknown): { toBe: (expected: unknown) => void } },\n): void {\n if (!result.ok) {\n throw new Error(\n `Visual diff exceeded threshold: ${result.diffPixels} pixels (${(result.diffRatio * 100).toFixed(2)}%).`,\n );\n }\n expect(result.ok).toBe(true);\n}\n"],"mappings":";AAoBA,eAAe,iBAAwC;AACrD,MAAI;AACF,UAAM,MAAO,MAAM,OAAO,YAAY;AAGtC,WAAO,IAAI,WAAY;AAAA,EACzB,QAAQ;AACN,UAAM,IAAI,MAAM,wEAAwE;AAAA,EAC1F;AACF;AAEA,eAAe,UAA8B;AAC3C,MAAI;AACF,UAAM,MAAO,MAAM,OAAO,OAAO;AACjC,WAAO,IAAI,OAAO,IAAI,SAAS,OAAQ,IAAsC;AAAA,EAC/E,QAAQ;AACN,UAAM,IAAI,MAAM,8DAA8D;AAAA,EAChF;AACF;AAEA,eAAsB,kBACpB,UACA,QACA,OAAuB,C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0",
4
+ "description": "Visual regression test adapter for kiwa — pixelmatch + PNG diff with baseline + actual snapshot management",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "cardene",
8
+ "url": "https://github.com/cardene777"
9
+ },
10
+ "keywords": [
11
+ "kiwa",
12
+ "visual",
13
+ "regression",
14
+ "pixelmatch",
15
+ "screenshot",
16
+ "testing"
17
+ ],
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/cardene777/kiwa.git",
21
+ "directory": "packages/visual"
22
+ },
23
+ "homepage": "https://github.com/cardene777/kiwa#readme",
24
+ "bugs": {
25
+ "url": "https://github.com/cardene777/kiwa/issues"
26
+ },
27
+ "type": "module",
28
+ "main": "./dist/index.cjs",
29
+ "module": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "import": {
34
+ "types": "./dist/index.d.ts",
35
+ "default": "./dist/index.js"
36
+ },
37
+ "require": {
38
+ "types": "./dist/index.d.cts",
39
+ "default": "./dist/index.cjs"
40
+ }
41
+ }
42
+ },
43
+ "files": [
44
+ "dist",
45
+ "README.md"
46
+ ],
47
+ "publishConfig": {
48
+ "access": "public",
49
+ "provenance": true
50
+ },
51
+ "engines": {
52
+ "node": ">=20"
53
+ },
54
+ "dependencies": {
55
+ "@kiwa-test/spec": "0.1.0"
56
+ },
57
+ "peerDependencies": {
58
+ "pixelmatch": "^7",
59
+ "pngjs": "^7",
60
+ "vitest": "^2"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^22.10.0",
64
+ "@types/pngjs": "^6.0.5",
65
+ "@vitest/coverage-v8": "^2.1.0",
66
+ "pixelmatch": "^7.1.0",
67
+ "pngjs": "^7.0.0",
68
+ "tsup": "^8.3.0",
69
+ "typescript": "^5.6.0",
70
+ "vitest": "^2.1.0"
71
+ },
72
+ "scripts": {
73
+ "build": "tsup",
74
+ "test": "node -e \"require('node:fs').rmSync('.vitest-dist',{recursive:true,force:true})\" && tsc -p tsconfig.vitest.json && vitest run .vitest-dist/tests --environment node",
75
+ "test:cov": "node -e \"require('node:fs').rmSync('.vitest-dist',{recursive:true,force:true})\" && tsc -p tsconfig.vitest.json && vitest run .vitest-dist/tests --environment node --coverage --coverage.provider=v8 --coverage.reporter=json --coverage.reporter=json-summary --coverage.reporter=text --coverage.reportsDirectory=coverage --coverage.include='.vitest-dist/src/compare.js' --coverage.include='.vitest-dist/src/index.js' --coverage.exclude='.vitest-dist/tests/**'",
76
+ "typecheck": "tsc --noEmit"
77
+ }
78
+ }