Skip to content

Commit

Permalink
test: fix clearing the config require cache
Browse files Browse the repository at this point in the history
  • Loading branch information
remy committed Aug 26, 2016
1 parent df0c869 commit bd197af
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions test/functional/no-filter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ module.exports = (tap) => {
return {
localPort,
port,
server,
resetConfig: () => {
delete require.cache[require.resolve(__dirname + '/../lib/config.js')];
}
server
};
};

0 comments on commit bd197af

Please sign in to comment.