From 5cf266c5be4746a2e10b39dfb3011f0004a0c1fb Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 6 Jun 2025 15:49:07 +0200 Subject: [PATCH] test: fix nock usage by default, nock intercepts and redirects everything to 127.0.0.1:80 this is regardless of any http request is mocked or not nock.isActive() - is interceptor active nock.restore() removes the interceptor nock.activate() - enables interceptor again nock.cleanAll() - deletes all mocks. nothing to do with interceptor nock.activeMock() - to get the active mocks nock.persist(true/false) - the mock will reply once and set isDone(). but you can persist(true) --- src/test/system-test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/system-test.js b/src/test/system-test.js index 6dcbee153..95915662a 100644 --- a/src/test/system-test.js +++ b/src/test/system-test.js @@ -8,12 +8,16 @@ const common = require('./common.js'), expect = require('expect.js'), + nock = require('nock'), system = require('../system.js'); describe('System', function () { const { setup, cleanup } = common; - before(setup); + before(async function () { + await setup(); + if (nock.isActive()) nock.restore(); // required to connect to the docker socket + }); after(cleanup); it('can get filesystems', async function () {