How to use the mugshot.pixelDiffer.compare function in mugshot

To help you get started, we’ve selected a few mugshot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NiGhTTraX / mugshot / packages / browser-contract / src / expectations.ts View on Github external
export async function expectIdenticalScreenshots(
  screenshot: Buffer,
  baselineName: string,
  message?: string
) {
  const { BROWSER } = process.env;

  const baseline = await fs.readFile(
    path.join(__dirname, `./screenshots/${BROWSER}/${baselineName}.png`)
  );

  // eslint-disable-next-line no-unused-expressions
  expect((await pixelDiffer.compare(baseline, screenshot)).matches, message).to.be.true;
}