cypress: cypress run -b chrome fails if you attempt to change the baseUrl

Current behavior:

cypress run fails if you attempt to change the baseUrl from the command line while using the --browser chrome option

Running each of these commands individually work as expected with no errors > cypress run --browser chrome > cypress run --config baseUrl=http://localhost:3000

but strangely, combining them both causes the process to immediately exit with an error. The failure is almost immediate, there is no output from cypress and no tests are run.

> cypress run --browser chrome --config baseUrl=http://localhost:3000

Error: my-project@0.0.0 cypress:cl: `cypress run --browser chrome --config baseUrl=http://localhost:3000`
Exit status 4294967295
    at EventEmitter.<anonymous> (C:\ProgramData\nvm\v8.11.3\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
    at emitTwo (events.js:126:13)
    at EventEmitter.emit (events.js:214:7)
    at ChildProcess.<anonymous> (C:\ProgramData\nvm\v8.11.3\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

It seemed strange, so I tried combining --browser chrome with other options. This ran as expected with no errors: > cypress run --browser chrome --config chromeWebSecurity=false

But if you try to set the baseUrl with --env, the same error occurs!

> cypress run --browser chrome --env baseUrl=http://localhost:3000

My current workaround is to set the CYPRESS_BASE_URL environment variable manually prior to calling cypress run.

Desired behavior:

> cypress run --browser chrome --config baseUrl=http://localhost:3000 should not fail

Steps to reproduce:

set baseUrl in cypress.json to localhost:4200 then run > cypress run --browser chrome --config baseUrl=http://localhost:3000

Versions

Cypress 3.1.0 Windows 10 using git bash Node 8.11.3 Chrome Version 69.0.3497.100

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 16 (8 by maintainers)

Most upvoted comments

I’m experiencing the exact same behavior as @MadLittleMods npx cypress open With no parameters, using config file settings, it works fine, however if I add --config baseUrl=X it fails. The debug output is identical. Ends with cypress:cli child event fired { event: ‘exit’, code: 4294967295, signal: null } +35ms cypress:cli child event fired { event: ‘close’, code: 4294967295, signal: null } +2ms

This happened as soon as I upgraded to 3.5

I am running windows 10. node@12.13.0 npm@6.5.0

@flotwig For reference, here is the MR where we are updating to Cypress 3.5.0, https://gitlab.com/gitlab-org/gitter/webapp/merge_requests/1631. I just did a workaround using the env field in cypress.json instead of passing variables via --env

Cypress 3.5.0 and --env

Here is the output with set DEBUG=cypress:* and no workaround

$ npm run cypress -- run --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api

npm WARN npm npm does not support Node.js v10.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> gitter-webapp@19.2.0 cypress C:\Users\MLM\Documents\GitLab\webapp
> cypress "run" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"

  cypress:cli cli starts with arguments ["C:\\Program Files\\nodejs\\node.exe","C:\\Users\\MLM\\Documents\\GitLab\\webapp\\node_modules\\cypress\\bin\\cypress","run","--env","baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli program parsing arguments +11ms
  cypress:cli running Cypress +3ms
  cypress:cli parsed cli options { env:
   'baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api' } +81ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +2ms
  cypress:cli checking if executable exists C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\Cypress.exe +3ms
  cypress:cli Binary is executable? : true +3ms
  cypress:cli binaryDir is  C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress +1ms
  cypress:cli Reading binary package.json from: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\resources\app\package.json +0ms
  cypress:cli Found binary version 3.5.0 installed in: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress +6ms
  cypress:cli { verified: true } +8ms
  cypress:cli is Verified ? true +5ms
  cypress:cli processing run options +0ms
  cypress:cli --key is not set, looking up environment variable CYPRESS_RECORD_KEY +1ms
  cypress:cli run to spawn.start args ["--run-project","C:\\Users\\MLM\\Documents\\GitLab\\webapp","--env","baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"] +1ms
  cypress:cli needs to start own Xvfb? false +0ms
  cypress:cli spawning, should retry on display problem? false +1ms
  cypress:cli spawning Cypress with executable: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\Cypress.exe +32ms
  cypress:cli spawn args [ '--run-project', 'C:\\Users\\MLM\\Documents\\GitLab\\webapp', '--env', 'baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api', '--cwd', 'C:\\Users\\MLM\\Documents\\GitLab\\webapp' ] { detached: false, stdio: 'pipe', windowsHide: false } +3ms
  cypress:cli piping process STDIN into child STDIN +140ms
  cypress:cli piping child STDOUT to process STDOUT +2ms
  cypress:cli piping child STDERR to process STDERR +2ms
  cypress:cli child event fired { event: 'exit', code: 4294967295, signal: null } +26ms
  cypress:cli child event fired { event: 'close', code: 4294967295, signal: null } +2ms
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! gitter-webapp@19.2.0 cypress: `cypress "run" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the gitter-webapp@19.2.0 cypress script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MLM\AppData\Roaming\npm-cache\_logs\2019-10-28T21_19_31_425Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! gitter-webapp@19.2.0 test-e2e-run: `npm run cypress -- run --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the gitter-webapp@19.2.0 test-e2e-run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MLM\AppData\Roaming\npm-cache\_logs\2019-10-28T21_19_31_516Z-debug.log
$ npm run cypress -- open --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api

npm WARN npm npm does not support Node.js v10.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> gitter-webapp@19.2.0 cypress C:\Users\MLM\Documents\GitLab\webapp
> cypress "open" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"

  cypress:cli cli starts with arguments ["C:\\Program Files\\nodejs\\node.exe","C:\\Users\\MLM\\Documents\\GitLab\\webapp\\node_modules\\cypress\\bin\\cypress","open","--env","baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli program parsing arguments +5ms
  cypress:cli opening Cypress +3ms
  cypress:cli parsed cli options { env:
   'baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api' } +79ms
  cypress:cli opening from options {"env":"baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api","project":"C:\\Users\\MLM\\Documents\\GitLab\\webapp"} +0ms
  cypress:cli command line arguments ["--env","baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api","--project","C:\\Users\\MLM\\Documents\\GitLab\\webapp"] +2ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +2ms
  cypress:cli checking if executable exists C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\Cypress.exe +5ms
  cypress:cli Binary is executable? : true +7ms
  cypress:cli binaryDir is  C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress +2ms
  cypress:cli Reading binary package.json from: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\resources\app\package.json +0ms
  cypress:cli Found binary version 3.5.0 installed in: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress +10ms
  cypress:cli { verified: true } +12ms
  cypress:cli is Verified ? true +9ms
  cypress:cli needs to start own Xvfb? false +0ms
  cypress:cli spawning, should retry on display problem? false +5ms
  cypress:cli spawning Cypress with executable: C:\Users\MLM\AppData\Local\Cypress\Cache\3.5.0\Cypress\Cypress.exe +39ms
  cypress:cli spawn args [ '--env', 'baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api', '--project', 'C:\\Users\\MLM\\Documents\\GitLab\\webapp', '--cwd', 'C:\\Users\\MLM\\Documents\\GitLab\\webapp' ] { detached: false, stdio: 'inherit', windowsHide: false } +2ms
  cypress:cli child event fired { event: 'exit', code: 4294967295, signal: null } +184ms
  cypress:cli child event fired { event: 'close', code: 4294967295, signal: null } +4ms

I only started seeing the problem with Cypress 3.5.0

  • Windows 10
  • npm@6.11.3
  • node@10.15.1
  • Cypress 3.4.1 ✔️
  • Cypress 3.5.0 ❌

For reference, our Cypress tests are here, https://gitlab.com/gitlab-org/gitter/webapp/blob/086ff67a30a838091fec30beedd923a920797cca/test/e2e/e2e-test.js


Related issues:

Cypress 3.4.1 ✔️

$ npm run cypress -- run --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api

... tests run as normal ...

Using cypress open, test runner appears and tests can run,

$ npm run cypress -- open --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api


npm WARN npm npm does not support Node.js v10.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> gitter-webapp@19.2.0 cypress C:\Users\MLM\Documents\GitLab\webapp
> cypress "open" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"

Cypress 3.5.0 ❌

$ npm run cypress -- run --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api

npm WARN npm npm does not support Node.js v10.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> gitter-webapp@19.2.0 cypress C:\Users\MLM\Documents\GitLab\webapp
> cypress "run" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"

npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! gitter-webapp@19.2.0 cypress: `cypress "run" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the gitter-webapp@19.2.0 cypress script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MLM\AppData\Roaming\npm-cache\_logs\2019-10-28T10_55_01_062Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! gitter-webapp@19.2.0 test-e2e-run: `npm run cypress -- run --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the gitter-webapp@19.2.0 test-e2e-run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MLM\AppData\Roaming\npm-cache\_logs\2019-10-28T10_55_01_161Z-debug.log

Using cypress open, nothing happens (no test runner appears) and it just exits right away,

$ npm run cypress -- open --env baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api

npm WARN npm npm does not support Node.js v10.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> gitter-webapp@19.2.0 cypress C:\Users\MLM\Documents\GitLab\webapp
> cypress "open" "--env" "baseUrl=http://localhost:5000,apiBaseUrl=http://localhost:5000/api"

I also saw this and started using CYPRESS_baseUrl env variable instead - this actually ended up simplifying my workflow so I forgot about this issue as it no longer affects me.