In our app, we use segment.io for analytics, and in some cases it will take 30 seconds to load the analytics code during a mocked request from msw in Cypress.
any ideas on how to stop this from happening? or just tell msw to not touch any requests it doesn't mock?
msw: 0.0.0nodejs: 0.0.0npm: 0.0.0Please also provide your browser version.
Steps to reproduce the behavior:
A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
Hey. Please could you provide an example repo? Chances are the setup of MSW an Cypress you have may be inefficient. We are working on a better integration, and seeing your reproduction repo would be a tremendous help.
Is this related to #405?
@kettanaito I tried reproducing the issue I'm seeing in our production app. #405 definitely looks related.
I spent time building out an example, so if you want to see how I would go about testing an app with msw, cypress and next.js take a look here: https://github.com/lifeiscontent/msw-next (again, I can't seem to reproduce the issue in this code)
@lifeiscontent, I wanted to mention that I'm seeing this when I attempt to test an Express application with Jest.
When I run the server normally, both mocked and non-mocked requests are quick. However, something about running them in Jest seems to cause them to go incredibly slow or even timeout. I will put together a basic repo to recreate this, but I wanted to go ahead and mention that I'm seeing this outside of Cypress.
@hwstovall Thanks for the heads up! Would love to see a reproduction. The app I experienced this issue on is massive so I didn't know which part of the stack it was coming from. (We're also using express) so if you can create that reproduction that would be a great step forward to getting this fixed!
@hwstovall Oh, and for the record I was seeing slowdowns from massive (multiple megabytes of JS) during development. It could be something to do with loading large files.
I just wanted to follow-up on this and say that I was able to isolate the issue down to Axios running under Jest. I updated my code to use node-fetch and it works as intended. I feel like this is more related to other Axios-specific issues that have already been discussed, so I think it's safe to consider this unrelated to the original issue.
I just wanted to follow-up on this and say that I was able to isolate the issue down to Axios running under Jest. I updated my code to use node-fetch and it works as intended. I feel like this is more related to other Axios-specific issues that have already been discussed, so I think it's safe to consider this unrelated to the original issue.
@hwstovall @lifeiscontent @kettanaito Any update on this issue? If it is related to other Axios-specific issues, can this issue be closed?
Thanks! :pray: :smiling_face_with_three_hearts:
Most helpful comment
@lifeiscontent, I wanted to mention that I'm seeing this when I attempt to test an Express application with Jest.
When I run the server normally, both mocked and non-mocked requests are quick. However, something about running them in Jest seems to cause them to go incredibly slow or even timeout. I will put together a basic repo to recreate this, but I wanted to go ahead and mention that I'm seeing this outside of Cypress.