diff --git a/bin/Main.ml b/bin/Main.ml index 31109495..dde201a2 100644 --- a/bin/Main.ml +++ b/bin/Main.ml @@ -26,7 +26,7 @@ let main img1Path img2Path diffPath threshold outputDiffMask failOnLayoutChange Gc.set { (Gc.get ()) with - Gc.minor_heap_size = 32_000_000; + Gc.minor_heap_size = 64_000_000; Gc.stack_limit = 2_048_000; Gc.window_size = 25; }; diff --git a/test/node-binding.test.cjs b/test/node-binding.test.cjs index d3ef5425..2cd5aec0 100644 --- a/test/node-binding.test.cjs +++ b/test/node-binding.test.cjs @@ -16,14 +16,17 @@ const BINARY_PATH = path.resolve( console.log(`Testing binary ${BINARY_PATH}`); +const options = { + __binaryPath: BINARY_PATH, + reduceRamUsage: true +} + test("Outputs correct parsed result when images different", async (t) => { const { reason, diffCount, diffPercentage } = await compare( path.join(IMAGES_PATH, "donkey.png"), path.join(IMAGES_PATH, "donkey-2.png"), path.join(IMAGES_PATH, "diff.png"), - { - __binaryPath: BINARY_PATH, - } + options ); t.is(reason, "pixel-diff"); @@ -36,10 +39,7 @@ test("Correctly parses threshold", async (t) => { path.join(IMAGES_PATH, "donkey.png"), path.join(IMAGES_PATH, "donkey-2.png"), path.join(IMAGES_PATH, "diff.png"), - { - threshold: 0.6, - __binaryPath: BINARY_PATH, - } + options ); t.is(reason, "pixel-diff"); @@ -52,10 +52,7 @@ test("Correctly parses antialiasing", async (t) => { path.join(IMAGES_PATH, "donkey.png"), path.join(IMAGES_PATH, "donkey-2.png"), path.join(IMAGES_PATH, "diff.png"), - { - antialiasing: true, - __binaryPath: BINARY_PATH, - } + options ); t.is(reason, "pixel-diff"); @@ -69,6 +66,7 @@ test("Correctly parses ignore regions", async (t) => { path.join(IMAGES_PATH, "donkey-2.png"), path.join(IMAGES_PATH, "diff.png"), { + ...options, ignoreRegions: [ { x1: 749, @@ -83,7 +81,6 @@ test("Correctly parses ignore regions", async (t) => { y2: 1334, }, ], - __binaryPath: BINARY_PATH, } ); @@ -95,9 +92,7 @@ test("Outputs correct parsed result when images different for cypress image", as path.join(IMAGES_PATH, "www.cypress.io.png"), path.join(IMAGES_PATH, "www.cypress.io-1.png"), path.join(IMAGES_PATH, "diff.png"), - { - __binaryPath: BINARY_PATH, - } + options ); t.is(reason, "pixel-diff"); @@ -110,9 +105,7 @@ test("Correctly handles same images", async (t) => { path.join(IMAGES_PATH, "donkey.png"), path.join(IMAGES_PATH, "donkey.png"), path.join(IMAGES_PATH, "diff.png"), - { - __binaryPath: BINARY_PATH, - } + options ); t.is(match, true); @@ -125,7 +118,7 @@ test("Correctly outputs diff lines", async (t) => { path.join(IMAGES_PATH, "diff.png"), { captureDiffLines: true, - __binaryPath: BINARY_PATH, + ...options } ); @@ -139,8 +132,8 @@ test("Returns meaningful error if file does not exist and noFailOnFsErrors", asy path.join(IMAGES_PATH, "not-existing.png"), path.join(IMAGES_PATH, "diff.png"), { + ...options, noFailOnFsErrors: true, - __binaryPath: BINARY_PATH, } );