Bump the npm group with 4 updates (#2015)
* Bump the npm group with 4 updates Bumps the npm group with 4 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser), [eslint](https://github.com/eslint/eslint) and [nock](https://github.com/nock/nock). Updates `@typescript-eslint/eslint-plugin` from 6.13.0 to 6.13.2 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.13.2/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 6.13.0 to 6.13.2 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.13.2/packages/parser) Updates `eslint` from 8.54.0 to 8.55.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.54.0...v8.55.0) Updates `nock` from 13.3.8 to 13.4.0 - [Release notes](https://github.com/nock/nock/releases) - [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md) - [Commits](https://github.com/nock/nock/compare/v13.3.8...v13.4.0) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: nock dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
a16ac98583
commit
bc50092bdb
168 changed files with 813 additions and 330 deletions
39
node_modules/nock/README.md
generated
vendored
39
node_modules/nock/README.md
generated
vendored
|
|
@ -1497,6 +1497,45 @@ To set the mode call `nockBack.setMode(mode)` or run the tests with the `NOCK_BA
|
|||
|
||||
- lockdown: use recorded nocks, disables all http calls even when not nocked, doesn't record
|
||||
|
||||
### Verifying recorded fixtures
|
||||
|
||||
Although you can certainly open the recorded JSON fixtures to manually verify requests recorded by nockBack - it's sometimes useful to put those expectations in your tests.
|
||||
|
||||
The `context.query` function can be used to return all of the interceptors that were recored in a given fixture.
|
||||
|
||||
By itself, this functions as a negative expectation - you can verify that certain calls do NOT happen in the fixture. Since `assertScopesFinished` can verify there are no _extra_ calls in a fixture - pairing the two methods allows you to verify the exact set of HTTP interactions recorded in the fixture. This is especially useful when re-recording for instance, a service that synchronizes via several HTTP calls to an external API.
|
||||
|
||||
**NB**: The list of fixtures is only available when reading. It will only be populated for nocks that are played back from fixtures.
|
||||
|
||||
#### Example
|
||||
|
||||
```js
|
||||
it('#synchronize - synchronize with the external API', async localState => {
|
||||
const { nockDone, context } = await back('http-interaction.json')
|
||||
|
||||
const syncronizer = new Synchronizer(localState)
|
||||
|
||||
sycnronizer.syncronize()
|
||||
|
||||
nockDone()
|
||||
|
||||
context.assertScopesFinished()
|
||||
|
||||
expect(context.query()).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
method: 'POST',
|
||||
path: '/create/thing',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
method: 'POST',
|
||||
path: 'create/thing',
|
||||
}),
|
||||
]),
|
||||
)
|
||||
})
|
||||
```
|
||||
|
||||
## Common issues
|
||||
|
||||
**"No match for response" when using got with error responses**
|
||||
|
|
|
|||
17
node_modules/nock/lib/back.js
generated
vendored
17
node_modules/nock/lib/back.js
generated
vendored
|
|
@ -240,6 +240,23 @@ function load(fixture, options) {
|
|||
assertScopesFinished: function () {
|
||||
assertScopes(this.scopes, fixture)
|
||||
},
|
||||
query: function () {
|
||||
const nested = this.scopes.map(scope =>
|
||||
scope.interceptors.map(interceptor => ({
|
||||
method: interceptor.method,
|
||||
uri: interceptor.uri,
|
||||
basePath: interceptor.basePath,
|
||||
path: interceptor.path,
|
||||
queries: interceptor.queries,
|
||||
counter: interceptor.counter,
|
||||
body: interceptor.body,
|
||||
statusCode: interceptor.statusCode,
|
||||
optional: interceptor.optional,
|
||||
})),
|
||||
)
|
||||
|
||||
return [].concat.apply([], nested)
|
||||
},
|
||||
}
|
||||
|
||||
if (fixture && fixtureExists(fixture)) {
|
||||
|
|
|
|||
2
node_modules/nock/package.json
generated
vendored
2
node_modules/nock/package.json
generated
vendored
|
|
@ -7,7 +7,7 @@
|
|||
"testing",
|
||||
"isolation"
|
||||
],
|
||||
"version": "13.3.8",
|
||||
"version": "13.4.0",
|
||||
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
|||
13
node_modules/nock/types/index.d.ts
generated
vendored
13
node_modules/nock/types/index.d.ts
generated
vendored
|
|
@ -267,10 +267,23 @@ declare namespace nock {
|
|||
}>
|
||||
}
|
||||
|
||||
interface InterceptorSurface {
|
||||
method: string
|
||||
uri: string
|
||||
basePath: string
|
||||
path: string
|
||||
queries?: string
|
||||
counter: number
|
||||
body: string
|
||||
statusCode: number
|
||||
optional: boolean
|
||||
}
|
||||
|
||||
interface BackContext {
|
||||
isLoaded: boolean
|
||||
scopes: Scope[]
|
||||
assertScopesFinished(): void
|
||||
query: InterceptorSurface[]
|
||||
}
|
||||
|
||||
interface BackOptions {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue