Skip to content

Instantly share code, notes, and snippets.

@estefafdez
Created January 14, 2022 09:25
Show Gist options
  • Save estefafdez/00ae5a6c59bd68634db5121b6b0c1050 to your computer and use it in GitHub Desktop.
Save estefafdez/00ae5a6c59bd68634db5121b6b0c1050 to your computer and use it in GitHub Desktop.
cypress/plugins/index.js with different configuration files.
// promisified fs module
const fs = require('fs-extra')
const path = require('path')
function getConfigurationByFile(file) {
const pathToConfigFile = path.resolve(__dirname, '../config', `${file}.json`)
return fs.readJson(pathToConfigFile)
}
// plugins file
module.exports = (on, config) => {
// accept a configFile value or use qa by default
const file = config.env.configFile || 'qa'
console.info('\n> Cypress config:', config);
return getConfigurationByFile(file)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment