reg-cli is a command-line interface (CLI) tool for performing visual regression testing on images and generating a comprehensive, interactive HTML report. It helps developers detect unintended visual changes in user interfaces over time by comparing 'actual' images with 'expected' baseline images. The current stable version is 0.18.14, with development actively focused on minor feature enhancements to the report UI, dependency updates, and security patches. Key differentiators include its flexible image comparison logic with adjustable thresholds, support for parallel processing, and the ability to generate reports from pre-existing JSON data. It requires Node.js v18 or newer for execution, ensuring compatibility with modern JavaScript environments. It is primarily used via its CLI but also exposes a programmatic API for integration into custom build workflows.
npm install reg-cliVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to run `reg-cli` from a Node.js script to compare images, generate a diff, and output an HTML report. It sets up dummy directories and files, then executes the CLI command with common options.
Migrate your commands to use `--thresholdRate` and/or `--thresholdPixel` instead of `--threshold`. `--threshold` is now an alias for `--thresholdRate`.
Upgrade your Node.js environment to version 18 or newer using a tool like `nvm` or by installing a recent Node.js distribution.
To prevent `reg-cli` from throwing an error and exiting non-zero when changes are detected, use the `--ignoreChange` (or `-I`) option. If you also want to ignore errors for added/deleted images, use `--extendedErrors` (or `-E`) in combination.
Review your visual regression tests after upgrading to ensure the new comparison engine yields expected results. Adjust `--matchingThreshold`, `--thresholdRate`, or `--thresholdPixel` if necessary.
Regularly update `reg-cli` to its latest patch version to ensure all dependency vulnerabilities are addressed. Use `npm audit` to check for specific issues.
Update your Node.js environment to version 18 or newer. For example, using `nvm install 18 && nvm use 18`.
Ensure that your `actual` image directory contains the images you intend to compare. Verify the paths provided to `reg-cli` are correct.
If this is an expected outcome (e.g., in a CI pipeline where differences are allowed but reported), add the `--ignoreChange` flag to the `reg-cli` command. Use `--extendedErrors` in addition to `--ignoreChange` if you also want to ignore errors for added/deleted images.
Replace `--threshold` with `--thresholdRate` (e.g., `--thresholdRate 0.05`) or `--thresholdPixel` (e.g., `--thresholdPixel 10`) depending on your desired comparison metric.