Cypress Image Diff Documentation
  • Migrate from v1 to v2
  • Getting started
    • Cypress integration
      • Typescript
      • Javascript
      • Browserstack
      • Cypress < v10
    • cy.compareSnapshot command
    • Custom config file
      • ROOT_DIR
      • FAILURE_THRESHOLD
      • RETRY_OPTIONS
      • FAIL_ON_MISSING_BASELINE
      • COMPARISON_OPTIONS
      • JSON_REPORT
      • CYPRESS_SCREENSHOT_OPTIONS
      • REPORT_DIR
      • SCREENSHOTS_DIR
      • NAME_TEMPLATE
    • Reporting
      • JSON report
      • Cypress Image Diff HTML Report
      • Legacy HTML Report
    • Client options
    • Running tests
    • Contributing
    • Publishing
Powered by GitBook
On this page
  1. Getting started

Custom config file

Options for custom config file

Previouscy.compareSnapshot commandNextROOT_DIR

Last updated 6 months ago

If you'd like to take advantages of additional features, you will need to set up the custom config file.

Create a file called cypress-image-diff.config.js. This should live along side cypress.config.js, in the root of the directory.

If your project is written in ESM module, then you would need to use .cjs instead of .js extension.

// cypress-image-diff.config.js
// cypress-image-diff.config.cjs
const config = {
  ROOT_DIR: 'custom-folder-name',
};

module.exports = config;

Note: In order to make this custom config values effective, remember to return getCompareSnapshotsPlugin instance inside function setupNodeEvents:

export default defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
     return getCompareSnapshotsPlugin(on, config);
    },
  },
})

Currently supported values in the custom config file:

ROOT_DIR
FAILURE_THRESHOLD
RETRY_OPTIONS
FAIL_ON_MISSING_BASELINE
COMPARISON_OPTIONS
JSON_REPORT
CYPRESS_SCREENSHOT_OPTIONS
REPORT_DIR
SCREENSHOTS_DIR