@probe.gl/test-utils
Advanced tools
Comparing version 3.0.0-alpha.3 to 3.0.0-alpha.4
@@ -217,3 +217,3 @@ "use strict"; | ||
}).then(function (result) { | ||
if (!result.success && opts.saveOnFail) { | ||
if (!result.success && opts.saveOnFail && result.source1) { | ||
var filename = opts.saveAs || '[name]-failed.png'; | ||
@@ -227,6 +227,7 @@ filename = filename.replace('[name]', opts.goldenImage.replace(/\.\w+$/, '')); | ||
headless: _this3.headless, | ||
match: result.match, | ||
matchPercentage: result.matchPercentage, | ||
match: result.match || 0, | ||
matchPercentage: result.matchPercentage || 'N/A', | ||
success: result.success, | ||
diffImage: result.diffImage | ||
diffImage: result.diffImage || null, | ||
error: result.error || null | ||
}; | ||
@@ -233,0 +234,0 @@ }).catch(function (error) { |
@@ -25,3 +25,9 @@ "use strict"; | ||
var result = diffPNGs(image1, image2, options); | ||
return diffPNGs(image1, image2, options); | ||
}).catch(function (error) { | ||
return { | ||
success: false, | ||
error: error.message | ||
}; | ||
}).then(function (result) { | ||
return Object.assign(result, { | ||
@@ -28,0 +34,0 @@ source1: source1, |
@@ -152,3 +152,3 @@ import BrowserDriver from './browser-driver'; | ||
return this.page.screenshot(screenshotOptions).then(image => diffImages(image, opts.goldenImage, opts)).then(result => { | ||
if (!result.success && opts.saveOnFail) { | ||
if (!result.success && opts.saveOnFail && result.source1) { | ||
let filename = opts.saveAs || '[name]-failed.png'; | ||
@@ -162,6 +162,7 @@ filename = filename.replace('[name]', opts.goldenImage.replace(/\.\w+$/, '')); | ||
headless: this.headless, | ||
match: result.match, | ||
matchPercentage: result.matchPercentage, | ||
match: result.match || 0, | ||
matchPercentage: result.matchPercentage || 'N/A', | ||
success: result.success, | ||
diffImage: result.diffImage | ||
diffImage: result.diffImage || null, | ||
error: result.error || null | ||
}; | ||
@@ -168,0 +169,0 @@ }).catch(error => { |
@@ -5,10 +5,10 @@ import fs from 'fs'; | ||
export default function diffImages(source1, source2, options = {}) { | ||
return Promise.all([parsePNG(source1), parsePNG(source2)]).then(([image1, image2]) => { | ||
const result = diffPNGs(image1, image2, options); | ||
return Object.assign(result, { | ||
source1, | ||
source2, | ||
options | ||
}); | ||
}); | ||
return Promise.all([parsePNG(source1), parsePNG(source2)]).then(([image1, image2]) => diffPNGs(image1, image2, options)).catch(error => ({ | ||
success: false, | ||
error: error.message | ||
})).then(result => Object.assign(result, { | ||
source1, | ||
source2, | ||
options | ||
})); | ||
} | ||
@@ -15,0 +15,0 @@ |
@@ -200,3 +200,3 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
}).then(function (result) { | ||
if (!result.success && opts.saveOnFail) { | ||
if (!result.success && opts.saveOnFail && result.source1) { | ||
var filename = opts.saveAs || '[name]-failed.png'; | ||
@@ -210,6 +210,7 @@ filename = filename.replace('[name]', opts.goldenImage.replace(/\.\w+$/, '')); | ||
headless: _this3.headless, | ||
match: result.match, | ||
matchPercentage: result.matchPercentage, | ||
match: result.match || 0, | ||
matchPercentage: result.matchPercentage || 'N/A', | ||
success: result.success, | ||
diffImage: result.diffImage | ||
diffImage: result.diffImage || null, | ||
error: result.error || null | ||
}; | ||
@@ -216,0 +217,0 @@ }).catch(function (error) { |
@@ -12,3 +12,9 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
var result = diffPNGs(image1, image2, options); | ||
return diffPNGs(image1, image2, options); | ||
}).catch(function (error) { | ||
return { | ||
success: false, | ||
error: error.message | ||
}; | ||
}).then(function (result) { | ||
return Object.assign(result, { | ||
@@ -15,0 +21,0 @@ source1: source1, |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "3.0.0-alpha.3", | ||
"version": "3.0.0-alpha.4", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "integration test", |
@@ -189,3 +189,3 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc. | ||
.then(result => { | ||
if (!result.success && opts.saveOnFail) { | ||
if (!result.success && opts.saveOnFail && result.source1) { | ||
let filename = opts.saveAs || '[name]-failed.png'; | ||
@@ -197,6 +197,7 @@ filename = filename.replace('[name]', opts.goldenImage.replace(/\.\w+$/, '')); | ||
headless: this.headless, | ||
match: result.match, | ||
matchPercentage: result.matchPercentage, | ||
match: result.match || 0, | ||
matchPercentage: result.matchPercentage || 'N/A', | ||
success: result.success, | ||
diffImage: result.diffImage | ||
diffImage: result.diffImage || null, | ||
error: result.error || null | ||
}; | ||
@@ -203,0 +204,0 @@ }) |
@@ -7,10 +7,15 @@ /* global Buffer */ | ||
export default function diffImages(source1, source2, options = {}) { | ||
return Promise.all([parsePNG(source1), parsePNG(source2)]).then(([image1, image2]) => { | ||
const result = diffPNGs(image1, image2, options); | ||
return Object.assign(result, { | ||
source1, | ||
source2, | ||
options | ||
}); | ||
}); | ||
return Promise.all([parsePNG(source1), parsePNG(source2)]) | ||
.then(([image1, image2]) => diffPNGs(image1, image2, options)) | ||
.catch(error => ({ | ||
success: false, | ||
error: error.message | ||
})) | ||
.then(result => | ||
Object.assign(result, { | ||
source1, | ||
source2, | ||
options | ||
}) | ||
); | ||
} | ||
@@ -17,0 +22,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
207106
2249