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

Environment Variables Guide states (wrongly?) that CLI --env doesn't support nested fields. #5718

Open
LazaroOnline opened this issue Feb 25, 2024 · 1 comment

Comments

@LazaroOnline
Copy link

LazaroOnline commented Feb 25, 2024

Subject

Guides

Description

In this guide:
https://docs.cypress.io/guides/guides/environment-variables#Option-4---env

In the "Downsides" section for CLI it states: "No support for nested fields",
however I DO can pass nested fields from the CLI --env parameter by using JSON string values:

The cypress docs for --env param shows the use of JSON parameters.

And tested by me in Cypress v13.6.3, example from package.json scripts:

"cy:open": "cypress open --env \"{\\\"conf1\\\":\\\"val 1,2\\\", \\\"nested\\\":{\\\"subProp\\\":true}}\"", 

or as a simple command:
cypress open --env '{"conf1":"val 1,2", "nested": { "subProp": true } }'

Also by using JSON I can pass special characters within string values like single/double quotes and spaces.

Should the guide be updated to document the JSON values and state that nested fields are supported?

@jennifer-shehane
Copy link
Member

@LazaroOnline We'd be open to a PR to fix this.

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

No branches or pull requests

2 participants