cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.77k stars 3.17k forks source link

"Cannot set property 'err' of undefined" error occurs in place of other errors during automatic test-reruns on file save (4.12.1). #8189

Closed threehams closed 4 years ago

threehams commented 4 years ago

Current behavior: This is a reopen of https://github.com/cypress-io/cypress/issues/7874, since the issue is not fixed after upgrading to 4.12.1. The behavior is the same, but the test code branch is different and this can be reproduced at least 50% of the time.

When running tests locally through cypress open by saving files (forcing a re-run), any failures occurred during the run can trigger this message:

The following error originated from your application code, not from Cypress.

  > Cannot set property 'err' of undefined

When Cypress detects uncaught errors originating from your application it will automatically fail the current test.

This behavior is configurable, and you can choose to turn this off by listening to the uncaught:exception event. Learn more

Desired behavior: The test fails with the normal readable stack trace.

Test code to reproduce https://github.com/primitiveconcept/ludumdare46/tree/cypress/err-of-undefined-4-12-1/client

Run npm run cy:dev for server + Cypress Run the infostealer.spec.ts spec Save the infostealer.spec.ts while the test is running. Note that 50% of the time, this error occurs, and 50% of the time, the test is cut short and passes when it should fail. This may or may not be caused by a separate issue.

Versions Cypress versions: Can reproduce on 4.12.1. Cannot reproduce on 4.5.0. Other versions are unstable for various reasons on the example project. OS: MacOS + Windows Browser: Chrome + Electron

todd-m-kemp commented 4 years ago

I too have continued to experience this problem in version 4.12.1 even though it was supposed to have been fixed in this version.

kuceb commented 4 years ago

thanks for letting us know, I'm looking into this (again)

cypress-bot[bot] commented 4 years ago

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

thaianalps commented 4 years ago

I too have continued to experience this problem in version 4.12.1 even though it was supposed to have been fixed in this version.

me too

jennifer-shehane commented 4 years ago

This will be fixed in our next release.

cypress-bot[bot] commented 4 years ago

Released in 5.0.0.

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