@@ -412,15 +412,17 @@ class ResembleHelper extends Helper {
412412 baseImage : string ,
413413 options ?: { tolerance ?: any ; boundingBox ?: any ; skipFailure ?: any } ,
414414 ) {
415- if ( ! options ) {
416- options = { } ;
417- options . tolerance = 0 ;
415+ let newOptions = options ;
416+
417+ if ( ! newOptions ) {
418+ newOptions = { } ;
419+ newOptions . tolerance = 0 ;
418420 }
419421
420422 const awsC = this . config . aws ;
421423
422- if ( this . _getPrepareBaseImage ( options ) ) {
423- await this . _prepareBaseImage ( baseImage , options ) ;
424+ if ( this . _getPrepareBaseImage ( newOptions ) ) {
425+ await this . _prepareBaseImage ( baseImage , newOptions ) ;
424426 } else if ( awsC !== undefined ) {
425427 await this . _download (
426428 awsC . accessKeyId ,
@@ -435,11 +437,11 @@ class ResembleHelper extends Helper {
435437
436438 // BoundingBox for Playwright not necessary
437439 if ( selector && ! this . helpers [ "Playwright" ] ) {
438- options . boundingBox = await this . _getBoundingBox ( selector ) ;
440+ newOptions . boundingBox = await this . _getBoundingBox ( selector ) ;
439441 }
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 ) ;
443445 if ( awsC !== undefined ) {
444446 await this . _upload (
445447 awsC . accessKeyId ,
@@ -454,9 +456,9 @@ class ResembleHelper extends Helper {
454456
455457 this . debug ( `MisMatch Percentage Calculated is ${ misMatch } for baseline ${ baseImage } ` ) ;
456458
457- if ( ! options . skipFailure ) {
459+ if ( ! newOptions . skipFailure ) {
458460 assert (
459- misMatch <= options . tolerance ,
461+ misMatch <= newOptions . tolerance ,
460462 `Screenshot does not match with the baseline ${ baseImage } when MissMatch Percentage is ${ misMatch } ` ,
461463 ) ;
462464 }
0 commit comments