Skip to content

Commit

Permalink
feat: added option to ignore colors
Browse files Browse the repository at this point in the history
  • Loading branch information
oroce authored Dec 19, 2017
1 parent 0ac2e59 commit 2b76a87
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/methods/LocalCompare.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class LocalCompare extends BaseCompare {
this.getReferencefile = options.referenceName;
this.getDiffFile = options.diffName;
this.misMatchTolerance = _.get(options, 'misMatchTolerance', 0.01);
this.ignoreComparison = _.get(options, 'ignoreComparison', '');
}

async afterScreenshot(context, base64Screenshot) {
Expand Down Expand Up @@ -63,10 +64,11 @@ export default class LocalCompare extends BaseCompare {
* @return {{misMatchPercentage: Number, isSameDimensions:Boolean, getImageDataUrl: function}}
*/
async compareImages(reference, screenshot, ignore = '') {
const ignoreComparison = ignore || this.ignoreComparison;
return await new Promise((resolve) => {
const image = resemble(reference).compareTo(screenshot);

switch(ignore) {
switch(ignoreComparison) {
case 'colors':
image.ignoreColors();
break;
Expand Down

0 comments on commit 2b76a87

Please sign in to comment.