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-cli type for CypressRunResult::runs is incorrect (can be null/undefined) #6126

Open
xdumaine opened this issue Jan 8, 2020 · 1 comment

Comments

@xdumaine
Copy link

@xdumaine xdumaine commented Jan 8, 2020

Current behavior:

In the event that the browser fails to connect, the run promise resolves with results which has runs of null or undefined. (Which is likely a separate issue altogether. It should probably not resolve at all - it should reject).

However, the typings indicate that the type of runs is RunResult[] which doesn't match null

Desired behavior:

The type should indicate that runs can be undefined or null, or run() should not resolve on an error running the tests altogether.

Test code to reproduce

  1. Clone https://github.com/xdumaine/cypress-test-tiny
  2. npm i && npm test
@ddayguerrero

This comment has been minimized.

Copy link

@ddayguerrero ddayguerrero commented Jan 20, 2020

👋 Hey! While there might be work in progress, I'd be interested in helping and ultimately achieving a first time contribution for Cypress.

Following the instructions within the cypress-test-tiny fork, I've been able to reproduce the error with the following environment:

Cypress:    3.8.1
Browser:    Chrome 79

As previously mentioned and from my understanding, there are currently a couple of ways of solving this:

  1. Playing around with the CypressRunResult type interface to support null or undefined special types.
  2. Handling the rejected state upon invoking the promise.

Option 2 sounds like the long term solution. I think changes will be around the lines of https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/plugins/util.coffee#L37 however it seems like we would need to distinguish before:browser:launch and task events.

Can I help with with 2, with the short term solution 1, or with any other suggested solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.