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;
}
why not just use a jenkins env variable specific in your code e.g. JOB_NAME ... if the value returns null... that means its not running on jenkins