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:
[ ] Documentation (n/a)
[ ] Tests (n/a)
[x] Ready to be merged
This change is safe and small enough that it is ready to be merged imo.
What:
This fixes a bug where
this.get('prev')
returns undefined in some scenarios and the commandthis.get('prev').get('chainerId')
throws an error since it's attempting to readget
ofundefined
.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.