Comments (6)
@kettanaito What kind of program do you use for the demo if you want to record it? The react app or the vue app?
I tried to create a simple vue demo using codesandbox, but the service worker could not respond to the data. I think it was the domain name.
If it could be a demo like codesandbox, it would be a great start!
from msw.
@hehehai the problem with sandboxes is that you cannot execute npx
(or any other commands) in its environment. One of the prerequisites for working with MSW is to copy its mockServiceWorker.js
to your public directory. Even when manually copied into a sandbox, I have doubts what you see as "public" is actually the public directory of the served app. We can try, however, I haven't attempted to upload the Service Worker manually, it may work.
I think in terms of shooting a demo you can use the examples/create-react-app
in this repository. I'd probably rework the UI to be more, em, presentable :) But having a sandbox with the example is a nice start, I totally agree. Do you mind trying uploading the mockServiceWorker.js
manually to the public folder of a sandbox?
from msw.
@kettanaito codesandbox react msw example
Have you looked at this example?
I do not know why MSW does not capture and respond to information normally
from msw.
@hehehai, thanks for sharing. I've had a brief look into that and can see that Service Worker failed to register. There are also infinite errors regarding an invalid RegExp, which may be related to the usage of :username
parameter in the path. I've removed the parameter and trying to mock an exact URL. Will update this thread with the result.
from msw.
I'm going to shoot a quick tutorial once the following pre-requisites are done:
from msw.
The pre-requisites for this task are done, and I'm preparing a setup and script for an introductory tutorial. I see no reason for this ticket anymore. Will update the README once the tutorial is public.
from msw.
Related Issues (20)
- Add "http" and "graphql" exports HOT 1
- server.use not used in RN HOT 2
- JSON response with special chars truncated since 2.2.0 HOT 3
- Cannot load the application if the browser doesn't have slash at the end of the URL
- MSW does not intercept requests when the node http(s) library is imported using * as HOT 4
- Mocked stream response with multiple enqueues hangs process HOT 1
- Browser: Cannot read properties of undefined (reading 'url') HOT 4
- Wrong url for mockServiceWorker.js when base config set in Vite 5.x config HOT 2
- Add delay before each request HOT 3
- Mock a request that contains both query and path parameters
- TypeError: confirm is not a function HOT 7
- Failing to intercept an Axios request: Node 20.11 + Vitest 1.3.1 + MSW 2.2.1
- v2.2.2 does not intercept request in browser mode (CORS error) but v1.3.1 does HOT 3
- Infering the `boundary` callback arguments HOT 7
- support custom fetch option HOT 7
- support selecting interceptors HOT 1
- Set-Cookie responses containing commas are not handled correctly HOT 1
- HttpResponse.json() throwing TypeError: Right-hand side of 'instanceof' is not an object. HOT 1
- Request with FormData body makes Jest hang forever HOT 6
- TypeError: Right-hand side of 'instanceof' is not an object HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msw.