Created
January 14, 2022 09:25
-
-
Save estefafdez/00ae5a6c59bd68634db5121b6b0c1050 to your computer and use it in GitHub Desktop.
cypress/plugins/index.js with different configuration files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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