unexpected-resemble

Resemble.js plugin for the Unexpected assertion library (version 7+ required).

NPM version Build Status Coverage Status Dependency Status

Images can be specified either as strings (file name or data: urls) or as Buffer or Uint8Array instances.

To compare using the default options (images must have the same dimensions and be less than 1% different):

return expect('testdata/People_small.jpg', 'to resemble', 'testdata/People2_small.jpg');
expected
to resemble
 
{
  
isSameDimensionstrue,
  
dimensionDifference: { width0height0 },
  
mismatchPercentage
10.08 
//
 
should be less than 1
}
 

For more fine-grained control, specify an object with comparison options, which will matched against the result object from resemble.js with to satisfy semantics:

return expect('testdata/People_small.jpg', 'to resemble', 'testdata/People2_small.jpg', {
    mismatchPercentage: expect.it('to be less than', 15),
    isSameDimensions: true
});

See an overview of all the supported comparison options.

License

Unexpected-resemble is licensed under a standard 3-clause BSD license -- see the LICENSE file for details.

Fork me on GitHub