Skip to content

Commit 06859e3

Browse files
committed
created config parameter consoleOutput
1 parent b61b292 commit 06859e3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ class ResembleHelper extends Helper {
2929
async _compareImages (image1, image2, diffImage, options) {
3030
image1 = this.config.baseFolder + image1;
3131
image2 = this.config.screenshotFolder + image2;
32-
32+
if(typeof this.config.consoleOutput == 'undefined')
33+
{
34+
this.config.consoleOutput = true
35+
}
3336
return new Promise((resolve, reject) => {
3437
if (options.boundingBox !== undefined)
3538
{
@@ -38,15 +41,15 @@ class ResembleHelper extends Helper {
3841
});
3942
}
4043

41-
if (options.tolerance !== undefined)
44+
if (options.tolerance !== undefined && this.config.consoleOutput)
4245
{
4346
console.log("Tolerance Level Provided " + options.tolerance);
4447
var tolerance = options.tolerance;
4548
}
46-
resemble.compare(image1, image2, options, (err, data) => {
49+
resemble.compare(image1, image2, options, (err, data) => {
4750
if (err) {
4851
reject(err);
49-
} else {
52+
} else {
5053
resolve(data);
5154
if (data.misMatchPercentage >= tolerance) {
5255
mkdirp(getDirName(this.config.diffFolder + diffImage), function (err) {
@@ -98,7 +101,9 @@ class ResembleHelper extends Helper {
98101
}
99102

100103
var misMatch = await this._fetchMisMatchPercentage(baseImage, options);
101-
console.log("MisMatch Percentage Calculated is " + misMatch);
104+
if(this.config.consoleOutput){
105+
console.log("MisMatch Percentage Calculated is " + misMatch);
106+
}
102107
assert(misMatch <= options.tolerance, "MissMatch Percentage " + misMatch);
103108
}
104109

0 commit comments

Comments
 (0)