cypress-io / cypress

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

parent.location gets compiled to self.location causing a runtime error #29684

Open brunolemos opened 3 weeks ago

brunolemos commented 3 weeks ago

Current behavior

parent.location gets compiled to self.location causing a runtime error. see screenhsts:

Original code Code running on Cypress
image image

Desired behavior

I suppose cypress is renaming this to fix some internal behavior, but it should be smarter on when to do this to not affect user code. In this case, e is an internal parameter that is not related to window or anything like that, so it should stay as is.

Test code to reproduce

var e = { parent: { location: 'hi' } };
console.log(e.parent.location);

Uncaught TypeError: Cannot read properties of undefined (reading 'location')

image

Cypress Version

13.8.1

Node version

v20.13.0

Operating System

macOS 14.5

Debug Logs

No response

Other

No response

jennifer-shehane commented 2 weeks ago

@brunolemos Can you try setting modifyObstructiveCode to false to see if this resolves the issue?