In cypress how can I ignore the dotenv
(.env) file while running in jenkins, as jenkins run on actual environment variables. Now I am getting No such file or directory
open/student-proj/.env
How can I check if it is running in jenkins then use actual env variables else use .env
?
plugins/index.js
const configEnv = require('dotenv').config();
const cucumber = require('cypress-cucumber-preprocessor').default;
module.exports = (on, config) => {
on('file:preprocessor', cucumber());
if (configEnv.error) {
throw configEnv.error;
}
const env = { ...config.env, ...configEnv.parsed };
const envData = { ...config, env };
return envData;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…