Skip to content

Commit de27110

Browse files
committed
chore: add more examples to docs
fix diffConfig.threshold data type in README Signed-off-by: Jakub Freisler <[email protected]>
1 parent 84482eb commit de27110

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ cy.matchImage({
121121
// pixelmatch options, see: https://www.npmjs.com/package/pixelmatch#pixelmatchimg1-img2-output-width-height-options
122122
// default: { includeAA: true }
123123
diffConfig: {
124-
threshold: '0.01',
124+
threshold: 0.01,
125125
},
126126
// whether to update images automatically, without making a diff - useful for CI
127127
// default: false
@@ -135,9 +135,29 @@ cy.matchImage({
135135
- via [global env configuration](https://docs.cypress.io/guides/guides/environment-variables#Setting). All of the environment variable names are the same as keys of the configuration options passed to `matchImage` method, but with added `pluginVisualRegression` prefix, e.g.:
136136

137137
```bash
138-
npx cypress run --env "pluginVisualRegressionUpdateImages=true" --env 'pluginVisualRegressionDiffConfig={"threshold":"0.01"}'
138+
npx cypress run --env "pluginVisualRegressionUpdateImages=true" --env 'pluginVisualRegressionDiffConfig={"threshold":0.01}'
139139
```
140140

141+
```json
142+
// cypress.json
143+
{
144+
"env": {
145+
"pluginVisualRegressionUpdateImages": true,
146+
"pluginVisualRegressionDiffConfig": { "threshold": 0.01 }
147+
}
148+
}
149+
```
150+
151+
```json
152+
// cypress.env.json (https://docs.cypress.io/guides/guides/environment-variables#Option-2-cypress-env-json)
153+
{
154+
"pluginVisualRegressionUpdateImages": true,
155+
"pluginVisualRegressionDiffConfig": { "threshold": 0.01 }
156+
}
157+
```
158+
159+
For more ways of setting environment variables [take a look here](https://docs.cypress.io/guides/guides/environment-variables#Setting).
160+
141161
## Questions
142162

143163
Don’t hesitate to ask a question directly on the [discussions board](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/discussions)!

0 commit comments

Comments
 (0)