cypress-io / cypress

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

cy.intercept does not work for vite 5 #29891

Open Ofenlord opened 2 months ago

Ofenlord commented 2 months ago

Current behavior

Requests cannot be intercepted if you use vite v5 and have to set the following property for the dev server due to the workaround for the public folder: devServerPublicPathRoute: ''. This happens for component tests. It doesn't matter if the fetch request uses relative or absolute url's. image image

Desired behavior

Cypress should intercept the request like before with vite v4. If you do not set devServerPublicPathRoute, the interception of requests will work. So it must be related to this. However, for me it is not an option to omit this property, because in our software I need some relative paths to the public folder used within shadow roots.

Test code to reproduce

modules:

Cypress Version

13.13.1

Node version

v22.2.0

Operating System

Windows 11

Debug Logs

No response

Other

No response

gweesin commented 1 month ago

could you create a minimal production to reproduce it? I've tried to reproduce but it works normally