Skip to content

Commit

Permalink
Merge pull request #211 from ajbarber/safe-comparison-notfound
Browse files Browse the repository at this point in the history
fix: Catch comparison file load failure and trigger test failure
  • Loading branch information
PippoRaimondi authored Mar 5, 2024
2 parents 4dd368c + aabe67e commit ad02fd6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit ad02fd6

Please sign in to comment.