Slow requests for non-mocked resources
See original GitHub issueDescribe the bug
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?
Environment
msw: 0.0.0
nodejs: 0.0.0
npm: 0.0.0
Please also provide your browser version.
To Reproduce
Steps to reproduce the behavior:
- Go to ‘…’
- Click on ‘…’
- Scroll down to ‘…’
- See error
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Python requests is slow and takes very long to complete HTTP ...
First, try logging · If you only need to check if the server is up, try a HEAD or streaming request · For...
Read more >Laravel's safety mechanisms - PlanetScale
A comprehensive overview of Laravel's many safety features that can help you prevent painful mistakes.
Read more >Automating safe, hands-off deployments - Amazon AWS
Pipeline sources. Pipelines at Amazon automatically validate and safely deploy any type of source change to production, not only changes to application code....
Read more >Best practices for Web application maintenance
We make sure that our tests do not depend on a non mocked API that could slow down their execution. During the E2E...
Read more >You are mocking it wrong. - DEV Community
It is slower, it allocates more, and it's wrong. ... so treat each test as a 'request' and let the DI container to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
@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.