Closed a-nwhitmont closed 9 years ago
Thank you for the well composed bug-report!
This was an error in the documentation. The first parameter is the typical Node error object for callbacks (when there was an error - not a difference). The second parameter, however, holds detailed information about the comparison - including the result. I updated the documentation and now the results are consistent. The code should look something like this:
#!/usr/bin/env node
BlinkDiff = require('blink-diff');
var diff = new BlinkDiff({
imageAPath: 'people.png',
imageBPath: 'people2.png',
imageOutputPath: 'blink-diff-people.png',
verbose: true
});
diff.run(function (error, result) {
console.log(diff.hasPassed(result.code) ? 'Passed' : 'Failed with ' + result.differences + ' differences - ' + error);
});
The result is:
Thanks! :+1:
During testing of blink-diff I have experienced different results from the command-line usage vs. the Javascript Object usage.
Images used for this test:
people.png
people2.png
Command-line Usage
Command-line script:
./node_modules/blink-diff/bin/blink-diff --output blinkdiff-people.png people.png people2.png
Command-line result:
Output file: blinkdiff-people.png - (Works as expected)
Javascript Object Usage
blink.js
Run the script:
bash-3.2$ node blink.js
Output results (NOT as expected)
Summary
Why are the results different? The results from the command-line usage are as expected, while the JS Object usage says "Passed" when it should say "Fail" and produce the output image.