From aabe67eeccc461918583d82617f78ae8b959b80a Mon Sep 17 00:00:00 2001 From: Adam Barber Date: Sun, 3 Mar 2024 08:53:58 +0000 Subject: [PATCH] fix: Catch comparison file load failure and trigger test failure --- src/plugin.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugin.js b/src/plugin.js index 40911d0..36c25cd 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -72,8 +72,12 @@ const getStatsComparisonAndPopulateDiffIfAny = async (args) => { ? { percentage: 1, testFailed: true } : { percentage: 0, testFailed: false } } - - const comparisonImg = await parseImage(paths.image.comparison(args.testName)) + let comparisonImg + try { + comparisonImg = await parseImage(paths.image.comparison(args.testName)) + } catch (e) { + return { percentage: 1, testFailed: true } + } const diff = new PNG({ width: Math.max(comparisonImg.width, baselineImg.width), height: Math.max(comparisonImg.height, baselineImg.height),