cypress-image-snapshot
cypress-image-snapshot copied to clipboard
--env customSnapshotsDir ?
It'd be highly convenient to have a way to pass customSnapshotsDir
value from the CLI!
I just came across this yesterday and solved it that way:
cypress run --env customSnapshotsDir=cypress/snapshots/CI
and then in command.js set it globally via:
addMatchImageSnapshotCommand({ customSnapshotsDir: Cypress.env('customSnapshotsDir') });
However this took me a while to find out since I thought setting it via --env would be enough, so I agree, that this should be able to pass via CLI without doing changes in code.
This cypress run --env customSnapshotsDir=cypress/snapshots/CI
doesn't work, that's my point.
You need to set it up globally in command.js, which is not convenient.
It should be possible to override this setting from CLI.
@nodje Instead of:
cypress run --env customSnapshotsDir=cypress/snapshots/CI
Use:
CYPRESS_customSnapshotsDir=cypress/snapshots/CI
And what @christophamma mentioned:
addMatchImageSnapshotCommand({ customSnapshotsDir: Cypress.env('customSnapshotsDir') });
It works for me.