Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I pass environment variable as arguments in command line #163

Open
tausif29 opened this issue Apr 10, 2023 · 4 comments
Open

How do I pass environment variable as arguments in command line #163

tausif29 opened this issue Apr 10, 2023 · 4 comments

Comments

@tausif29
Copy link

"cy:run": "npx cypress run --browser chrome",
"cy:parallel" : "cypress-parallel -s cy:run -t 4 -d cypress/e2e/features/ -m false -a '\"--env ENV=${ENVI}\"'",

I have above script command, I want to pass ENVI as LIVE or QA
System is not accepting the environment variable in above command

Can you share how do I pass the the arguments in above command?

@KeenanBailey
Copy link

KeenanBailey commented Jun 13, 2023

windows cmd: "cy:open": "cypress open -C cypress/config/%npm_config_envi%.config.js",
cross-var cmd: "cy:run": "cross-var cypress run -C cypress/config/$npm_config_envi.config.js",

execution cmd: npm run cy:open --envi=live

@antonio-junior
Copy link

@tausif29 were you able to make it work?

@antonio-junior
Copy link

it worked by using:

cy:run:test": "cross-var cypress-parallel -s cy:run -t 6 -d cypress/e2e/features/* -a '"--env env=$npm_config_env"'"

@tausif29
Copy link
Author

tausif29 commented Feb 4, 2024

Yes it worked for me with below 2 commands:

$env:ENVI="QA"
npm run cy:parallel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants