nock 13.4.0 → 13.5.0

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 CHANGED
@@ -1066,6 +1066,17 @@ if (!nock.isActive()) {
1066
1066
  }
1067
1067
  ```
1068
1068
 
1069
+ ### .clone()
1070
+
1071
+ You can clone a scope by calling `.clone()` on it:
1072
+
1073
+ ```js
1074
+ const scope = nock('http://example.test')
1075
+
1076
+ const getScope = scope.get('/').reply(200)
1077
+ const postScope = scope.clone().post('/').reply(200)
1078
+ ```
1079
+
1069
1080
  ## Restoring
1070
1081
 
1071
1082
  You can restore the HTTP interceptor to the normal unmocked behaviour by calling:
package/lib/scope.js CHANGED
@@ -286,6 +286,10 @@ class Scope extends EventEmitter {
286
286
  this.date = d || new Date()
287
287
  return this
288
288
  }
289
+
290
+ clone() {
291
+ return new Scope(this.basePath, this.scopeOptions)
292
+ }
289
293
  }
290
294
 
291
295
  function loadDefs(path) {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "testing",
8
8
  "isolation"
9
9
  ],
10
- "version": "13.4.0",
10
+ "version": "13.5.0",
11
11
  "author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
12
12
  "repository": {
13
13
  "type": "git",
@@ -44,7 +44,7 @@
44
44
  "mocha": "^9.1.3",
45
45
  "npm-run-all": "^4.1.5",
46
46
  "nyc": "^15.0.0",
47
- "prettier": "3.0.3",
47
+ "prettier": "3.1.0",
48
48
  "proxyquire": "^2.1.0",
49
49
  "rimraf": "^3.0.0",
50
50
  "semantic-release": "^22.0.5",