Skip to content

Image comparison chai assert, for use in visual regression tests.

License

Notifications You must be signed in to change notification settings

diosmosis/chai-image-assert

Repository files navigation

Build Status

chai-image-assert

This repo provides a chai assertion to match buffers against image files.

The assert uses ImageMagick's compare tool.

Usage

var fs = require('fs');
var path = require('path');
var chai = require('chai');
chai.use(require('chai-image-assert')(__dirname));

describe("my test", function () {
    it("should match", function () {
        var myFile = fs.readFileSync(path.join("path-to-my-file.png"));
        expect(myFile).to.matchImage('name-in-expected');
    });
});