Skip to content

Commit e84a359

Browse files
authored
Merge pull request #4 from mathesouza/master
created config parameter consoleOutput
2 parents b61b292 + b933510 commit e84a359

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

index.js

Lines changed: 16 additions & 6 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
{
@@ -40,13 +43,15 @@ class ResembleHelper extends Helper {
4043

4144
if (options.tolerance !== undefined)
4245
{
43-
console.log("Tolerance Level Provided " + options.tolerance);
46+
if(this.config.consoleOutput){
47+
console.log("Tolerance Level Provided " + options.tolerance);
48+
}
4449
var tolerance = options.tolerance;
4550
}
46-
resemble.compare(image1, image2, options, (err, data) => {
51+
resemble.compare(image1, image2, options, (err, data) => {
4752
if (err) {
4853
reject(err);
49-
} else {
54+
} else {
5055
resolve(data);
5156
if (data.misMatchPercentage >= tolerance) {
5257
mkdirp(getDirName(this.config.diffFolder + diffImage), function (err) {
@@ -98,7 +103,9 @@ class ResembleHelper extends Helper {
98103
}
99104

100105
var misMatch = await this._fetchMisMatchPercentage(baseImage, options);
101-
console.log("MisMatch Percentage Calculated is " + misMatch);
106+
if(this.config.consoleOutput){
107+
console.log("MisMatch Percentage Calculated is " + misMatch);
108+
}
102109
assert(misMatch <= options.tolerance, "MissMatch Percentage " + misMatch);
103110
}
104111

@@ -127,7 +134,10 @@ class ResembleHelper extends Helper {
127134

128135
options.boundingBox = await this._getBoundingBox(selector);
129136
var misMatch = await this._fetchMisMatchPercentage(baseImage, options);
130-
console.log("MisMatch Percentage Calculated is " + misMatch);
137+
if(this.config.consoleOutput)
138+
{
139+
console.log("MisMatch Percentage Calculated is " + misMatch);
140+
}
131141
assert(misMatch <= options.tolerance, "MissMatch Percentage " + misMatch);
132142
}
133143
else {

0 commit comments

Comments
 (0)