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

Inconsistent behaviour about envvars #2726

kud opened this Issue Nov 6, 2018 · 3 comments


2 participants

kud commented Nov 6, 2018

I'm reading and I've got some troubles.

I'm setting our cypress configuration on cypress.json. Which is great. However, I can't set there the baseUrl as we have different url for each dev machine like:


So by reading, I can see two things

1/ I am able to use a cypress.env.json to set some envvars, which is great, because we've got multiple projects with cypress so CYPRESS_baseUrl in shell is impossible + we don't want to pollute our shell.

2/ I read there I can override standard configuration keys by using the same word like baseUrl like CYPRESS_baseUrl. However, said in the 1/, I don't want to use shell envvars. So I thought, writing in cypress.env.json could be the trick like:

  • cypress.json
  "fixturesFolder": "__tests__/cypress/fixtures",
  "integrationFolder": "__tests__/cypress/integration",
  "pluginsFile": "__tests__/cypress/plugins/index.js",
  "screenshotsFolder": "__tests__/cypress/screenshots",
  "supportFile": "__tests__/cypress/support/index.js",
  "videosFolder": "__tests__/cypress/videos",
  "video": false
  • cypress.env.json
  "baseUrl": ""

but in fact, it doesn't work at all as it does this (when debugging config):

  baseUrl: null,
  env: { baseUrl: 'http://journal.erwann.contexte:8000/' },

which is quite logical but does not do the magic said there: (yes, the example was for the shell but we could imagine it worked with any way to write envvars).

So I'd like to ask you to make a choice:

Note that it's just my opinion, and I'll use a workaround for the moment which is there:

I want to be able to override configuration in cypress.env.json. :)

Thank you for your time.


This comment has been minimized.

kud commented Nov 6, 2018

My current workaround:


module.exports = (on, config) => {
  config.baseUrl = config.env.baseUrl

  return config

This comment has been minimized.


jennifer-shehane commented Nov 6, 2018

There is a long thread involving env vars and baseUrl here: #909


This comment has been minimized.

kud commented Nov 6, 2018

Thank you @jennifer-shehane :)

@kud kud closed this Nov 6, 2018

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