summaryrefslogtreecommitdiff
path: root/deps/npm/test/tap/publish-config.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/test/tap/publish-config.js')
-rw-r--r--deps/npm/test/tap/publish-config.js37
1 files changed, 19 insertions, 18 deletions
diff --git a/deps/npm/test/tap/publish-config.js b/deps/npm/test/tap/publish-config.js
index 39d6e83113..9e537a9206 100644
--- a/deps/npm/test/tap/publish-config.js
+++ b/deps/npm/test/tap/publish-config.js
@@ -1,11 +1,11 @@
-var common = require('../common-tap.js')
-var test = require('tap').test
-var fs = require('fs')
-var osenv = require('osenv')
-var pkg = process.env.npm_config_tmp || '/tmp'
-pkg += '/npm-test-publish-config'
+var common = require("../common-tap.js")
+var test = require("tap").test
+var fs = require("fs")
+var osenv = require("osenv")
+var pkg = process.env.npm_config_tmp || "/tmp"
+pkg += "/npm-test-publish-config"
-require('mkdirp').sync(pkg)
+require("mkdirp").sync(pkg)
fs.writeFileSync(pkg + "/package.json", JSON.stringify({
name: "npm-test-publish-config",
@@ -19,21 +19,19 @@ fs.writeFileSync(pkg + "/fixture_npmrc",
"//localhost:1337/:_password = " + new Buffer("feast").toString("base64") + "\n" +
"registry = http://localhost:1337/")
-var spawn = require('child_process').spawn
-var npm = require.resolve('../../bin/npm-cli.js')
-var node = process.execPath
-
test(function (t) {
var child
- require('http').createServer(function (req, res) {
- t.pass('got request on the fakey fake registry')
+ require("http").createServer(function (req, res) {
+ t.pass("got request on the fakey fake registry")
t.end()
this.close()
res.statusCode = 500
- res.end('{"error":"sshhh. naptime nao. \\^O^/ <(YAWWWWN!)"}')
+ res.end(JSON.stringify({
+ error: "sshhh. naptime nao. \\^O^/ <(YAWWWWN!)"
+ }))
child.kill()
}).listen(common.port, function () {
- t.pass('server is listening')
+ t.pass("server is listening")
// don't much care about listening to the child's results
// just wanna make sure it hits the server we just set up.
@@ -42,17 +40,20 @@ test(function (t) {
// itself functions normally.
//
// Make sure that we don't sit around waiting for lock files
- child = spawn(node, [npm, "publish", "--userconfig=" + pkg + "/fixture_npmrc"], {
+ child = common.npm(["publish", "--userconfig=" + pkg + "/fixture_npmrc"], {
cwd: pkg,
stdio: "inherit",
env: {
- npm_config_cache_lock_stale: 1000,
- npm_config_cache_lock_wait: 1000,
+ "npm_config_cache_lock_stale": 1000,
+ "npm_config_cache_lock_wait": 1000,
HOME: process.env.HOME,
Path: process.env.PATH,
PATH: process.env.PATH,
USERPROFILE: osenv.home()
}
+ }, function (err, code) {
+ t.ifError(err, "publish command finished successfully")
+ t.notOk(code, "npm install exited with code 0")
})
})
})