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

Cypress.config('baseUrl', 'someUrl.com') after v10 upgrade #22374

Closed
jasoncarty opened this issue Jun 17, 2022 · 4 comments · Fixed by #22445
Closed

Cypress.config('baseUrl', 'someUrl.com') after v10 upgrade #22374

jasoncarty opened this issue Jun 17, 2022 · 4 comments · Fixed by #22445
Labels
cli type: typings Issue related to Cypress types (for TypeScript)

Comments

@jasoncarty
Copy link

Current behavior

After upgrading to Cypress version 10.1.0 the following is resulting in a Typescript linting error:

Cypress.config('baseUrl', 'http://localhost:1234')
// Argument of type '"baseUrl"' is not assignable to parameter of type 'keyof TestConfigOverrides'.ts(2345)

Desired behavior

This error is not shown

Test code to reproduce

Cypress.config('baseUrl', 'http://localhost:1234')
// Argument of type '"baseUrl"' is not assignable to parameter of type 'keyof TestConfigOverrides'.ts(2345)

Cypress Version

10.1.0

Other

No response

@devhid
Copy link

devhid commented Jun 17, 2022

Also running into the same issue.

@rmanai
Copy link

rmanai commented Jun 21, 2022

I have the same error and t tried to create an extended config file to define specific baseurl but not working (cypress v10.1.0)

please any solution ?

@lmiller1990 lmiller1990 added the type: typings Issue related to Cypress types (for TypeScript) label Jun 22, 2022
@lmiller1990
Copy link
Contributor

Related (and possibly dup): #22072

As noted. since 10.0 baseUrl is now nested inside of e2e:

image

Which is why the types are complaining. As noted (#22072 (comment)), we should support this, but only for e2e testing - not component. We don't know the testingType in the spec, though, so I think we will just need to make the type allowed, and have a runtime error if you try to set baseUrl when using component testing.

I tested it out and Cypress.config('baseUrl', 'http://...') does work - it's just a typing error. I had a look and I think it's because we do Omit on baseUrl here: https://github.com/cypress-io/cypress/blob/develop/cli/types/cypress.d.ts#L3054. I am thinking it's not as simple as just removing that, since we don't want baseUrl to be valid inside of cypess.config.js > component property. I think we want a new interface that is specifically for the Cypress.config(...) type.

We will look to fix this one soon - in the meantime, I hate to say it but ts-ignore is the only alternative until this fix lands.

@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: fire watch and removed stage: needs review The PR code is done & tested, needs review stage: routed to e2e-core labels Jun 22, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 28, 2022

Released in 10.3.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v10.3.0, please open a new issue.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Jun 28, 2022
@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jun 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cli type: typings Issue related to Cypress types (for TypeScript)
Projects
None yet
4 participants