Update checked-in dependencies
This commit is contained in:
parent
4fad06f438
commit
40a500c743
4168 changed files with 298222 additions and 374905 deletions
89
node_modules/nock/README.md
generated
vendored
89
node_modules/nock/README.md
generated
vendored
|
|
@ -159,7 +159,7 @@ If you don’t want interceptors to be removed as they are used, you can use the
|
|||
|
||||
### Specifying hostname
|
||||
|
||||
The request hostname can be a string or a RegExp.
|
||||
The request hostname can be a string, URL, or a RegExp.
|
||||
|
||||
```js
|
||||
const scope = nock('http://www.example.com')
|
||||
|
|
@ -167,6 +167,12 @@ const scope = nock('http://www.example.com')
|
|||
.reply(200, 'domain matched')
|
||||
```
|
||||
|
||||
```js
|
||||
const scope = nock(new URL('http://www.example.com'))
|
||||
.get('/resource')
|
||||
.reply(200, 'domain matched')
|
||||
```
|
||||
|
||||
```js
|
||||
const scope = nock(/example\.com/)
|
||||
.get('/resource')
|
||||
|
|
@ -846,11 +852,24 @@ If you need to match requests only if certain request headers match, you can.
|
|||
|
||||
```js
|
||||
const scope = nock('http://api.myservice.com')
|
||||
// Interceptors created after here will only match when the header `accept` equals `application/json`.
|
||||
.matchHeader('accept', 'application/json')
|
||||
.get('/')
|
||||
.reply(200, {
|
||||
data: 'hello world',
|
||||
})
|
||||
.get('/')
|
||||
// Only this interceptor will match the header value `x-my-action` with `MyFirstAction`
|
||||
.matchHeader('x-my-action', 'MyFirstAction')
|
||||
.reply(200, {
|
||||
data: 'FirstActionResponse',
|
||||
})
|
||||
.get('/')
|
||||
// Only this interceptor will match the header value `x-my-action` with `MySecondAction`
|
||||
.matchHeader('x-my-action', 'MySecondAction')
|
||||
.reply(200, {
|
||||
data: 'SecondActionResponse',
|
||||
})
|
||||
```
|
||||
|
||||
You can also use a regexp for the header body.
|
||||
|
|
@ -1323,6 +1342,18 @@ const interceptor = nock('http://example.org').get('somePath')
|
|||
nock.removeInterceptor(interceptor)
|
||||
```
|
||||
|
||||
**Note** `.reply(...)` method returns Scope, not Interceptor, and so it is not a valid argument for `nock.removeInterceptor`. So if your method chain ends with `.reply` to be used with `nock.removeInterceptor` the chain need to be break in between:
|
||||
|
||||
```js
|
||||
// this will NOT work
|
||||
const interceptor = nock('http://example.org').get('somePath').reply(200, 'OK')
|
||||
nock.removeInterceptor(interceptor)
|
||||
// this is how it should be
|
||||
const interceptor = nock('http://example.org').get('somePath')
|
||||
interceptor.reply(200, 'OK')
|
||||
nock.removeInterceptor(interceptor)
|
||||
```
|
||||
|
||||
## Events
|
||||
|
||||
A scope emits the following events:
|
||||
|
|
@ -1402,6 +1433,14 @@ return nockBack('promisedFixture.json').then(({ nockDone, context }) => {
|
|||
})
|
||||
```
|
||||
|
||||
Or, with async/await:
|
||||
|
||||
```js
|
||||
const { nockDone, context } = await nockBack('promisedFixture.json')
|
||||
// your test code
|
||||
nockDone()
|
||||
```
|
||||
|
||||
#### Options
|
||||
|
||||
As an optional second parameter you can pass the following options
|
||||
|
|
@ -1451,6 +1490,8 @@ To set the mode call `nockBack.setMode(mode)` or run the tests with the `NOCK_BA
|
|||
|
||||
- record: use recorded nocks, record new nocks
|
||||
|
||||
- update: remove recorded nocks, record nocks
|
||||
|
||||
- lockdown: use recorded nocks, disables all http calls even when not nocked, doesn't record
|
||||
|
||||
## Common issues
|
||||
|
|
@ -1498,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.
|
||||
|
|
@ -1518,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
|
||||
|
|
@ -1565,10 +1618,30 @@ By participating in this project you agree to abide by its terms.
|
|||
Thanks goes to these wonderful people ([emoji key](https://github.com/all-contributors/all-contributors#emoji-key)):
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
||||
<!-- prettier-ignore -->
|
||||
| [<img src="https://avatars1.githubusercontent.com/u/47910?v=4" width="100px;" alt="Pedro Teixeira"/><br /><sub><b>Pedro Teixeira</b></sub>](http://pgte.me)<br />[💻](https://github.com/nock/nock/commits?author=pgte "Code") [🚧](#maintenance-pgte "Maintenance") | [<img src="https://avatars3.githubusercontent.com/u/10771967?v=4" width="100px;" alt="n30n0v"/><br /><sub><b>n30n0v</b></sub>](https://github.com/n30n0v)<br />[💻](https://github.com/nock/nock/commits?author=n30n0v "Code") | [<img src="https://avatars3.githubusercontent.com/u/910753?v=4" width="100px;" alt="Richard Littauer"/><br /><sub><b>Richard Littauer</b></sub>](https://burntfen.com)<br />[🚧](#maintenance-RichardLitt "Maintenance") [💻](https://github.com/nock/nock/commits?author=RichardLitt "Code") [📝](#blog-RichardLitt "Blogposts") | [<img src="https://avatars1.githubusercontent.com/u/3731165?v=4" width="100px;" alt="Ian Walker-Sperber"/><br /><sub><b>Ian Walker-Sperber</b></sub>](http://ianwsperber.com)<br />[💻](https://github.com/nock/nock/commits?author=ianwsperber "Code") | [<img src="https://avatars2.githubusercontent.com/u/1505203?v=4" width="100px;" alt="Ivan Erceg"/><br /><sub><b>Ivan Erceg</b></sub>](http://ilovacha.com)<br />[💻](https://github.com/nock/nock/commits?author=ierceg "Code") [🚧](#maintenance-ierceg "Maintenance") | [<img src="https://avatars2.githubusercontent.com/u/1487036?v=4" width="100px;" alt="Paul Melnikow"/><br /><sub><b>Paul Melnikow</b></sub>](https://twitter.com/paulmelnikow)<br />[💻](https://github.com/nock/nock/commits?author=paulmelnikow "Code") [🚧](#maintenance-paulmelnikow "Maintenance") | [<img src="https://avatars3.githubusercontent.com/u/39992?v=4" width="100px;" alt="Gregor Martynus"/><br /><sub><b>Gregor Martynus</b></sub>](https://twitter.com/gr2m)<br />[💻](https://github.com/nock/nock/commits?author=gr2m "Code") [🚧](#maintenance-gr2m "Maintenance") [💼](#business-gr2m "Business development") [💵](#financial-gr2m "Financial") [📝](#blog-gr2m "Blogposts") |
|
||||
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
||||
| [<img src="https://avatars1.githubusercontent.com/u/6701030?v=4" width="100px;" alt="Hutson Betts"/><br /><sub><b>Hutson Betts</b></sub>](https://gitlab.com/hutson)<br />[💵](#financial-hutson "Financial") | [<img src="https://avatars2.githubusercontent.com/u/6105119?v=4" width="100px;" alt="Jonas Lilja"/><br /><sub><b>Jonas Lilja</b></sub>](http://lilja.io)<br />[💵](#financial-jlilja "Financial") [💻](https://github.com/nock/nock/commits?author=jlilja "Code") | [<img src="https://avatars0.githubusercontent.com/u/4446950?v=4" width="100px;" alt="Benjamin Ki"/><br /><sub><b>Benjamin Ki</b></sub>](https://github.com/benrki)<br />[💵](#financial-benrki "Financial") | [<img src="https://avatars2.githubusercontent.com/u/3250463?v=4" width="100px;" alt="Chad Fawcett"/><br /><sub><b>Chad Fawcett</b></sub>](http://chadf.ca)<br />[💵](#financial-chadfawcett "Financial") |
|
||||
<!-- prettier-ignore-start -->
|
||||
<!-- markdownlint-disable -->
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center"><a href="http://pgte.me"><img src="https://avatars1.githubusercontent.com/u/47910?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Pedro Teixeira</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=pgte" title="Code">💻</a> <a href="#maintenance-pgte" title="Maintenance">🚧</a></td>
|
||||
<td align="center"><a href="https://github.com/n30n0v"><img src="https://avatars3.githubusercontent.com/u/10771967?v=4?s=100" width="100px;" alt=""/><br /><sub><b>n30n0v</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=n30n0v" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://burntfen.com"><img src="https://avatars3.githubusercontent.com/u/910753?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Richard Littauer</b></sub></a><br /><a href="#maintenance-RichardLitt" title="Maintenance">🚧</a> <a href="https://github.com/nock/nock/commits?author=RichardLitt" title="Code">💻</a> <a href="#blog-RichardLitt" title="Blogposts">📝</a></td>
|
||||
<td align="center"><a href="http://ianwsperber.com"><img src="https://avatars1.githubusercontent.com/u/3731165?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ian Walker-Sperber</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=ianwsperber" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://ilovacha.com"><img src="https://avatars2.githubusercontent.com/u/1505203?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Erceg</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=ierceg" title="Code">💻</a> <a href="#maintenance-ierceg" title="Maintenance">🚧</a></td>
|
||||
<td align="center"><a href="https://twitter.com/paulmelnikow"><img src="https://avatars2.githubusercontent.com/u/1487036?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Paul Melnikow</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=paulmelnikow" title="Code">💻</a> <a href="#maintenance-paulmelnikow" title="Maintenance">🚧</a></td>
|
||||
<td align="center"><a href="https://twitter.com/gr2m"><img src="https://avatars3.githubusercontent.com/u/39992?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gregor Martynus</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=gr2m" title="Code">💻</a> <a href="#maintenance-gr2m" title="Maintenance">🚧</a> <a href="#business-gr2m" title="Business development">💼</a> <a href="#financial-gr2m" title="Financial">💵</a> <a href="#blog-gr2m" title="Blogposts">📝</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://gitlab.com/hutson"><img src="https://avatars1.githubusercontent.com/u/6701030?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hutson Betts</b></sub></a><br /><a href="#financial-hutson" title="Financial">💵</a></td>
|
||||
<td align="center"><a href="http://lilja.io"><img src="https://avatars2.githubusercontent.com/u/6105119?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jonas Lilja</b></sub></a><br /><a href="#financial-jlilja" title="Financial">💵</a> <a href="https://github.com/nock/nock/commits?author=jlilja" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/benrki"><img src="https://avatars0.githubusercontent.com/u/4446950?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Benjamin Ki</b></sub></a><br /><a href="#financial-benrki" title="Financial">💵</a></td>
|
||||
<td align="center"><a href="http://chadf.ca"><img src="https://avatars2.githubusercontent.com/u/3250463?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chad Fawcett</b></sub></a><br /><a href="#financial-chadfawcett" title="Financial">💵</a></td>
|
||||
<td align="center"><a href="http://www.laurencemyers.com.au"><img src="https://avatars.githubusercontent.com/u/6336048?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Laurence Dougal Myers</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=laurence-myers" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/Beretta1979"><img src="https://avatars.githubusercontent.com/u/10073962?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sébastien Van Bruaene</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=Beretta1979" title="Code">💻</a> <a href="https://github.com/nock/nock/commits?author=Beretta1979" title="Tests">⚠️</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue