From d998e73034686f287e34f81922e7afc92731c1ad Mon Sep 17 00:00:00 2001 From: isaacs Date: Thu, 12 Jun 2014 15:01:50 -0700 Subject: [PATCH] failing test: set global prefix in userconfig --- test/tap/global-prefix-set-in-userconfig.js | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/tap/global-prefix-set-in-userconfig.js diff --git a/test/tap/global-prefix-set-in-userconfig.js b/test/tap/global-prefix-set-in-userconfig.js new file mode 100644 index 00000000000..b7be916eb00 --- /dev/null +++ b/test/tap/global-prefix-set-in-userconfig.js @@ -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() +})