unexpected-resemble
Resemble.js plugin for the Unexpected assertion library (version 7+ required).
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
{
isSameDimensions: true,
dimensionDifference: { width: 0, height: 0 },
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.