You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/plugins.ts
+26-14Lines changed: 26 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -133,14 +133,12 @@ export const initPlugin = (
133
133
maxDiffThreshold: number;
134
134
diffConfig: Parameters<typeofpixelmatch>[5];
135
135
}&Parameters<typeofpixelmatch>[5]
136
-
): Promise<
137
-
null|{
138
-
error?: boolean;
139
-
message?: string;
140
-
imgDiff?: number;
141
-
maxDiffThreshold?: number;
142
-
}
143
-
>{
136
+
): Promise<null|{
137
+
error?: boolean;
138
+
message?: string;
139
+
imgDiff?: number;
140
+
maxDiffThreshold?: number;
141
+
}>{
144
142
constmessages=[]asstring[];
145
143
letimgDiff: number|undefined;
146
144
leterror=false;
@@ -174,11 +172,19 @@ export const initPlugin = (
174
172
imgDiff=diffPixels/(width*height);
175
173
176
174
if(isImgSizeDifferent){
177
-
messages.push(`Warning: Images size mismatch - new screenshot is ${rawImgNew.width}px by ${rawImgNew.height}px while old one is ${rawImgOld.width}px by ${rawImgOld.height} (width x height).`);
175
+
messages.push(
176
+
`Warning: Images size mismatch - new screenshot is ${rawImgNew.width}px by ${rawImgNew.height}px while old one is ${rawImgOld.width}px by ${rawImgOld.height} (width x height).`
177
+
);
178
178
}
179
-
179
+
180
180
if(imgDiff>cfg.maxDiffThreshold){
181
-
messages.unshift(`Image diff factor (${round(imgDiff)}) is bigger than maximum threshold option ${cfg.maxDiffThreshold}.`);
181
+
messages.unshift(
182
+
`Image diff factor (${round(
183
+
imgDiff
184
+
)}) is bigger than maximum threshold option ${
185
+
cfg.maxDiffThreshold
186
+
}.`
187
+
);
182
188
error=true;
183
189
}
184
190
@@ -189,7 +195,7 @@ export const initPlugin = (
189
195
);
190
196
return{
191
197
error,
192
-
message: messages.join('\n'),
198
+
message: messages.join("\n"),
193
199
imgDiff,
194
200
maxDiffThreshold: cfg.maxDiffThreshold,
195
201
};
@@ -204,9 +210,15 @@ export const initPlugin = (
204
210
}
205
211
206
212
if(typeofimgDiff!=="undefined"){
207
-
messages.unshift(`Image diff (${round(imgDiff)}%) is within boundaries of maximum threshold option ${cfg.maxDiffThreshold}.`);
213
+
messages.unshift(
214
+
`Image diff (${round(
215
+
imgDiff
216
+
)}%) is within boundaries of maximum threshold option ${
0 commit comments