nock 14.0.4 → 14.0.6
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 +11 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -88,6 +88,7 @@ For instance, if a module performs HTTP requests to a CouchDB server or makes HT
|
|
|
88
88
|
- [Verifying recorded fixtures](#verifying-recorded-fixtures)
|
|
89
89
|
- [Example](#example-1)
|
|
90
90
|
- [Common issues](#common-issues)
|
|
91
|
+
- [Requests made by ES Modules are not intercepted](#requests-made-by-es-modules-are-not-intercepted)
|
|
91
92
|
- [Axios](#axios)
|
|
92
93
|
- [Memory issues with Jest](#memory-issues-with-jest)
|
|
93
94
|
- [Debugging](#debugging)
|
|
@@ -1308,6 +1309,8 @@ Examples:
|
|
|
1308
1309
|
nock.removeInterceptor({
|
|
1309
1310
|
hostname: 'localhost',
|
|
1310
1311
|
path: '/mockedResource',
|
|
1312
|
+
// method defaults to `GET`
|
|
1313
|
+
// proto defaullts to `http`
|
|
1311
1314
|
})
|
|
1312
1315
|
```
|
|
1313
1316
|
|
|
@@ -1547,6 +1550,14 @@ This is how it's handled in Nock itself (see [#1523][]).
|
|
|
1547
1550
|
[got]: https://github.com/sindresorhus/got
|
|
1548
1551
|
[#1523]: https://github.com/nock/nock/issues/1523
|
|
1549
1552
|
|
|
1553
|
+
### Requests made by ES Modules are not intercepted
|
|
1554
|
+
|
|
1555
|
+
When an ES module imports `request` with a namespaced import like `import * as
|
|
1556
|
+
http from "node:http"`, and the module is imported before `nock`, requests made
|
|
1557
|
+
by this module are not intercepted. You can fix this by telling Node to preload
|
|
1558
|
+
`nock` using the `--import=nock` [CLI option](https://nodejs.org/api/cli.html#--importmodule)
|
|
1559
|
+
or setting the `NODE_OPTIONS=--import=nock` environment variable.
|
|
1560
|
+
|
|
1550
1561
|
### Axios
|
|
1551
1562
|
|
|
1552
1563
|
To use Nock with [Axios][], you may need to configure Axios to use the Node
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"testing",
|
|
8
8
|
"isolation"
|
|
9
9
|
],
|
|
10
|
-
"version": "14.0.
|
|
10
|
+
"version": "14.0.6",
|
|
11
11
|
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"main": "./index.js",
|
|
23
23
|
"types": "types",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@mswjs/interceptors": "^0.
|
|
25
|
+
"@mswjs/interceptors": "^0.39.3",
|
|
26
26
|
"json-stringify-safe": "^5.0.1",
|
|
27
27
|
"propagate": "^2.0.0"
|
|
28
28
|
},
|