diff options
author | isaacs <i@izs.me> | 2014-05-01 11:09:00 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2014-05-01 11:09:00 -0700 |
commit | f76c3938d0660378017bf276a72ea60e9adfe62c (patch) | |
tree | c2eedc352746051ce71d5ea91922d9a2139babef /deps/npm/test/common-tap.js | |
parent | 1038959dbf70800545df319715e5d89dbd8ad8af (diff) | |
download | android-node-v8-f76c3938d0660378017bf276a72ea60e9adfe62c.tar.gz android-node-v8-f76c3938d0660378017bf276a72ea60e9adfe62c.tar.bz2 android-node-v8-f76c3938d0660378017bf276a72ea60e9adfe62c.zip |
npm: upgrade to v1.4.8
* Check SHA before using files from cache
* adduser: allow change of the saved password
* Make `npm install` respect `config.unicode`
* Fix lifecycle to pass `Infinity` for config env value
* Don't return 0 exit code on invalid command
* cache: Handle 404s and other HTTP errors as errors
* bump tap dep, make tests stderr a bit quieter
* Resolve ~ in path configs to env.HOME
* Include npm version in default user-agent conf
* npm init: Use ISC as default license, use save-prefix for deps
* Many test and doc fixes
Diffstat (limited to 'deps/npm/test/common-tap.js')
-rw-r--r-- | deps/npm/test/common-tap.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/deps/npm/test/common-tap.js b/deps/npm/test/common-tap.js index a13a0a7cde..d6d09ed9bc 100644 --- a/deps/npm/test/common-tap.js +++ b/deps/npm/test/common-tap.js @@ -1,2 +1,32 @@ +var spawn = require("child_process").spawn + var port = exports.port = 1337 exports.registry = "http://localhost:" + port +process.env.npm_config_loglevel = "error" + +var bin = exports.bin = require.resolve("../bin/npm-cli.js") +var once = require("once") +exports.npm = function (cmd, opts, cb) { + cb = once(cb) + cmd = [bin].concat(cmd) + opts = opts || {} + + var stdout = "" + , stderr = "" + , node = process.execPath + , child = spawn(node, cmd, opts) + + if (child.stderr) child.stderr.on("data", function (chunk) { + stderr += chunk + }) + + if (child.stdout) child.stdout.on("data", function (chunk) { + stdout += chunk + }) + + child.on("error", cb) + + child.on("close", function (code, signal) { + cb(null, code, stdout, stderr) + }) +} |