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

fix: don't reassign the error name if it already exists #18259

Merged
merged 4 commits into from Sep 30, 2021

Conversation

wKich
Copy link
Contributor

@wKich wKich commented Sep 27, 2021

User facing changelog

Don't reassign the error name if it already exists

Additional details

Throwing custom errors from the tests, those defined like this:

MyCustomError extends Error {
  get name() { return 'MyCustomError' }
}

leads to failing Cypress with the error TypeError: Cannot set property name of [object Object] which has only a getter
Affected Cypress versions >= 8.3.0

How has the user experience changed?

PR Tasks

  • Have tests been added/updated?
  • Has the original issue or this PR been tagged with a release in ZenHub?
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@wKich wKich requested a review from a team as a code owner September 27, 2021 09:25
@wKich wKich requested review from chrisbreiding and jennifer-shehane and removed request for a team September 27, 2021 09:25
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 27, 2021

Thanks for taking the time to open a PR!

@CLAassistant
Copy link

CLAassistant commented Sep 27, 2021

CLA assistant check
All committers have signed the CLA.

@wKich wKich changed the title don't reassing the error name if it already exists fix: don't reassing the error name if it already exists Sep 27, 2021
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wKich Thanks! Can you add a test around this new behavior?

There is a Contributing Guide that covers how to contribute and get Cypress running locally in generally here: https://github.com/cypress-io/cypress/blob/develop/.github/CONTRIBUTING.md

Instructions for running the driver tests can always be found here: https://github.com/cypress-io/cypress/blob/develop/packages/driver/README.md

@wKich
Copy link
Contributor Author

wKich commented Sep 28, 2021

@jennifer-shehane done

@chrisbreiding chrisbreiding changed the title fix: don't reassing the error name if it already exists fix: don't reassign the error name if it already exists Sep 30, 2021
Copy link
Contributor

@chrisbreiding chrisbreiding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍 Thanks for the PR!

@chrisbreiding chrisbreiding merged commit cb5eeec into cypress-io:develop Sep 30, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 11, 2021

Released in 8.6.0.

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

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

Successfully merging this pull request may close these issues.

None yet

4 participants