diff --git a/src/routes/test/appstore-test.js b/src/routes/test/appstore-test.js index 865693ba5..8804a1ac2 100644 --- a/src/routes/test/appstore-test.js +++ b/src/routes/test/appstore-test.js @@ -17,6 +17,7 @@ const { setup, cleanup, serverUrl, owner, appstoreToken } = common; describe('Appstore Apps API', function () { before(setup); + before(() => { if (!nock.isActive()) nock.activate(); }); after(cleanup); it('cannot list apps when appstore is down', async function () { diff --git a/src/routes/test/support-test.js b/src/routes/test/support-test.js index e162418ea..d34ea5c62 100644 --- a/src/routes/test/support-test.js +++ b/src/routes/test/support-test.js @@ -16,6 +16,7 @@ describe('Support API', function () { const { setup, cleanup, serverUrl, owner, mockApiServerOrigin, appstoreToken, user, admin } = common; before(setup); + before(() => { if (!nock.isActive()) nock.activate(); }); after(cleanup); const authorizedKeysFile = support._sshInfo().filePath; diff --git a/src/test/appstore-test.js b/src/test/appstore-test.js index fa6e11b63..f18c12455 100644 --- a/src/test/appstore-test.js +++ b/src/test/appstore-test.js @@ -19,6 +19,7 @@ describe('Appstore', function () { const { setup, cleanup, appstoreToken, mockApiServerOrigin } = common; before(setup); + before(() => { if (!nock.isActive()) nock.activate(); }); after(cleanup); beforeEach(nock.cleanAll); diff --git a/src/test/common.js b/src/test/common.js index a941c0518..e7cdfc334 100644 --- a/src/test/common.js +++ b/src/test/common.js @@ -212,6 +212,7 @@ function createTree(root, obj) { } async function databaseSetup() { + if (nock.isActive()) nock.restore(); nock.cleanAll(); await database.initialize(); @@ -221,6 +222,7 @@ async function databaseSetup() { } async function domainSetup() { + if (nock.isActive()) nock.restore(); nock.cleanAll(); await databaseSetup(); @@ -242,6 +244,7 @@ async function setup() { } async function cleanup() { + if (nock.isActive()) nock.restore(); nock.cleanAll(); mailer._mailQueue = []; diff --git a/src/test/dns-providers-test.js b/src/test/dns-providers-test.js index 10e5ca5b3..7abc77dc5 100644 --- a/src/test/dns-providers-test.js +++ b/src/test/dns-providers-test.js @@ -21,6 +21,7 @@ describe('dns provider', function () { const domainCopy = Object.assign({}, domain); // make a copy before(setup); + before(() => { if (!nock.isActive()) nock.activate(); }); after(cleanup); describe('noop', function () { diff --git a/src/test/updatechecker-test.js b/src/test/updatechecker-test.js index 5659a2b7f..10c0fc8bb 100644 --- a/src/test/updatechecker-test.js +++ b/src/test/updatechecker-test.js @@ -21,6 +21,7 @@ describe('updatechecker', function () { const { setup, cleanup, app, appstoreToken, mockApiServerOrigin } = common; before(setup); + before(() => { if (!nock.isActive()) nock.activate(); }); after(cleanup); describe('box', function () {