webjerk-image-set-diff

0.3.0 • Public • Published

JavaScript Style Guide CircleCI

webjerk-image-set-diff

compares two sets of images.

provide it folders, refDir & runDir, where both folders contain png files. images are compared by basename. that is, /refDir/test-image.png would be compared to /runDir/test-image.png.

the comparisons use blink-diff to compare images.

usage

var ImageSetDiffer = require('webjerk-image-set-diff')
var refDir = '/reference-images'
var runDir = '/test-run-images'
var idr = new ImageSetDiffer({
  refDir,
  runDir,
  report: true, // generate a report?
  allowNewImages: true, // allow new images into the ref set
  approveChanges: false // appove run images as new refs. migrate run/ images to ref/
})
var diffs = await idr.run() // blinkDifference objects

when mismatches are detected, ImageSetDiffer::run throws.

  • err.code will equal 'EIMAGEDIFFS'
  • err.differences will have an array of blink difference data attached to the failing image
console.log(err.differences)
// => [{ basename, blinkDiff, message }, ..., for, each, image, mismatch]

config

some settings may be set from the env:

  • WEBJERK_ALLOW_NEW_IMAGES, set to allow new images not found in the reference set
  • WEBJERK_APPROVE_CHANGES, set to approve all image changes

Readme

Keywords

none

Package Sidebar

Install

npm i webjerk-image-set-diff

Weekly Downloads

1

Version

0.3.0

License

MIT

Unpacked Size

101 kB

Total Files

28

Last publish

Collaborators

  • cdaringe