mockaton 8.21.0 → 8.21.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.
Files changed (2) hide show
  1. package/README.md +15 -12
  2. package/package.json +6 -7
package/README.md CHANGED
@@ -25,7 +25,7 @@ With Mockaton, developers can achieve correctness without sacrificing speed.
25
25
 
26
26
  ### Speed
27
27
  - Prevents progress from being blocked by waiting for APIs.
28
- - Avoids spinning up and updating hefty backends when developing UIs.
28
+ - Works around unstable dev backends while developing UIs.
29
29
  - Time travel. If you commit the mocks to your repo, it’s straightforward
30
30
  to check out long-lived branches and bisect bugs, so you don’t
31
31
  have to downgrade backends to old API contracts or databases.
@@ -65,7 +65,8 @@ for setting up tests (see **Commander API** section below).
65
65
  <br/>
66
66
 
67
67
  ## Multiple Mock Variants
68
- Each route can have different mocks. There are two options for doing that:
68
+ Each route can have different mocks. There are two
69
+ options for doing that, and they can be combined.
69
70
 
70
71
  ### Adding comments to the filename
71
72
  Comments are anything within parentheses, including them.
@@ -80,9 +81,9 @@ For instance, you can use a `4xx` or `5xx` status code for triggering error
80
81
  responses, or a `2xx` such as `204` for testing empty collections.
81
82
 
82
83
  <pre>
83
- api/videos(empty list).GET.<b>204</b>.json # No Content
84
- api/videos.GET.<b>403</b>.json # Forbidden
85
- api/videos.GET.<b>500</b>.txt # Internal Server Error
84
+ api/videos.GET.<b>204</b>.empty # No Content
85
+ api/videos.GET.<b>403</b>.json # Forbidden
86
+ api/videos.GET.<b>500</b>.txt # Internal Server Error
86
87
  </pre>
87
88
 
88
89
 
@@ -91,8 +92,8 @@ api/videos.GET.<b>500</b>.txt # Internal Server Error
91
92
  ## Scraping Mocks from your Backend
92
93
 
93
94
  ### Option 1: Browser Extension
94
- This companion [browser-devtools extension](https://github.com/ericfortis/download-http-requests-browser-ext)
95
- lets you download all the HTTP responses at once, and they
95
+ With the companion [browser-devtools extension](https://github.com/ericfortis/download-http-requests-browser-ext)
96
+ you can download all the HTTP responses at once, and they
96
97
  get saved following Mockaton’s filename convention.
97
98
 
98
99
  ### Option 2: Fallback to Your Backend
@@ -183,7 +184,7 @@ permutations for out-of-stock, new-arrival, and discontinued.
183
184
  - Spinners by delaying responses
184
185
  - Setting up UI tests
185
186
 
186
- ### Simulating complex backend states
187
+ ### Demoing complex backend states
187
188
  Sometimes, the ideal flow you need is too difficult to reproduce from the actual backend.
188
189
  For this, you can **Bulk Select** mocks by comments to simulate the complete states
189
190
  you want. For example, by adding `(demo-part1)`, `(demo-part2)` to the filenames.
@@ -307,8 +308,10 @@ want a `Content-Type` header in the response.
307
308
  <br/>
308
309
 
309
310
  ### Dynamic parameters
310
- Anything within square brackets is always matched. For example, for this route:
311
- <code>/api/company/<b>1234</b>/user/<b>5678</b></code>
311
+ Anything within square brackets is always matched.
312
+
313
+ For example, for <a href="#">/api/company/<b>123</b>/user/<b>789</b></a>,
314
+ the filename could be:
312
315
 
313
316
  <pre><code>api/company/<b>[id]</b>/user/<b>[uid]</b>.GET.200.json</code></pre>
314
317
 
@@ -351,7 +354,7 @@ string it’s ignored anyway.
351
354
  <br/>
352
355
 
353
356
  ### Index-like routes
354
- If you have `api/foo` and `api/foo/bar`, you have two options:
357
+ If you have <a href="#">api/foo</a> and <a href="#">api/foo/bar</a>, you have two options:
355
358
 
356
359
  **Option A.** Standard naming:
357
360
  ```
@@ -379,7 +382,7 @@ as explained above in the _Use Cases_ section.
379
382
 
380
383
  Files under `config.staticDir` take precedence over corresponding
381
384
  `GET` mocks in `config.mocksDir` (regardless of status code).
382
- For example, if you have two files for `GET /foo/bar.jpg`:
385
+ For example, if you have two files for `GET` <a href="#">/foo/bar.jpg</a> such as:
383
386
  <pre>
384
387
  my-static-dir<b>/foo/bar.jpg</b> <span style="color:green"> // Wins</span>
385
388
  my-mocks-dir<b>/foo/bar.jpg</b>.GET.200.jpg <span style="color:red"> // Unreachable</span>
package/package.json CHANGED
@@ -2,18 +2,17 @@
2
2
  "name": "mockaton",
3
3
  "description": "HTTP Mock Server",
4
4
  "type": "module",
5
- "version": "8.21.0",
5
+ "version": "8.21.1",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
8
8
  "license": "MIT",
9
9
  "repository": "https://github.com/ericfortis/mockaton",
10
10
  "keywords": [
11
11
  "mock-server",
12
+ "rest-api",
12
13
  "mock",
13
14
  "api",
14
- "testing",
15
- "front-end",
16
- "back-end"
15
+ "testing"
17
16
  ],
18
17
  "scripts": {
19
18
  "test": "node --test \"src/**/*.test.js\"",
@@ -22,11 +21,11 @@
22
21
  "pixaton": "node --test --import=./pixaton-tests/_setup.js --experimental-test-isolation=none \"pixaton-tests/**/*.test.js\"",
23
22
  "outdated": "npm outdated --parseable | awk -F: '{ printf \"npm i %-30s ;# %s\\n\", $4, $2 }'"
24
23
  },
25
- "optionalDependencies": {
26
- "open": "^10"
27
- },
28
24
  "devDependencies": {
29
25
  "pixaton": "1.1.2",
30
26
  "puppeteer": "24.18.0"
27
+ },
28
+ "optionalDependencies": {
29
+ "open": "10.2.0"
31
30
  }
32
31
  }