Skip to content

Commit

Permalink
Disable ram optimization in debug test
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrKovalenko committed Apr 29, 2024
1 parent e0e216b commit 343125a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion bin/Main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
33 changes: 13 additions & 20 deletions test/node-binding.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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,
Expand All @@ -83,7 +81,6 @@ test("Correctly parses ignore regions", async (t) => {
y2: 1334,
},
],
__binaryPath: BINARY_PATH,
}
);

Expand All @@ -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");
Expand All @@ -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);
Expand All @@ -125,7 +118,7 @@ test("Correctly outputs diff lines", async (t) => {
path.join(IMAGES_PATH, "diff.png"),
{
captureDiffLines: true,
__binaryPath: BINARY_PATH,
...options
}
);

Expand All @@ -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,
}
);

Expand Down

0 comments on commit 343125a

Please sign in to comment.