@cappa/core 0.13.1 → 0.13.2
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/dist/index.cjs +12 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -8
- package/dist/index.d.mts +10 -8
- package/dist/index.mjs +12 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -262,8 +262,8 @@ const compare = (image1, image2, diff, width, height, options) => {
|
|
|
262
262
|
};
|
|
263
263
|
/**
|
|
264
264
|
* Compare two PNG images and return the difference
|
|
265
|
-
* @param image1 -
|
|
266
|
-
* @param image2 -
|
|
265
|
+
* @param image1 - Baseline (expected) image (file path or Buffer)
|
|
266
|
+
* @param image2 - Current (actual) image (file path or Buffer)
|
|
267
267
|
* @param withDiff - Whether to create a diff image
|
|
268
268
|
* @param options - Comparison options
|
|
269
269
|
* @returns Comparison result
|
|
@@ -311,8 +311,8 @@ function annotateDiffImage(image, options) {
|
|
|
311
311
|
}
|
|
312
312
|
/**
|
|
313
313
|
* Quick comparison function that returns only pass/fail
|
|
314
|
-
* @param image1 -
|
|
315
|
-
* @param image2 -
|
|
314
|
+
* @param image1 - Baseline (expected) image (file path or Buffer)
|
|
315
|
+
* @param image2 - Current (actual) image (file path or Buffer)
|
|
316
316
|
* @param options - Comparison options
|
|
317
317
|
* @returns Whether the images match
|
|
318
318
|
*/
|
|
@@ -349,8 +349,9 @@ function toNativeOptions(config) {
|
|
|
349
349
|
}
|
|
350
350
|
/**
|
|
351
351
|
* Compare two PNG images and return the difference
|
|
352
|
-
* @param image1 -
|
|
353
|
-
* @param image2 -
|
|
352
|
+
* @param image1 - Baseline (expected) image (file path or Buffer)
|
|
353
|
+
* @param image2 - Current (actual) image (file path or Buffer). Order matters
|
|
354
|
+
* for `interpret`: content only in `image2` is reported as an addition.
|
|
354
355
|
* @param withDiff - Whether to create a diff image
|
|
355
356
|
* @param options - Comparison options
|
|
356
357
|
* @returns Comparison result
|
|
@@ -435,8 +436,9 @@ async function compareImages(image1, image2, withDiff = false, options = {}) {
|
|
|
435
436
|
}
|
|
436
437
|
/**
|
|
437
438
|
* Quick comparison function that returns only pass/fail
|
|
438
|
-
* @param image1 -
|
|
439
|
-
* @param image2 -
|
|
439
|
+
* @param image1 - Baseline (expected) image (file path or Buffer)
|
|
440
|
+
* @param image2 - Current (actual) image (file path or Buffer). Order matters
|
|
441
|
+
* for `interpret`: content only in `image2` is reported as an addition.
|
|
440
442
|
* @param options - Comparison options
|
|
441
443
|
* @returns Whether the images match
|
|
442
444
|
*/
|
|
@@ -655,7 +657,7 @@ var ScreenshotFileSystem = class {
|
|
|
655
657
|
}
|
|
656
658
|
if (screenshot.category === "passed") {
|
|
657
659
|
if (!screenshot.expectedPath) throw new Error("Expected path is required for passed screenshots");
|
|
658
|
-
if (!await imagesMatch(node_path.default.resolve(outputDir, screenshot.
|
|
660
|
+
if (!await imagesMatch(node_path.default.resolve(outputDir, screenshot.expectedPath), node_path.default.resolve(outputDir, screenshot.actualPath), diff.type === "gmsd" ? { threshold: diff.threshold } : diff)) await this.approveFromActualPath(node_path.default.resolve(outputDir, screenshot.actualPath));
|
|
659
661
|
}
|
|
660
662
|
}
|
|
661
663
|
/**
|
|
@@ -1752,7 +1754,7 @@ var ScreenshotTool = class {
|
|
|
1752
1754
|
delay: this.getIncBackoffDelay(i, options.delay || 0)
|
|
1753
1755
|
});
|
|
1754
1756
|
if (!screenshotBuffer) throw new Error("Screenshot buffer is undefined");
|
|
1755
|
-
const comparisonResult = diffConfig.type === "gmsd" ? await compareImagesGMSD(
|
|
1757
|
+
const comparisonResult = diffConfig.type === "gmsd" ? await compareImagesGMSD(referenceImage, screenshotBuffer, true, diffConfig) : await compareImages(referenceImage, screenshotBuffer, true, diffConfig);
|
|
1756
1758
|
if (i === this.retries - 1 && !comparisonResult.passed) {
|
|
1757
1759
|
this.logger.error(`Failed to match screenshot after ${this.retries} retries`);
|
|
1758
1760
|
return {
|