diff options
Diffstat (limited to 'deps/npm/test/common-tap.js')
-rw-r--r-- | deps/npm/test/common-tap.js | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/deps/npm/test/common-tap.js b/deps/npm/test/common-tap.js index 2efca30c48..1c51ed7189 100644 --- a/deps/npm/test/common-tap.js +++ b/deps/npm/test/common-tap.js @@ -1,13 +1,12 @@ var spawn = require("child_process").spawn var path = require("path") -var fs = require("fs") var port = exports.port = 1337 exports.registry = "http://localhost:" + port process.env.npm_config_loglevel = "error" var npm_config_cache = path.resolve(__dirname, "npm_cache") -exports.npm_config_cache = npm_config_cache +process.env.npm_config_cache = exports.npm_config_cache = npm_config_cache var bin = exports.bin = require.resolve("../bin/npm-cli.js") var once = require("once") @@ -42,26 +41,3 @@ exports.npm = function (cmd, opts, cb) { }) return child } - -// based on http://bit.ly/1tkI6DJ -function deleteNpmCacheRecursivelySync(cache) { - cache = cache ? cache : npm_config_cache - var files = [] - var res - if( fs.existsSync(cache) ) { - files = fs.readdirSync(cache) - files.forEach(function(file,index) { - var curPath = path.resolve(cache, file) - if(fs.lstatSync(curPath).isDirectory()) { // recurse - deleteNpmCacheRecursivelySync(curPath) - } else { // delete file - if (res = fs.unlinkSync(curPath)) - throw Error("Failed to delete file " + curPath + ", error " + res) - } - }) - if (res = fs.rmdirSync(cache)) - throw Error("Failed to delete directory " + cache + ", error " + res) - } - return 0 -} -exports.deleteNpmCacheRecursivelySync = deleteNpmCacheRecursivelySync
\ No newline at end of file |