npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cypress-image-diff-html-report

v2.2.0

Published

A HTML reporting module for Cypress-Image-Diff to parse the JSON output to a beautiful report

Downloads

115,313

Readme

Overview

A HTML reporting module for Cypress-Image-Diff to parse the JSON output into a beautiful report

Update baseline screenshots

Support different screenshot inspectors

Provide with light/dark/system default theme

Installation

Make sure you install Cypress and cypress-image-diff prior to this report installation.

npm install -D cypress-image-diff-html-report

Project setup

Once you've installed the package, you are good to go without any further configuration. However, you can create a configuration file if you do want more custom configurations. cypress-image-diff-html-report will look for the cypress-image-diff-html-report.config.js file under the root of your project.

You can use the defineConfig helper which provides intellisense:

import { defineConfig } from 'cypress-image-diff-html-report'

export default defineConfig({
  // config options
})

If you’d like to specify a different config filename than the default, use the --configFile command line option.

See all available configurations here.

CLI

This is the most common way to use cypress-image-diff-html-report. It supports two commands: generate and start.

  • generate: generates the HTML report and writes to disk wherever it's designated.

    cypress-image-diff-html-report generate [options]
  • start: starts a local server, which will serve the HTML report on the fly. You don't need to run generate before this command if you don't want to write the HTML report to your disk.

    cypress-image-diff-html-report start [options]

See all available CLI options here.

API

cypress-image-diff-html-report can be used to programmatically generate reports or start a local server. Whichever option is available via CLI is also available in the API. It is useful to use the API if you need more flexibility or to integrate with other third parties.

  • generate:

    import { generate } from 'cypress-image-diff-html-report'
    
    ;(async () => {
      await generate({
        configFile: 'custom.config.js',
        // ...
      })
    })()
  • start:

    import { start } from 'cypress-image-diff-html-report'
    
    ;(async () => {
      await start({
        configFile: 'custom.config.js',
        serverPort: 3000
        // ...
      })
    })()

See all available API options here.

Example integration

Run generate as soon as all the tests are executed.

// package.json
{
  "scripts": {
    "test:e2e": "cypress run --headless && cypress-image-diff-html-report generate --configFile my-visual-html-report.config.js"
  }
}

Often times you want to serve the HTML report locally to perform snapshot update features. Run the start command when the json report is in place:

cypress-image-diff-html-report start --configFile my-visual-html-report.config.js

All available options in the CLI, API, and config files

Config file options

| Options | Type | Description | Default value | | -------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | | reportJsonDir | string | Specify the report json directory, relative to the process.cwd(). Cypress-image-diff-html-report will automatically look for the latest created json file in this directory | cypress-image-diff-html-report | | reportJsonFilePath | string | Specify the report json file path, relative to the process.cwd(). If provided, reportJsonDir will be ignored | undefined | | outputDir | string | Set the output directory of the generated HTML report, relative to the process.cwd() | cypress-image-diff-html-report | | baseDir | string | Specify the base directory for all the interal paths in the report json, relative to the process.cwd(). (Note: This field does not have any effect on the configFile, reportJsonFilePath and outputDir) | '' | | inlineAssets | boolean | Whether to inline all screenshots to base64 for the generated HTML | false | | autoOpen | boolean | Open the HTML report in the default browser as soon as the server starts | false | | serverPort | number | Set the port of the local server | 6868 |

Generate options

| CLI | API options | Type | Description | Default value | | ----------------------------------- | -------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | -c, --configFile | configFile | string | Specify config file, will be overwritten by other config options if provided, relative to the process.cwd() | cypress-image-diff-html-report.config.js | | --rd, --reportJsonDir <dir> | reportJsonDir | string | Specify the report json directory, relative to the process.cwd(). Cypress-image-diff-html-report will automatically look for the latest created json file in this directory | cypress-image-diff-html-report | | --rf, --reportJsonFilePath <file> | reportJsonFilePath | string | Specify the report json file path, relative to the process.cwd(). If provided, reportJsonDir will be ignored | undefined | | -o, --outputDir <dir> | outputDir | string | Set the output directory of the generated HTML report, relative to the process.cwd() | cypress-image-diff-html-report | | --baseDir <dir> | baseDir | string | Specify the base directory for all the interal paths in the report json, relative to the process.cwd(). (Note: This field does not have any effect on the configFile, reportJsonFilePath and outputDir) | '' | | --inlineAssets | inlineAssets | boolean | Whether to inline all screenshots to base64 for the generated HTML | false |

Start options

| CLI | API options | Type | Description | Default value | | ----------------------------------- | -------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | -c, --configFile | configFile | string | Specify config file, will be overwritten by other config options if provided, relative to the process.cwd() | cypress-image-diff-html-report.config.js | | --rd, --reportJsonDir <dir> | reportJsonDir | string | Specify the report json directory, relative to the process.cwd(). Cypress-image-diff-html-report will automatically look for the latest created json file in this directory | cypress-image-diff-html-report | | --rf, --reportJsonFilePath <file> | reportJsonFilePath | string | Specify the report json file path, relative to the process.cwd(). If provided, reportJsonDir will be ignored | undefined | | --baseDir <dir> | baseDir | string | Specify the base directory for all the interal paths in the report json, relative to the process.cwd(). (Note: This field does not have any effect on the configFile, reportJsonFilePath and outputDir) | '' | | --autoOpen | autoOpen | boolean | Open the HTML report in the default browser as soon as the server starts | false | | --serverPort | serverPort | number | Set the port of the local server | 6868 |