Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
mikicho committed Jun 21, 2023
2 parents 0b53563 + 8a38f41 commit 680a44e
Show file tree
Hide file tree
Showing 10 changed files with 4,780 additions and 2,264 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup Node.js
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
Expand Down Expand Up @@ -85,6 +85,7 @@ jobs:
- 12
- 14
- 16
- 18
os:
- macos-latest
- ubuntu-latest
Expand Down
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1539,9 +1539,9 @@ import test from 'ava' // You can use any test framework.
// can't be intercepted by nock. So, configure axios to use the node adapter.
//
// References:
// https://github.com/nock/nock/issues/699#issuecomment-272708264
// https://github.com/axios/axios/issues/305
axios.defaults.adapter = require('axios/lib/adapters/http')
// https://github.com/axios/axios/pull/5277

axios.defaults.adapter = 'http'

test('can fetch test response', async t => {
// Set up the mock request.
Expand All @@ -1559,6 +1559,18 @@ test('can fetch test response', async t => {
})
```

For Nock + Axios + Jest to work, you'll have to also adapt your jest.config.js, like so:

```js
const config = {
moduleNameMapper: {
// Force CommonJS build for http adapter to be available.
// via https://github.com/axios/axios/issues/5101#issuecomment-1276572468
'^axios$': require.resolve('axios'),
},
}
```

[axios]: https://github.com/axios/axios

### Memory issues with Jest
Expand Down
1 change: 1 addition & 0 deletions lib/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = class Socket extends EventEmitter {
resume() {}
ref() {}
unref() {}
write() {}

address() {
return {
Expand Down

0 comments on commit 680a44e

Please sign in to comment.