Skip to content

Commit

Permalink
fix: treat maxDiffThreshold 0 as valid value
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Freisler <[email protected]>
  • Loading branch information
FRSgit committed Mar 26, 2023
1 parent d48fa3e commit f4d3ec9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ const getImagesDir = (options: Cypress.MatchImageOptions) => {

export const getConfig = (options: Cypress.MatchImageOptions) => {
const imagesDir = getImagesDir(options);
const maxDiffThreshold =
options.maxDiffThreshold ??
(Cypress.env("pluginVisualRegressionMaxDiffThreshold") as
| number
| undefined);

return {
scaleFactor:
Expand All @@ -94,11 +99,7 @@ export const getConfig = (options: Cypress.MatchImageOptions) => {
(Cypress.env("pluginVisualRegressionImagesPath") as string | undefined) ||
"{spec_path}/__image_snapshots__",
maxDiffThreshold:
options.maxDiffThreshold ||
(Cypress.env("pluginVisualRegressionMaxDiffThreshold") as
| number
| undefined) ||
0.01,
typeof maxDiffThreshold === "number" ? maxDiffThreshold : 0.01,
diffConfig:
options.diffConfig ||
(Cypress.env("pluginVisualRegressionDiffConfig") as
Expand Down

0 comments on commit f4d3ec9

Please sign in to comment.