testing-library / cypress-testing-library

🐅 Simple and complete custom Cypress commands and utilities that encourage good testing practices.
http://npm.im/@testing-library/cypress
MIT License
1.8k stars 152 forks source link

Fix bug with cypress `testIsolation` option #257

Closed JamyGolden closed 11 months ago

JamyGolden commented 1 year ago

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: https://github.com/testing-library/cypress-testing-library/issues/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:

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

github-actions[bot] commented 11 months ago

:tada: This PR is included in version 10.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

leonardobumbeers commented 11 months ago

Thanks!

Thank you so much!