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

Properties in the cypress.run result type show up as TS errors #8580

Closed
bahmutov opened this issue Sep 15, 2020 · 3 comments · Fixed by #8604
Closed

Properties in the cypress.run result type show up as TS errors #8580

bahmutov opened this issue Sep 15, 2020 · 3 comments · Fixed by #8604

Comments

@bahmutov
Copy link
Contributor

bahmutov commented Sep 15, 2020

Current behavior:

New project with Cypress v5.2.0 (same for v5.1.0) uses cypress.run to execute tests, then looks at the resolved object

cypress.run(options)
.then((runResults) => {
  // see https://on.cypress.io/module-api
  if (runResults.failures) {
    console.error(runResults.message)
    process.exit(1)
  }
  ...
})

VSCode shows red squiggles all over

Desired behavior:

The resolved object has type from https://github.com/cypress-io/cypress/tree/develop/cli/types cypress-npm-api.d.ts

interface CypressFailedRunResult {
  failures: number
  message: string
}

run(): Promise<CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult>

So I expect checking for properties from one or the other types to work

Test code to reproduce

Repo https://github.com/bahmutov/cypress-expect
Clone
Install dependencies with npm i
Open the index.js in VSCode

Versions

Mac, Cypress v5.2.0

@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Sep 15, 2020
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope stage: work in progress labels Sep 17, 2020
@alvipeo
Copy link

alvipeo commented Sep 18, 2020

Just hit this myself!

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Sep 18, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 18, 2020

The code for this is done in cypress-io/cypress#8604, 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 Sep 29, 2020

Released in 5.3.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Sep 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants