From bd197afcfa00fda95ea2a9a71aa6d281c5511072 Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Fri, 26 Aug 2016 15:28:05 +0100 Subject: [PATCH] test: fix clearing the config require cache --- lib/index.js | 2 +- test/functional/no-filter.test.js | 2 -- test/utils.js | 5 +---- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/index.js b/lib/index.js index 1bb998547..9b7278006 100644 --- a/lib/index.js +++ b/lib/index.js @@ -10,7 +10,7 @@ const app = module.exports = { function main({ port, client } = {}) { // note: the config is loaded in the main function to allow us to mock in tests if (process.env.TAP) { - delete require.cache[require.resolve('./config.js')]; + delete require.cache[require.resolve('./config')]; } const config = require('./config'); if (client === undefined) { diff --git a/test/functional/no-filter.test.js b/test/functional/no-filter.test.js index 1c3d243ce..d98da45e4 100644 --- a/test/functional/no-filter.test.js +++ b/test/functional/no-filter.test.js @@ -27,8 +27,6 @@ test('no filters broker', t => { process.env.PORT = localPort; process.env.BROKER_URL = `http://localhost:${serverPort}`; process.env.BROKER_ID = '12345'; - // invalidate the config require - delete require.cache[require.resolve(__dirname + '/../../lib/config.js')]; const client = app.main({ port: port() }); // wait for the client to successfully connect to the server and identify itself diff --git a/test/utils.js b/test/utils.js index 733fc0f02..e14c4652c 100644 --- a/test/utils.js +++ b/test/utils.js @@ -34,9 +34,6 @@ module.exports = (tap) => { return { localPort, port, - server, - resetConfig: () => { - delete require.cache[require.resolve(__dirname + '/../lib/config.js')]; - } + server }; };