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 bug with cypress testIsolation option #257

Merged
merged 2 commits into from
Sep 13, 2023

Conversation

JamyGolden
Copy link
Contributor

@JamyGolden JamyGolden commented Jul 13, 2023

What:

This fixes a bug where this.get('prev') returns undefined in some scenarios and the command this.get('prev').get('chainerId') throws an error since it's attempting to read get of undefined.

Why:

There is more information about this issue here: #248, but several people have commented that they are experiencing this. @matt-vendia responded with a solution on that issue, which solves the problem for me too (along with others who thumbs-upped the comment).

How:

Make sure this.get('prev') exists before assuming it's an object.

Checklist:

  • Documentation (n/a)
  • Tests (n/a)
  • Ready to be merged

This change is safe and small enough that it is ready to be merged imo.

Copy link

@leonardobumbeers leonardobumbeers left a comment

Choose a reason for hiding this comment

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

LGTM! I've faced the same issue when upgrading to version v9.0.0 and still occurs on version v10.0.0
@kentcdodds Could we include this PR in the next release?

@@ -37,7 +37,7 @@ function createQuery(queryName, implementationName) {
Cypress.log({
name: queryName,
type:
this.get('prev').get('chainerId') === this.get('chainerId')
this.get('prev')?.get('chainerId') === this.get('chainerId')
Copy link
Member

Choose a reason for hiding this comment

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

I believe this does the same thing and is more terse :)

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Thanks!

@kentcdodds kentcdodds merged commit 063a2ff into testing-library:main Sep 13, 2023
3 checks passed
@github-actions
Copy link

🎉 This PR is included in version 10.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@leonardobumbeers
Copy link

Thanks!

Thank you so much!

This was referenced Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants