nock 13.0.9 → 13.1.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 CHANGED
@@ -3,7 +3,6 @@
3
3
  [![npm](https://img.shields.io/npm/v/nock.svg)][npmjs]
4
4
  [![Build Status](https://travis-ci.org/nock/nock.svg)][build]
5
5
  ![Coverage Status](http://img.shields.io/badge/coverage-100%25-brightgreen.svg)
6
- ![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=nock/nock)
7
6
  [![Backers on Open Collective](https://opencollective.com/nock/backers/badge.svg)](#backers)
8
7
  [![Sponsors on Open Collective](https://opencollective.com/nock/sponsors/badge.svg)](#sponsors)
9
8
 
@@ -640,6 +639,8 @@ const scope = nock('http://my.server.com:8081')
640
639
 
641
640
  You are able to specify the number of times to repeat the same response.
642
641
 
642
+ **NOTE:** When request times is more than the number you specified, you will get an error before cleaning this interceptor.
643
+
643
644
  ```js
644
645
  nock('http://zombo.com').get('/').times(4).reply(200, 'Ok')
645
646
 
@@ -647,7 +648,15 @@ http.get('http://zombo.com/') // respond body "Ok"
647
648
  http.get('http://zombo.com/') // respond body "Ok"
648
649
  http.get('http://zombo.com/') // respond body "Ok"
649
650
  http.get('http://zombo.com/') // respond body "Ok"
650
- http.get('http://zombo.com/') // respond with zombo.com result
651
+
652
+ // This code will get an error with message:
653
+ // Nock: No match for request
654
+ http.get('http://zombo.com/')
655
+
656
+ // clean your interceptor
657
+ nock.cleanAll()
658
+
659
+ http.get('http://zombo.com/') // real respond with zombo.com result
651
660
  ```
652
661
 
653
662
  Sugar syntax
@@ -32,8 +32,9 @@ module.exports = class Interceptor {
32
32
  // When enabled filteringScope ignores the passed URL entirely so we skip validation.
33
33
 
34
34
  if (
35
- !scope.scopeOptions.filteringScope &&
36
35
  uriIsStr &&
36
+ !scope.scopeOptions.filteringScope &&
37
+ !scope.basePathname &&
37
38
  !uri.startsWith('/') &&
38
39
  !uri.startsWith('*')
39
40
  ) {
package/lib/recorder.js CHANGED
@@ -309,8 +309,6 @@ function record(recOptions) {
309
309
 
310
310
  if (callback) {
311
311
  callback(res, options, callback)
312
- } else {
313
- res.resume()
314
312
  }
315
313
 
316
314
  debug('finished setting up intercepting')
package/lib/socket.js CHANGED
@@ -92,6 +92,7 @@ module.exports = class Socket extends EventEmitter {
92
92
  debug('socket destroy')
93
93
  this.destroyed = true
94
94
  this.readable = this.writable = false
95
+ this.readableEnded = this.writableFinished = true
95
96
 
96
97
  process.nextTick(() => {
97
98
  if (err) {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "testing",
8
8
  "isolation"
9
9
  ],
10
- "version": "13.0.9",
10
+ "version": "13.1.1",
11
11
  "author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
12
12
  "repository": {
13
13
  "type": "git",
@@ -28,32 +28,30 @@
28
28
  "propagate": "^2.0.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@sinonjs/fake-timers": "^6.0.0",
31
+ "@sinonjs/fake-timers": "^7.0.2",
32
32
  "assert-rejects": "^1.0.0",
33
33
  "chai": "^4.1.2",
34
34
  "dirty-chai": "^2.0.1",
35
35
  "dtslint": "^4.0.4",
36
36
  "eslint": "^7.3.1",
37
- "eslint-config-prettier": "^6.0.0",
38
- "eslint-config-standard": "^14.0.0",
37
+ "eslint-config-prettier": "^8.1.0",
38
+ "eslint-config-standard": "^16.0.2",
39
39
  "eslint-plugin-import": "^2.16.0",
40
40
  "eslint-plugin-mocha": "^8.0.0",
41
41
  "eslint-plugin-node": "^11.0.0",
42
42
  "eslint-plugin-promise": "^4.1.1",
43
43
  "eslint-plugin-standard": "^5.0.0",
44
- "form-data": "^3.0.0",
44
+ "form-data": "^4.0.0",
45
45
  "got": "^11.3.0",
46
46
  "mocha": "^8.0.1",
47
47
  "npm-run-all": "^4.1.5",
48
48
  "nyc": "^15.0.0",
49
49
  "prettier": "2.2.1",
50
50
  "proxyquire": "^2.1.0",
51
- "request": "^2.83.0",
52
51
  "rimraf": "^3.0.0",
53
52
  "semantic-release": "^17.0.2",
54
- "sinon": "^9.0.0",
53
+ "sinon": "^10.0.0",
55
54
  "sinon-chai": "^3.3.0",
56
- "superagent": "^6.1.0",
57
55
  "typescript": "^4.2.2"
58
56
  },
59
57
  "scripts": {
package/types/index.d.ts CHANGED
@@ -52,7 +52,7 @@ declare namespace nock {
52
52
  | RegExp
53
53
  | DataMatcherArray
54
54
  | DataMatcherMap
55
- interface DataMatcherArray extends Array<DataMatcher> {}
55
+ interface DataMatcherArray extends ReadonlyArray<DataMatcher> {}
56
56
  interface DataMatcherMap {
57
57
  [key: string]: DataMatcher
58
58
  }