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

Add optional properties returned from Cypress NPM module API on failure #5335

Closed
bahmutov opened this issue Oct 10, 2019 · 2 comments · Fixed by #5337
Closed

Add optional properties returned from Cypress NPM module API on failure #5335

bahmutov opened this issue Oct 10, 2019 · 2 comments · Fixed by #5337

Comments

@bahmutov
Copy link
Contributor

If Cypress NPM module fails to find any specs it resolves with an object that is not typed right now

// https://on.cypress.io/module-api
const cypress = require('cypress')
const results = await cypress.run()
// seems Cypress TS definition does not have "failures" and "message" properties
// @ts-ignore
if (results.failures) {
  // Cypress failed without even running the tests
  console.error('Problem running Cypress')
  // @ts-ignore
  console.error(results.message)
  // @ts-ignore
  process.exit(results.failures)
}

// results.totalFailed gives total number of failed tests
if (results.totalFailed) {
  process.exit(results.totalFailed)
}
@bahmutov bahmutov self-assigned this Oct 10, 2019
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Oct 10, 2019
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Oct 22, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 22, 2019

The code for this is done in cypress-io/cypress#5337, 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 Oct 23, 2019

Released in 3.5.0.

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.

1 participant