mirror of
https://github.com/thumbsup/thumbsup
synced 2024-11-11 07:10:26 +00:00
19 lines
475 B
JavaScript
Executable File
19 lines
475 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
const gm = require('gm')
|
|
|
|
const TOLERANCE = { tolerance: 0.005 }
|
|
const expected = process.argv[2]
|
|
const actual = process.argv[3]
|
|
|
|
gm.compare(expected, actual, TOLERANCE, (err, similar) => {
|
|
if (err) {
|
|
console.error(`Error: ${err}\n Expected: ${expected}\n Actual: ${actual}`)
|
|
process.exit(1)
|
|
}
|
|
if (!similar) {
|
|
console.error(`Images are different\n Expected: ${expected}\n Actual: ${actual}`)
|
|
process.exit(2)
|
|
}
|
|
process.exit(0)
|
|
})
|