Skip to content

Commit

Permalink
failing test: set global prefix in userconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jun 12, 2014
1 parent aa620a8 commit d998e73
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/tap/global-prefix-set-in-userconfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
var common = require("../common-tap.js")
var test = require("tap").test
var rimraf = require("rimraf")
var prefix = __filename.replace(/\.js$/, "")
var rcfile = __filename.replace(/\.js$/, ".npmrc")
var fs = require("fs")
var conf = "prefix = " + prefix + "\n"

test("setup", function (t) {
rimraf.sync(prefix)
fs.writeFileSync(rcfile, conf)
t.pass("ready")
t.end()
})

test("run command", function (t) {
var args = ["prefix", "-g", "--userconfig=" + rcfile]
common.npm(args, {}, function (er, code, so, se) {
if (er) throw er
t.equal(code, 0)
t.equal(so.trim(), prefix)
t.end()
})
})

test("made dir", function (t) {
t.ok(fs.statSync(prefix).isDirectory())
t.end()
})

test("cleanup", function (t) {
rimraf.sync(prefix)
rimraf.sync(rcfile)
t.pass("clean")
t.end()
})

0 comments on commit d998e73

Please sign in to comment.