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

Cannot override Cypress environment variables #798

Closed
bugzpodder opened this issue Oct 23, 2017 · 2 comments
Closed

Cannot override Cypress environment variables #798

bugzpodder opened this issue Oct 23, 2017 · 2 comments

Comments

@bugzpodder
Copy link

  • Operating System: macOS
  • Cypress Version: 1.0.2
  • Browser Version: Chrome

Is this a Feature or Bug?

Bug

Current behavior:

Cypress cannot load environments from two of the four methods described in the doc:
https://docs.cypress.io/guides/guides/environment-variables.html
Option 1 and Option 3 works fine. Option 2 and Option 4 doesn't work (only tested on baseUrl).
cypress.json
{}
cypress.env.json (no effect)
{
"baseUrl": "http://localhost:3000"
}

CYPRESS_baseUrl=http://localhost:3000 ./node_modules/.bin/cypress run (works as expected)

cypress run --env baseUrl=http://localhost:3000 (did not work)

Desired behavior:

All four methods work.

How to reproduce:

specify --env or use cypress.env.json

Test code:

Additional Info (images, stack traces, etc)

@brian-mann brian-mann added the stage: investigating Someone from Cypress is looking into this label Oct 23, 2017
@brian-mann
Copy link
Member

Thank you for opening a comprehensive issue.

We'll take a look but there are a ton of tests around this in various places that express all 4 ways of setting environment variables.

For instance here is one:

https://github.com/cypress-io/cypress/blob/develop/packages/server/test/integration/cypress_spec.coffee#L673

@bugzpodder
Copy link
Author

It turns out that baseUrl is a config variable, not an environment variable.
https://docs.cypress.io/guides/references/configuration.html
one needed to specify --config in CLI rather than --env.

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