2
0
mirror of https://github.com/thumbsup/thumbsup synced 2024-11-15 18:12:46 +00:00
thumbsup/test-snapshot/imagediff

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)
})