canvasimo
canvasimo copied to clipboard
Create custom snapshot renderer
This should stub the CanvasRenderingContext2D and create an ascii representation that is written to a file to check for changes later.
expect(context).toMatchCanvasSnapshot();
expect.extend({
toMatchCanvasSnapshot(received, argument) {
const pass = //;
if (pass) {
return {
message: () => `expected ${received} not to match snapshot ${snapshot}`,
pass: true,
};
} else {
return {
message: () => `expected ${received} to match snapshot ${snapshot}`,
pass: false,
};
}
}
});