msw-dev-tool 1.1.15 → 1.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -48
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,72 +1,39 @@
|
|
1
1
|
# Install
|
2
2
|
|
3
3
|
- npm:
|
4
|
+
|
4
5
|
```bash
|
5
6
|
npm i msw-dev-tool --save-dev
|
6
7
|
```
|
7
8
|
|
8
9
|
- yarn:
|
10
|
+
|
9
11
|
```bash
|
10
12
|
yarn add msw-dev-tool --dev
|
11
13
|
```
|
12
14
|
|
13
15
|
- pnpm:
|
16
|
+
|
14
17
|
```bash
|
15
18
|
pnpm add msw-dev-tool --save-dev
|
16
19
|
```
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
These dependencies are assumed to already exist in your project.
|
21
|
-
If not, please install it.
|
22
|
-
|
23
|
-
```json
|
24
|
-
"react": "^18.0.0",
|
25
|
-
"react-dom": "^18.0.0",
|
26
|
-
"zustand": "^5.0.2",
|
27
|
-
"msw": "^2.7.0"
|
28
|
-
```
|
29
|
-
- [install msw](https://mswjs.io/docs/getting-started)
|
30
|
-
- [install zustand](https://zustand.docs.pmnd.rs/getting-started/introduction#installation)
|
31
|
-
|
32
|
-
# Usage
|
33
|
-
> Please look forward to the official document. I will tell you how to use it in more detail.
|
21
|
+
# How to use?
|
34
22
|
|
35
|
-
|
23
|
+
view [docs](https://msw-dev-tool-docs.vercel.app/docs/get-started)
|
36
24
|
|
37
|
-
|
38
|
-
import { MSWDevTool } from "msw-dev-tool";
|
39
|
-
import "msw-dev-tool/msw-dev-tool.css"
|
25
|
+
# What features?
|
40
26
|
|
41
|
-
|
42
|
-
|
43
|
-
return (
|
44
|
-
<>
|
45
|
-
<MSWDevTool />
|
46
|
-
{/* ... */}
|
47
|
-
</>
|
48
|
-
);
|
49
|
-
}
|
50
|
-
```
|
51
|
-
|
52
|
-
## Integration with msw
|
53
|
-
|
54
|
-
```typescript
|
55
|
-
import { setupWorker } from "msw/browser";
|
56
|
-
import { handlers } from "./handlers";
|
57
|
-
import { setupDevToolWorker } from "msw-dev-tool";
|
58
|
-
|
59
|
-
// use setupDevToolWorker instead of setupWorker from msw.
|
60
|
-
export const worker = setupDevToolWorker(...handlers);
|
61
|
-
|
62
|
-
```
|
27
|
+
## Handler Table
|
63
28
|
|
29
|
+
**view [docs](https://msw-dev-tool-docs.vercel.app/docs/handler-table)**
|
30
|
+
The handler table is a table that shows all the handlers in the project and control them.
|
64
31
|
|
65
|
-
|
32
|
+
## Debugger
|
66
33
|
|
67
|
-
|
34
|
+
**view [docs](https://msw-dev-tool-docs.vercel.app/docs/debugger)**
|
35
|
+
The Debugger allows you to test your mock handlers interactively:
|
68
36
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
| **msw-dev-tool** | The source code of the library. |
|
37
|
+
1. Open the Debugger by clicking any row in the Handler Table
|
38
|
+
2. Enter the request parameters in the input fields
|
39
|
+
3. Send a test request to see the mocked response
|