How to use the disableNetConnect function from nock
Find comprehensive JavaScript nock.disableNetConnect code examples handpicked from public code repositorys.
4747 4748 4749 4750 4751 4752 4753 4754 4755 4756
stepMock = getStepMock(testStep); stepFactoryMock.get.withArgs({ buildId: id, name: step }).resolves(stepMock); buildFactoryMock.get.resolves(buildMock); eventFactoryMock.get.resolves(eventMock); pipelineFactoryMock.get.resolves(pipelineMock); nock.disableNetConnect(); }); afterEach(() => { nock.cleanAll();
161
969
65
GitHub: AndrewD314/hyper-wicked
4 5 6 7 8 9 10 11 12 13 14
// Uncomment this to find requests that aren't matching // nock.emitter.on('no match', req => console.log(req.options)) module.exports = tnock function tnock (t, host, opts) { nock.disableNetConnect() const server = nock(host, opts) t.teardown(function () { nock.enableNetConnect() server.done()
0
0
0
87 88 89 90 91 92 93 94 95 96 97
beforeAll(() => { nock.disableNetConnect() nock.enableNetConnect(/localhost|(products|pandas):4000/) // Since we use an Apollo Studio Key to enable federation, we need to mock the usage reporting // This is not critical, as we already have a nock.disableNetConnect() nothing is sent to the internet // But removes noisy logs nock('https://usage-reporting.api.apollographql.com/api').persist().post('/ingress/traces').reply(204) })
0
0
1
+ 3 other calls in file
nock.cleanAll is the most popular function in nock (317 examples)