@cypress/schematic: Can not use a config file and automatic port from dev server #29756
Labels
npm: @cypress/schematic
@cypress/schematic package issues
stale
no activity on this issue for a long period
type: unexpected behavior
User expected result, but got another
Current behavior
The
baseUrl
can be retrieved from the dev server's config (see #21555, #21629). However, this logic is only allowed if there is no config file (see https://github.com/cypress-io/cypress/blob/develop/npm/cypress-schematic/src/builders/cypress/index.ts#L89).Desired behavior
I run my Angular tests on a server with many concurrent builds running at a time. Angular supports picking a random, unused port for the dev server when specifying
--port 0
or using the same inangular.json
. This does get passed through to the builder'sdevServerBaseUrl
correctly.Our tests also employ a custom logger and custom browser selection, which requires that we use a config file to do proper detection on each system. The presence of the custom config eliminates the possibility of automatically setting
baseUrl
fromdevServerBaseUrl
. Also, there's nothing we can get in the custom config that exposes information about the dev server's configuration, so we can't add a line into that config to make this work.Test code to reproduce
Set up an Angular build without
baseUrl
specified then addconfigFile
to the options inangular.json
.Cypress Version
13.12.0
Node version
20.14.0
Operating System
Various Linux systems (distro-independent)
Debug Logs
No response
Other
I do not know why this code has the
if
condition around it that checks for the presence ofconfigFile
instead of possibly checking forbaseUrl
.I would propose the following, or some variant:
Alternately, exposing
userOptions
would allow the end user to do this for themselves.The text was updated successfully, but these errors were encountered: