mockaton 9.3.0 → 9.4.1
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 +20 -16
- package/lcov.info +753 -731
- package/package.json +1 -4
- package/src/Dashboard.css +63 -16
- package/src/Dashboard.js +52 -9
package/README.md
CHANGED
|
@@ -15,22 +15,25 @@ An HTTP mock server for simulating APIs with minimal setup
|
|
|
15
15
|
## Motivation
|
|
16
16
|
|
|
17
17
|
**No API state should be too hard to test.**
|
|
18
|
-
With Mockaton, developers can achieve correctness
|
|
18
|
+
With Mockaton, developers can achieve correctness and increase speed.
|
|
19
19
|
|
|
20
20
|
### Correctness
|
|
21
|
-
- Enables testing of complex scenarios that would otherwise be
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- Allows for deterministic, comprehensive, and consistent state
|
|
25
|
-
|
|
26
|
-
tests, e.g., with [pixaton](https://github.com/ericfortis/pixaton).
|
|
21
|
+
- Enables testing of complex scenarios that would otherwise be skipped. e.g.,
|
|
22
|
+
- Triggering errors on third-party APIs.
|
|
23
|
+
- Triggering errors on your project’s backend (if you are a frontend developer).
|
|
24
|
+
- Allows for deterministic, comprehensive, and consistent state.
|
|
25
|
+
- Spot inadvertent regressions during development.
|
|
26
|
+
- Use it to set up screenshot tests, e.g., with [pixaton](https://github.com/ericfortis/pixaton).
|
|
27
27
|
|
|
28
28
|
### Speed
|
|
29
|
-
- Prevents progress from being blocked by waiting for APIs.
|
|
30
29
|
- Works around unstable dev backends while developing UIs.
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
- Spinning up development infrastructure.
|
|
31
|
+
- Syncing database states.
|
|
32
|
+
- Prevents progress from being blocked by waiting for APIs.
|
|
33
|
+
- Time travel. If you commit the mocks to your repo,
|
|
34
|
+
you don’t have to downgrade backends for:
|
|
35
|
+
- checking out long-lived branches
|
|
36
|
+
- bisecting bugs
|
|
34
37
|
|
|
35
38
|
<br/>
|
|
36
39
|
|
|
@@ -125,6 +128,7 @@ They will be saved in your `config.mocksDir` following the filename convention.
|
|
|
125
128
|
- Does not hijack your HTTP client.
|
|
126
129
|
- Auditable. Organized and small — under 4 KLoC (half is UI and tests).
|
|
127
130
|
|
|
131
|
+
<br/>
|
|
128
132
|
|
|
129
133
|
## Basic Usage
|
|
130
134
|
1. Install Node.js, which comes with `npm` and `npx`
|
|
@@ -141,18 +145,18 @@ npx mockaton --port 2345
|
|
|
141
145
|
|
|
142
146
|
4. Test it
|
|
143
147
|
```shell
|
|
144
|
-
curl
|
|
148
|
+
curl localhost:2345/api/foo
|
|
145
149
|
```
|
|
146
150
|
|
|
147
151
|
### Alternative Installations
|
|
148
152
|
<details>
|
|
149
|
-
<summary>With NPM…</summary>
|
|
153
|
+
<summary>With NPM (package.json)…</summary>
|
|
150
154
|
|
|
151
155
|
```shell
|
|
152
156
|
npm install mockaton --save-dev
|
|
153
157
|
```
|
|
154
158
|
|
|
155
|
-
Then
|
|
159
|
+
Then, add the script to your `package.json`:
|
|
156
160
|
```json
|
|
157
161
|
{
|
|
158
162
|
"scripts": {
|
|
@@ -248,7 +252,7 @@ export default defineConfig({
|
|
|
248
252
|
```
|
|
249
253
|
|
|
250
254
|
<details>
|
|
251
|
-
<summary><b>
|
|
255
|
+
<summary><b>Config Documentation</b></summary>
|
|
252
256
|
|
|
253
257
|
### `mocksDir?: string`
|
|
254
258
|
Defaults to `'mockaton-mocks'`.
|
|
@@ -502,7 +506,7 @@ const server = Mockaton({
|
|
|
502
506
|
...mockatonConfig, // Not required, but it’s not read by default.
|
|
503
507
|
})
|
|
504
508
|
```
|
|
505
|
-
See [src/cli.js](src/cli.js)
|
|
509
|
+
See [src/cli.js](src/cli.js) or [src/Mockaton.test.js](src/Mockaton.test.js) for more examples.
|
|
506
510
|
|
|
507
511
|
</details>
|
|
508
512
|
|