nock 13.3.0 → 13.3.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 +15 -3
- package/lib/socket.js +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1539,9 +1539,9 @@ import test from 'ava' // You can use any test framework.
|
|
|
1539
1539
|
// can't be intercepted by nock. So, configure axios to use the node adapter.
|
|
1540
1540
|
//
|
|
1541
1541
|
// References:
|
|
1542
|
-
// https://github.com/
|
|
1543
|
-
|
|
1544
|
-
axios.defaults.adapter =
|
|
1542
|
+
// https://github.com/axios/axios/pull/5277
|
|
1543
|
+
|
|
1544
|
+
axios.defaults.adapter = 'http'
|
|
1545
1545
|
|
|
1546
1546
|
test('can fetch test response', async t => {
|
|
1547
1547
|
// Set up the mock request.
|
|
@@ -1559,6 +1559,18 @@ test('can fetch test response', async t => {
|
|
|
1559
1559
|
})
|
|
1560
1560
|
```
|
|
1561
1561
|
|
|
1562
|
+
For Nock + Axios + Jest to work, you'll have to also adapt your jest.config.js, like so:
|
|
1563
|
+
|
|
1564
|
+
```js
|
|
1565
|
+
const config = {
|
|
1566
|
+
moduleNameMapper: {
|
|
1567
|
+
// Force CommonJS build for http adapter to be available.
|
|
1568
|
+
// via https://github.com/axios/axios/issues/5101#issuecomment-1276572468
|
|
1569
|
+
'^axios$': require.resolve('axios'),
|
|
1570
|
+
},
|
|
1571
|
+
}
|
|
1572
|
+
```
|
|
1573
|
+
|
|
1562
1574
|
[axios]: https://github.com/axios/axios
|
|
1563
1575
|
|
|
1564
1576
|
### Memory issues with Jest
|
package/lib/socket.js
CHANGED
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"testing",
|
|
8
8
|
"isolation"
|
|
9
9
|
],
|
|
10
|
-
"version": "13.3.
|
|
10
|
+
"version": "13.3.1",
|
|
11
11
|
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"propagate": "^2.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@definitelytyped/dtslint": "^0.0.
|
|
31
|
+
"@definitelytyped/dtslint": "^0.0.159",
|
|
32
32
|
"@sinonjs/fake-timers": "^10.0.0",
|
|
33
33
|
"assert-rejects": "^1.0.0",
|
|
34
34
|
"chai": "^4.1.2",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"lint": "run-p lint:js lint:ts",
|
|
60
60
|
"lint:js": "eslint --cache --cache-location './.cache/eslint' '**/*.js'",
|
|
61
61
|
"lint:js:fix": "eslint --cache --cache-location './.cache/eslint' --fix '**/*.js'",
|
|
62
|
-
"lint:ts": "dtslint types",
|
|
62
|
+
"lint:ts": "dtslint --expectOnly types",
|
|
63
63
|
"test": "nyc --reporter=lcov --reporter=text mocha tests",
|
|
64
64
|
"test:coverage": "open coverage/lcov-report/index.html"
|
|
65
65
|
},
|