You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@parallaxagency/retrogress

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parallaxagency/retrogress

Make reference screenshots and check against them before comitting major changes to reduce chances of visual regression.

1.0.6
latest
npmnpm
Version published
Maintainers
1
Created
Source

Introduction

Tested on node version v8.9.4.

Retrogress allows you to make reference screenshots and check against them before comitting major changes to see whats changed and hopefully catch bugs earlier.

Uses puppeteer for generating page screenshots and pixelmatch for visual diffing.

Installation

To install retrogress in a project:

yarn add @parallaxagency/retrogress

Then add retrogress in an npm script for some nicer aliases:

{
  "scripts": {
    "diffs:reference": "retrogress --reference",
    "diffs:latest": "retrogress",
    "diffs:compare": "retrogress --diff"
  }
}

And finally you need to add a config file for the routes and sizes you want to generate screenshots for. Retrogress will look for a .retrogress.js file in the project root but you can change where this is located with the --config flag.

Config

The bare minimum you need in your .retrogress.js config is a routes object.

module.exports = {
  routes: {
    'home': 'http://example.com'
  }
}

The following options are available with defaults shown.

module.exports = {
  rootDir: path.join(process.cwd(), '/.retrogress'), // Defaults (not required)
  referenceFolder: 'reference', // Defaults (not required)
  latestFolder: 'latest', // Defaults (not required)
  diffsFolder: 'diffs', // Defaults (not required)
  sizes: [
    {
      width: 1920,
      height: 1080
    },
    {
      width: 320,
      height: 568
    }
  ],
  loadDelay: 1000, // Defaults (not required)
  pixelDifferenceThreshold: 0.1, // Defaults (not required)
  routes: { // (required)
    'home': 'http://example.com/',
    'about': 'http://example.com/about',
    'services-index': 'http://example.com/services',
    'services-view': 'http://example.com/services/view'
  }
}

Usage

Usage is fairly simple, when your happy with how the site looks run: npm run diffs:reference to generate your reference screenshots.

Then after doing any major changes you can run npm run diffs:latest and npm run diffs:compare to view any changes you've made.

All files generated are stored in the .retrogress folder in the project root.

Development Setup

To compile JS with babel and watch for changes:

npm run dev

To make a release version:

npm run transpile

To run linters:

npm run lint

It's unlikely you will even have to run the last two commands as they are automatically run when publishing a new version or committing changes.

FAQs

Package last updated on 28 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts