Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b50e528

Browse files
committed
clean up compare pixel test logs
1 parent 8b68b4b commit b50e528

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

test/image/compare_pixels_test.js

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ exec('monit restart nw1 && sleep 5', function() {
2929

3030
function runAll () {
3131
test('testing mocks', function (t) {
32-
33-
console.error('### beginning pixel comparison tests ###');
3432
var files = fs.readdirSync(constants.pathToTestImageMocks);
3533

3634
// -1 for font-wishlist and
@@ -74,7 +72,6 @@ function testMock (fileName, t) {
7472
var diffPath = path.join(constants.pathToTestImagesDiff, 'diff-' + imageFileName);
7573
var savedImageStream = fs.createWriteStream(savedImagePath);
7674
var options = getOptions(bodyMock, 'http://localhost:9010/');
77-
var statusCode;
7875

7976
function checkImage () {
8077
var options = {
@@ -83,17 +80,12 @@ function testMock (fileName, t) {
8380
tolerance: 0.0
8481
};
8582

86-
if(statusCode === 485) {
87-
console.error(imageFileName, '- skip');
88-
}
89-
else {
90-
gm.compare(
91-
savedImagePath,
92-
path.join(constants.pathToTestImageBaselines, imageFileName),
93-
options,
94-
onEqualityCheck
95-
);
96-
}
83+
gm.compare(
84+
savedImagePath,
85+
path.join(constants.pathToTestImageBaselines, imageFileName),
86+
options,
87+
onEqualityCheck
88+
);
9789
}
9890

9991
function onEqualityCheck (err, isEqual) {
@@ -103,19 +95,15 @@ function testMock (fileName, t) {
10395
}
10496
if (isEqual) {
10597
fs.unlinkSync(diffPath);
106-
console.error(imageFileName + ' is pixel perfect');
10798
}
10899

109-
t.ok(isEqual, savedImagePath + ' should be pixel perfect');
100+
t.ok(isEqual, imageFileName + ' should be pixel perfect');
110101
}
111102

112103
request(options)
113-
.on('response', function(response) {
114-
statusCode = response.statusCode;
115-
})
116104
.pipe(savedImageStream)
117-
.on('close', checkImage);
118105
.on('error', function() {
119106
console.log("NOOOOOOOOOOOOO")
120107
})
108+
.on('close', checkImage);
121109
}

0 commit comments

Comments
 (0)