I have a React app which I am testing with Testcafe (with gherkin-testcafe). I am using MSW to mock API responses which works great. However the issue is when running testcafe tests against my local version running with MSW I get the following message.
MSW Cannot intercept requests on this page because it's outside of the worker's scope ("http://localhost:1337"). If you wish to mock API requests on this page, you must resolve this scope issue.
- (Recommended) Register the worker at the root level ("/") of your application.
- Set the "Service-Worker-Allowed" response header to allow out-of-scope workers.
As far as I can tell MSW defaults to using scope "/" if you don't set one anyway and I have tried setting it explicitly and seemed to make no difference. I have also tried setting the header but I don't really know what I meant to set it to. I tried "/"
Does anyone know how I can this to work?