kien-ht / cypress-image-diff-html-report

A HTML reporting module for Cypress-Image-Diff to parse the JSON output into a beautiful report
MIT License
26 stars 2 forks source link

CLI not using configFile defined by flag #18

Open DavidRNogueira opened 1 month ago

DavidRNogueira commented 1 month ago

I have a config file named: visual-regression-html-report.config.js

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

export default defineConfig({
  reportJsonDir: 'visual-regression/html-report',
  outputDir: 'visual-regression/html-report',
  autoOpen: true
});

I also have a cypress-image-diff.config.js:

const config = {
  SCREENSHOTS_DIR: 'visual-regression',
  JSON_REPORT: {
    FILENAME: 'cypress_visual_report',
    OVERWRITE: true
  },
  REPORT_DIR: 'visual-regression/html-report'
};

module.exports = config;

When I run cypress-image-diff-html-report generate --configFile visual-regression-html-report.config.js

I see the following error:

[cypress-image-diff-html-report]: Given reportJsonDir does not exist /path/to/project/cypress-image-diff-html-report. Make sure you specify a valid reportJsonDir or reportJsonFilePat

I see the same issue with the start command. If I pass the reportJsonDir flags directly to the CLI, it works. For some reason the configFile CLI option is not working

kien-ht commented 1 month ago

Hi @DavidRNogueira, this problem occurs when your custom config file could not be found, so the default config will be used instead, which is /path/to/project/cypress-image-diff-html-report.

Please note that: cypress-image-diff-html-report generate --configFile path-to-your-config-file path-to-your-config-file has to be a relative path to where you run this command. Can you confirm that?