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

[sessions] cy.session validate() TypeScript Types not consistent with documentation #24593

Closed
alvaromartmart opened this issue Sep 6, 2021 · 3 comments · Fixed by #24511
Closed
Assignees
Labels
topic: session Issues when using session command topic: typescript type: bug

Comments

@alvaromartmart
Copy link

I'm submitting a...

[x] Bug report
[ ] Content update
[ ] Process update (build, deployment, ... )

Type of bug / changes

The cy.session documentation says:

If the validate function return false, throws an exception, returns a Promise that resolves to false or rejects, or contains any failing Cypress command, the session will be considered invalid, and setup will be re-run.

However, the return type of the validate function is actually false | void, so it is not possible to return a Promise that resolves to false or rejects

cy.session( [user, pwd] => {
    /**/
}, {
    /* Typescript complains about this as the return type of validate is `false | void` */
    validate: () => Promise.reject('Invalid session)
}

I've assumed this is a documentation issue, but I might be wrong. I'd be up to submitting a PR if needed.

@emilyrohrbough emilyrohrbough changed the title cy.session validate() return type not consistent with documentation [sessions] cy.session validate() return type not consistent with documentation May 13, 2022
@emilyrohrbough
Copy link
Member

Looks like there are incorrect Types for validate

@emilyrohrbough emilyrohrbough changed the title [sessions] cy.session validate() return type not consistent with documentation [sessions] cy.session validate() TypeScript Types not consistent with documentation Nov 8, 2022
@emilyrohrbough emilyrohrbough transferred this issue from cypress-io/cypress-documentation Nov 8, 2022
@emilyrohrbough emilyrohrbough self-assigned this Nov 8, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Nov 10, 2022

The code for this is done in cypress-io/cypress#24511, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Nov 15, 2022

Released in 11.1.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Nov 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: session Issues when using session command topic: typescript type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants