Open AnnaLohse opened 4 years ago
Is there any update from this enhancement?
module.exports = (on, config) => { require('cypress-plugin-snapshots/plugin').initPlugin(on, config); if (process.env.CYPRESS_SNAPSHOT_UPDATE) { const parseConfig = JSON.parse(config.env['cypress-plugin-snapshots']); parseConfig.updateSnapshots = process.env.CYPRESS_SNAPSHOT_UPDATE; config.env['cypress-plugin-snapshots'] = JSON.stringify(parseConfig); } return config; };
parseConfig.updateSnapshots = process.env.CYPRESS_SNAPSHOT_UPDATE;
I had to parseConfig.updateSnapshots = true;
to make this work as process.env.CYPRESS_SNAPSHOT_UPDATE
was actually holding the String
"true"
, so the snapshots were not updating.
problem It is far too laborious to delete all the incorrect snapshot files manually when there have been changes. I want to be able to write an npm script that sets UpdateSnapshot to true and then runs my tests.
solution Pass environment variables like UpdateSnapshot from the command line.
Describe alternatives you've considered Set UpdateSnapshot in e2e/plugins/index.js, which then internally configures the Cypress Snapshot plugin.
Usage:
CYPRESS_SNAPSHOT_UPDATE=true yarn run e2e:dev