Skip to content

Commit dff0a98

Browse files
Tony Pagaduansimonsmith
authored andcommitted
fix: allowSizeMismatch error messaging
closes #70
1 parent 586ae1c commit dff0a98

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/command.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ const matchImageSnapshot =
9696
}
9797

9898
if (!pass && !added && !updated) {
99-
const message = diffSize
100-
? `Image size (${imageDimensions.receivedWidth}x${imageDimensions.receivedHeight}) different than saved snapshot size (${imageDimensions.baselineWidth}x${imageDimensions.baselineHeight}).\nSee diff for details: ${diffOutputPath}`
101-
: `Image was ${
102-
diffRatio * 100
103-
}% different from saved snapshot with ${diffPixelCount} different pixels.\nSee diff for details: ${diffOutputPath}`
99+
const message =
100+
diffSize && !options.allowSizeMismatch
101+
? `Image size (${imageDimensions.receivedWidth}x${imageDimensions.receivedHeight}) different than saved snapshot size (${imageDimensions.baselineWidth}x${imageDimensions.baselineHeight}).\nSee diff for details: ${diffOutputPath}`
102+
: `Image was ${
103+
diffRatio * 100
104+
}% different from saved snapshot with ${diffPixelCount} different pixels.\nSee diff for details: ${diffOutputPath}`
104105

105106
if (isFailOnSnapshotDiff) {
106107
throw new Error(message)

0 commit comments

Comments
 (0)