Skip to content

Commit f4d3ec9

Browse files
committed
fix: treat maxDiffThreshold 0 as valid value
Signed-off-by: Jakub Freisler <[email protected]>
1 parent d48fa3e commit f4d3ec9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/commands.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ const getImagesDir = (options: Cypress.MatchImageOptions) => {
7575

7676
export const getConfig = (options: Cypress.MatchImageOptions) => {
7777
const imagesDir = getImagesDir(options);
78+
const maxDiffThreshold =
79+
options.maxDiffThreshold ??
80+
(Cypress.env("pluginVisualRegressionMaxDiffThreshold") as
81+
| number
82+
| undefined);
7883

7984
return {
8085
scaleFactor:
@@ -94,11 +99,7 @@ export const getConfig = (options: Cypress.MatchImageOptions) => {
9499
(Cypress.env("pluginVisualRegressionImagesPath") as string | undefined) ||
95100
"{spec_path}/__image_snapshots__",
96101
maxDiffThreshold:
97-
options.maxDiffThreshold ||
98-
(Cypress.env("pluginVisualRegressionMaxDiffThreshold") as
99-
| number
100-
| undefined) ||
101-
0.01,
102+
typeof maxDiffThreshold === "number" ? maxDiffThreshold : 0.01,
102103
diffConfig:
103104
options.diffConfig ||
104105
(Cypress.env("pluginVisualRegressionDiffConfig") as

0 commit comments

Comments
 (0)