Please avoid duplicates
Reproducible test case
See example snippet in description.
Nock Version
13.2.4
Node Version
16.13.1
TypeScript Version
No response
What happened?
Removing interceptors through nock.removeInterceptor correctly removes them from pending and active mocks, but does not remove them from their scope's interceptors array. This seems similar to #721 but related to scope.interceptors rather than nock.pendingMocks().
Repro:
const nock = require('nock')
const scope = nock('http://example.com').get('/').reply(200)
console.log('interceptor count in scope:', scope.interceptors.length)
nock.removeInterceptor(scope.interceptors[0])
console.log('interceptor count in scope:', scope.interceptors.length)
Expected logged values:
interceptor count in scope: 1
interceptor count in scope: 0
Actual logged values:
interceptor count in scope: 1
interceptor count in scope: 1
Would you be interested in contributing a fix?
Please avoid duplicates
Reproducible test case
See example snippet in description.
Nock Version
13.2.4
Node Version
16.13.1
TypeScript Version
No response
What happened?
Removing interceptors through
nock.removeInterceptorcorrectly removes them from pending and active mocks, but does not remove them from their scope'sinterceptorsarray. This seems similar to #721 but related toscope.interceptorsrather thannock.pendingMocks().Repro:
Expected logged values:
Actual logged values:
Would you be interested in contributing a fix?