diff --git a/test/integration/client/force-native-with-envvar-tests.js b/test/integration/client/force-native-with-envvar-tests.js index 93b9dddc..e41587d7 100644 --- a/test/integration/client/force-native-with-envvar-tests.js +++ b/test/integration/client/force-native-with-envvar-tests.js @@ -1,3 +1,8 @@ +/** + * helper needs to be loaded for the asserts but it alos proloads + * client which we don't want here + * + */ var helper = require(__dirname+"/test-helper") , path = require('path') ; @@ -10,18 +15,17 @@ var paths = { /** * delete the modules we are concerned about from the - * module cache + * module cache, so they get loaded cleanly and the env + * var can kick in ... */ -function deleteFromCache(){ - Object.keys(paths).forEach(function(module){ - var cache_key = paths[ module ]; - delete require.cache[ cache_key ]; +function emptyCache(){ + Object.keys(require.cache).forEach(function(key){ + delete require.cache[key]; }); }; - -deleteFromCache(); -process.env.NODE_PG_FORCE_NATIVE = "1"; +emptyCache(); +process.env.NODE_PG_FORCE_NATIVE = '1'; var pg = require( paths.pg ); var query_native = require( paths.query_native ); @@ -30,5 +34,5 @@ var query_js = require( paths.query_js ); assert.deepEqual(pg.Client.Query, query_native); assert.notDeepEqual(pg.Client.Query, query_js); -deleteFromCache(); +emptyCache(); delete process.env.NODE_PG_FORCE_NATIVE