processFile = async (page, name) => {
    await page.goto(`http://localhost:${PORT}/original/${name}`);
    const originalBuffer = await page.screenshot(screenshotOptions);
    await page.goto(`http://localhost:${PORT}/optimized/${name}`);
    const optimizedBufferPromise = page.screenshot(screenshotOptions);

    const writeDiffs = process.env.NO_DIFF == null;
    const diff = writeDiffs ? new PNG({ width: WIDTH, height: HEIGHT }) : null;
    const originalPng = PNG.sync.read(originalBuffer);
    const optimizedPng = PNG.sync.read(await optimizedBufferPromise);
    const matched = pixelmatch(
      originalPng.data,
      optimizedPng.data,
      diff?.data,
      WIDTH,
      HEIGHT,
    );
    // ignore small aliasing issues
    if (matched <= 4) {
      passed++;
    } else {
      mismatched++;
      console.error(`${name} is mismatched`);
      if (diff) {
        const file = path.join(
          __dirname,
          'regression-diffs',
          `${name}.diff.png`,
        );
        await fs.mkdir(path.dirname(file), { recursive: true });
        await fs.writeFile(file, PNG.sync.write(diff));
      }
    }
  }
@param {import('playwright').Page} page
@param {string} name