@@ -412,15 +412,17 @@ class ResembleHelper extends Helper {
412
412
baseImage : string ,
413
413
options ?: { tolerance ?: any ; boundingBox ?: any ; skipFailure ?: any } ,
414
414
) {
415
- if ( ! options ) {
416
- options = { } ;
417
- options . tolerance = 0 ;
415
+ let newOptions = options ;
416
+
417
+ if ( ! newOptions ) {
418
+ newOptions = { } ;
419
+ newOptions . tolerance = 0 ;
418
420
}
419
421
420
422
const awsC = this . config . aws ;
421
423
422
- if ( this . _getPrepareBaseImage ( options ) ) {
423
- await this . _prepareBaseImage ( baseImage , options ) ;
424
+ if ( this . _getPrepareBaseImage ( newOptions ) ) {
425
+ await this . _prepareBaseImage ( baseImage , newOptions ) ;
424
426
} else if ( awsC !== undefined ) {
425
427
await this . _download (
426
428
awsC . accessKeyId ,
@@ -435,11 +437,11 @@ class ResembleHelper extends Helper {
435
437
436
438
// BoundingBox for Playwright not necessary
437
439
if ( selector && ! this . helpers [ "Playwright" ] ) {
438
- options . boundingBox = await this . _getBoundingBox ( selector ) ;
440
+ newOptions . boundingBox = await this . _getBoundingBox ( selector ) ;
439
441
}
440
- const misMatch = await this . _fetchMisMatchPercentage ( baseImage , options ) ;
441
- await this . _addAttachment ( baseImage , misMatch , options ) ;
442
- await this . _addMochaContext ( baseImage , misMatch , options ) ;
442
+ const misMatch = await this . _fetchMisMatchPercentage ( baseImage , newOptions ) ;
443
+ await this . _addAttachment ( baseImage , misMatch , newOptions ) ;
444
+ await this . _addMochaContext ( baseImage , misMatch , newOptions ) ;
443
445
if ( awsC !== undefined ) {
444
446
await this . _upload (
445
447
awsC . accessKeyId ,
@@ -454,9 +456,9 @@ class ResembleHelper extends Helper {
454
456
455
457
this . debug ( `MisMatch Percentage Calculated is ${ misMatch } for baseline ${ baseImage } ` ) ;
456
458
457
- if ( ! options . skipFailure ) {
459
+ if ( ! newOptions . skipFailure ) {
458
460
assert (
459
- misMatch <= options . tolerance ,
461
+ misMatch <= newOptions . tolerance ,
460
462
`Screenshot does not match with the baseline ${ baseImage } when MissMatch Percentage is ${ misMatch } ` ,
461
463
) ;
462
464
}
0 commit comments